SpiderPig Posted July 1, 2018 Posted July 1, 2018 I have a large world and there are heights exceeding 2000m, this quick code example shows that at a height higher than 660m the shadow disappears but interestingly the stats still say it's being drawn. Can anyone else confirm this? Is there shadow range for the world or something or is this a bug? #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } Model* box; Camera* camera; bool wireframe = false; bool App::Start() { window = Window::Create("Shadows",50,50, 1024, 768); window->Show(); context = Context::Create(window); world = World::Create(); DirectionalLight* light = DirectionalLight::Create(); light->SetRotation(35, 35, 35); float offsetY = 670.0f;//Increase to 670.0f and shadow disapears. camera = Camera::Create(); camera->Move(0, 1 + offsetY, -2); box = Model::Box(); box->Move(0, 1 + offsetY, 0); Pivot* centre = Pivot::Create(); int xGrid = 3; int zGrid = 3; int vertIndex = 0; Model* mdl = Model::Create(); Surface* surface = mdl->AddSurface(); for (int z = 0; z < zGrid; z++) { for (int x = 0; x < xGrid; x++) { surface->AddVertex(x, offsetY, z,0,1,0); if (z != 0 && x != 0) { surface->AddTriangle(vertIndex, vertIndex - xGrid, vertIndex - 1); surface->AddTriangle(vertIndex - xGrid, vertIndex - xGrid - 1, vertIndex - 1); } vertIndex++; } } surface->Update(); mdl->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB); return true; } bool App::Loop() { if (window->KeyHit(Key::Escape) == true) { return false; } if (window->KeyHit(Key::F1) == true) { camera->GetDebugPhysicsMode() == true ? camera->SetDebugPhysicsMode(false) : camera->SetDebugPhysicsMode(true); } if (window->KeyHit(Key::F2) == true) { if (wireframe == true) { camera->SetDrawMode(0); wireframe = false; } else { camera->SetDrawMode(2); wireframe = true; } } 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); context->DrawStats(10.0f, 10.0f, true); context->Sync(true); return true; } EDIT : It seems to be fine in the editor. I have some objects at a Y position of 23000.0 Quote
gamecreator Posted July 1, 2018 Posted July 1, 2018 I came across something similar. Maybe this will help: https://www.leadwerks.com/community/topic/16827-directionallightshadowstagerange4/ Quote
SpiderPig Posted July 1, 2018 Author Posted July 1, 2018 Did quick test and it didn't solve it, will have another go later. Maybe each stage needs setting uniformly? Quote
SpiderPig Posted July 2, 2018 Author Posted July 2, 2018 Tried again, setting all of them to massive numbers like 10,000 but nothing changes... Quote
Solution SpiderPig Posted October 7, 2018 Author Solution Posted October 7, 2018 I found the problem to be the world size. Making it bigger allowed the shadows to show up. @Josh I'm curious as to what exactly setting the world size does, because so far my models have been showing up fine, it's just the shadows that was affected. Quote
Josh Posted October 7, 2018 Posted October 7, 2018 That is not suprising. This controls the max size of the world octree. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.