Jump to content

Vegetation Does Not Render Outside Bounds


Recommended Posts

In the editor the vegetation seems to display fine. However, when I play in a C++ project, there are "straight" lines of vegetation where the rendering stops. Vegetation does not render roughly when x>100, x<-104, z>95 or z<-107. This is true for both the default trees and bushes (and I assume grass but I did not test that). However, the physics collision for is still there and I bump into invisible trees as I walk with the controller.

 

This is on standard Leadwerks and I just tested it with an updated and rebuilt project with an update I got a few minutes ago.

 

First screenshot is from the editor (showing a flat box I put in for reference. The second and third shots are from in-game with the same box showing in the top-right and then standing on top of in the third. The fourth is where there should be visible trees on the right.

post-368-0-19419800-1462466434_thumb.jpg

post-368-0-57431200-1462466442_thumb.jpg

post-368-0-04227400-1462466451_thumb.jpg

post-368-0-46276700-1462466458_thumb.jpg

Link to comment
Share on other sites

I copied the Trees folder over to a TreesLeadwerks folder so that I won't get them confused with trees I want to import (TreesPure3D). I suspect you would need to do the same. Attached is the load log from the editor, if it helps.

 

Looking at the log, I did just notice that the tree still pulls materials and textures from the old folder. Shouldn't it be loading it from the current folder first? Probably not related but still a bit strange. I wonder what happens if I delete that old folder... Edit: removing the old folder had Leadwerks checking the current folder, which works. But the vegetation still didn't show up outside of the boundaries.

HDEditorLoadLog.txt

Link to comment
Share on other sites

I cleared the code and made a simple moving camera but used the same map and all vegetation was now visible. So it's something in the code that somehow makes the outer vegetation invisible. Couldn't guess what could do that but maybe I'll start pasting code back little by little. If parenting a camera to a pivot could make Shadmar's shaders not work, maybe I'm doing something else Leadwerks doesn't like.

 

Edit: This has something to do with the pivot and/or the controller being near the "edge." I added controls that control just the camera, independent of the pivot/controller.

 

if(window->KeyDown(Key::I)) camera->Move(0, 0, 2.9*Time::GetSpeed(), false);
if(window->KeyDown(Key::K)) camera->Move(0, 0, -2.9*Time::GetSpeed(), false);
if(window->KeyDown(Key::L)) camera->Move(2.9*Time::GetSpeed(), 0, 0, false);
if(window->KeyDown(Key::J)) camera->Move(-2.9*Time::GetSpeed(), 0, 0, false);

if(window->KeyDown(Key::Up)) pitch+=0.9*Time::GetSpeed();
if(window->KeyDown(Key::Down)) pitch-=0.9*Time::GetSpeed();
if(window->KeyDown(Key::Right)) yaw+=0.9*Time::GetSpeed();
if(window->KeyDown(Key::Left)) yaw-=0.9*Time::GetSpeed();

camera->SetRotation(pitch, yaw, roll, true);

 

If I bring the character close to the edge, the vegetation doesn't render no matter what. If I take the character/pivot away but bring the camera back, the vegetation does render - all in the same run. Super strange. I was going to redo the camera to not rely on the parenting-to-the-character trick anyway so I think/hope that will solve it.

Link to comment
Share on other sites

  • 4 weeks later...

I suspect there's some part in my code maybe that is using the camera's local space. However, I checked Vegetation.cpp and could not find any problems.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Great, I was able to reproduce this problem by parenting the camera to a pivot. Should be easy to solve now.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...