Jump to content

SpiderPig

Supporters
  • Content count

    224
  • Joined

  • Last visited

Community Reputation

14 Good

About SpiderPig

  • Rank
    Advanced Member
  • Birthday 06/23/1989

Profile Information

  • Gender
    Male
  • Location
    Tas, Australia
  • Interests
    Computer graphics; games programming; flying; metal and wood working; story writing; submarine building (see blog); and AI.

Recent Profile Visitors

4,718 profile views
  1. SpiderPig

    Per Triangle Bilboarding

    I'm currently trying to write a shader that makes every triangle of the mesh point to the position of the camera regardless of the camera's rotation. I think I can multiply the vertex positions in the vertex shader by a one of the matrices but I'm not sure which one or how. And I think the camera matrix will rotate the triangle to the same orientation as the camera and not just point to it's position? Basically I need the vertex shader (or geometry if it's easier) to do what Entity::Point() does but on each triangle and not the mesh as a whole. Anyone got any ideas on how to do this? 🤔 EDIT : I've been getting the direction the camera like this; normalize(vsModelVertexPosition.xyz - cameraposition)
  2. SpiderPig

    What Makes a Good Brand Name?

    Love it! Can't wait to see some awsome games made with "Turbo Game Engine"
  3. Looking forward to hearing more on this. On the subject of lighting, are there techniques around that allow infinite distance shadow rendering?
  4. I would like to see your approach to lighting. Very interested to see how it effects performance.
  5. SpiderPig

    Buffer Alpha

    Works now, thanks Ma-Shell!
  6. SpiderPig

    Buffer Alpha

    I had a GUI class before the in built system was available and I'd rather not go through and replace everything if I can help it. Run this code and you'll see the issue. Your code macklebee draws the text with transparency on a solid background. I want the entire image to be completely transparent. Then I will draw what I need to on it. Then it will be drawn over the top of previously drawn items. Buffer* buffer; bool App::Start() { window = Window::Create("Test"); window->Show(); context = Context::Create(window); world = World::Create(); Camera* camera = Camera::Create(); buffer = Buffer::Create(1024, 768, 1, 0); return true; } bool App::Loop() { if (window->KeyHit(Key::Escape) == true) { return false; } world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); buffer->Enable(); buffer->SetColor(0, 0, 0, 0); buffer->Clear(); //buffer alpha is not being cleared context->SetColor(1, 0, 0, 1); context->DrawRect(80, 50, 100, 100); context->Enable(); context->SetColor(1, 1, 1, 1); context->DrawRect(10, 10, 100, 100); //white rectangle not showing. context->DrawImage(buffer->GetColorTexture(), 0, 0); context->SetBlendMode(Blend::Solid); context->Sync(); return true; } If I set the buffers alpha to 0, shouldn't it be transparent except for the red rectangle?
  7. SpiderPig

    Buffer Alpha

    I accidentally added an extra 1 in SetColor() when typing the post, sorry. Besides that, all the info is there. I've created a buffer and am drawing it to the context (not a materiel). The reason is so that any UI that may overlap other UI can be drawn to this buffer and then drawn last with context->DrawImage() on top of the whole screen. The drawing to the buffer works fine, but the buffer has to be cleared every frame so that previous drawings are gone. Which brings me to asking, how to clear the buffer with transparency because SetColor(1,1,1,0) (I think) should set it to complete transparency regardless of the RGB values. But it's not. I tried your suggestion with setting it as the current buffer first then calling context->SetBlendMode() but it still is just the RGB values, no alpha. If I draw the newly made buffer without clearing first, the image is totally transparent and only shows the drawings like it should, but it needs to be cleared ready for the next frame.
  8. SpiderPig

    Buffer Alpha

    I'm using a buffer to draw some 2D graphics too but can't seam to clear the buffer with transparency. I looked at the forum here for the info regarding buffers and 2D drawing; I tried clearing the buffer with this code but only get a white screen; //App Start Buffer* topLevelBuffer = Buffer::Create(1024, 768, 1, 0); //Draw Loop topLevelBuffer->SetColor(1, 1, 1, 0); topLevelBuffer->Clear(); topLevelBuffer->Enable(); DrawUI(topLevelBuffer); _context->Enable(); _context->DrawImage(topLevelBuffer->GetColorTexture(), 0, 0); Anyone had any luck with clearing to a transparent buffer?
  9. I've just noticed that if you parent a cube to a pivot, the cubes shadow disappears... is this supposed to happen?

    1. Josh

      Josh

      Yes, actually, because the parent pivot's shadow mode is 0.

    2. SpiderPig

      SpiderPig

      Okay thanks.  I'll just call SetShadowMode(1) then

  10. SpiderPig

    PostRender in C++

    In C++, after you render the world you can just draw to the context. World->Update() World->Render() Context->DrawRect() Context->Sync()
  11. Hi, you can call Window::GetCurrent () and Context:: GetCurrent(). To access the camera in all classes however, I create a global variable that each class can access.
  12. SpiderPig

    GetRotation() returning incorrect Z axis

    Ah okay. Thanks for the explanation.
  13. SpiderPig

    GetRotation() returning incorrect Z axis

    I tried that and and it seems to do the exact same thing. With the following code though, GetRotation(false) works but GetRotation(true) dosn't. I think the global xy & z will vary to the local rotation due to rotation on multiple axis's, but it shouldn't set to zero suddenly then back to some other number should it? Vec3 rot = box->GetRotation(); rot.x += 0.2f; rot.y += 0.2f; rot.z += 0.2f; box->SetRotation(rot); Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); std::stringstream ss; ss << "rot = " << box->GetRotation().ToString(); context->DrawShadowText(ss.str(), 20, 20); ss.str(""); ss << "rot = " << box->GetRotation(true).ToString(); context->DrawShadowText(ss.str(), 20, 40);
  14. When turning an entity, GetRotation() will return correct for a while then the Z axis will pop to zero for a bit before it starts reading properly again. Below is some test code showing the problem. On my current project, sometimes the Turn() function will suddenly pop to random values, but I'm unable to reproduce this here yet. I'm using the latest BETA build. #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } Model* box; bool App::Start() { window = Window::Create("Turn Test",50,50, 1024, 768); window->Show(); context = Context::Create(window); world = World::Create(); DirectionalLight* light = DirectionalLight::Create(); light->SetRotation(35, 35, 35); Camera* camera = Camera::Create(); box = Model::Box(); box->Move(0, 0, 2); return true; } bool App::Loop() { if (window->KeyHit(Key::Escape) == true) { return false; } box->Turn(0.2, 0.2, 0.2); Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); std::stringstream ss; ss << "rot = " << box->GetRotation().ToString(); context->DrawShadowText(ss.str(), 20, 20); context->Sync(true); return true; }
×