Jump to content

...jumpy shadows and objects...


SpiderPig
 Share

Recommended Posts

Hey everyone,

 

I'm fairly new to Leadwerks, so go easy on me =]

I'm not sure if I'm doing something wrong or not...but I had a building, and lights with the centre at : (0,0,0)

Everything was fine until I moved it a huge distance away : (10000,0,10000) - because I have a huge island...

 

Every time The camera moves the shadows are very jumpy, and even some of the objects seem to have the jitters...

but when the camera stops so do the jitters...it seems to be less jittery the closer I move everything to the worlds centre..

 

Any Ideas? or is the answer stareing me in the face?? =]

Thanks

Link to comment
Share on other sites

What type of light are you using?

 

Using a directional light, it should work fine. For other lights a light range of 10000 is complete overkill and will not work as expected.

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

It's more to do with floating point errors when you have smaller details on objects with polys quite close to each other, and the camera has to move.

 

Just make a map of 2048 with 10m per tile and place some objects near the edge. Move the camera with a mouselook or position cam function and they will 'flutter'. Objects with children will appear to shake and it gets worse the greater the distance from the origin.

 

Using really short near and far camera distances can't fix it either. It's not a z-buffer issue. I made a world with such camera (1 to 5) for an object and it exhibited the same behaviour although the shadows were not so bad.

 

One way I fixed it was (I'm not using this, I tried it though) was to create a "render-horse" world and position the object at 0,0,0, copied that render to the main buffer. No jitter. But you don't get the lighting to match up and it's not very practical.

 

So I'm not sure what the best way to do it might be. Other engines will exhibit this behaviour too.

 

I wrote a space game in Ogre3D, any space game will run into issues of scale, there are different approaches to this. What I did was move everything (the whole scene) inversely to the camera. So the Camera was always at the origin and the space sector moved (As Scotty from StarTrek 2009 would say, "it never occurred to me to think of space as the thing that was moving"). Worked like a charm. But that was a simple game. No idea how you would do that in Leadwerks Engine, or even if it's practical.

 

Increasing the scale of the objects will help, moving surfaces apart from each other, playing around with the shadow offsets for your light source.

 

Just offering my thoughts on recent investigations into this. Still looking for a decent solution and keep the nice lighting system.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

I'm useing both a directional light and several points - they all have the same problem.

 

Thanks for your thoughts Flexman, I was thinking along similar lines.

Floating point errors? So they're a game engine thing? Not a C++ thing? Hasn't anyone tried fixing them?

 

Thanks for the replys..=]

Link to comment
Share on other sites

  • 1 year later...

Has anyone came up with a solution to this? Nothing I do seems to change anything. I have a simulation on a large terrain 2048 @8m and so far when the entities on the map are beyond 1000 meters from origin I get the flickering and it looks really bad. Under 500 meters looks great. Between 500 and 1000 meters I start to see some minor flickering, but it's not bad.

 

I've tried making my own directional light and parenting it to the camera with no luck. I've adjusted range, shadow distance and resolution with no luck. I've changed the camera range with no luck. I feel like I'm running out of options. Any help would be great because this is a serious problem for large terrain simulations. I do not want to "hack" it by moving the world around the camera.

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Make your player 10 times smaller, then you shouldn't get issues with shadows which are far away, because you only need like a 5000x5000x5000 world.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks for the advice, but I can't see how this would help. Can you explain a bit further what you mean? If I have the same terrain size and the object is in the same place in the world, how would scaling the object effect shadows on that object? Wouldn't they be worse?

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Has anyone came up with a solution to this? Nothing I do seems to change anything. I have a simulation on a large terrain 2048 @8m and so far when the entities on the map are beyond 1000 meters from origin I get the flickering and it looks really bad. Under 500 meters looks great. Between 500 and 1000 meters I start to see some minor flickering, but it's not bad.

 

I've tried making my own directional light and parenting it to the camera with no luck. I've adjusted range, shadow distance and resolution with no luck. I've changed the camera range with no luck. I feel like I'm running out of options. Any help would be great because this is a serious problem for large terrain simulations. I do not want to "hack" it by moving the world around the camera.

You are attempting to make worlds bigger than what 32-bit floating points can handle. The only solution is to make it smaller.

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

Thanks for the advice, but I can't see how this would help. Can you explain a bit further what you mean? If I have the same terrain size and the object is in the same place in the world, how would scaling the object effect shadows on that object? Wouldn't they be worse?

I works, because your terrain would be also 10 times smaller, so a 512x512 terrain would be big enough to seem like a 5120x5120 terrain.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks. I am trying it now and will let you know if it works. If so, I should be able to just add a global variable to divide all incoming movement and scale info to make things work properly in the new scale. Josh helped out on this as well and pretty much told me it was impossible to have a map the size of mine and have the lighting work properly due to floating point limitations.

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Too big terrains can lead also to bad gameplay, like we have seen in FarCry 2. The terrain is way too big, and the whole game is just useless driving around and killing respawns. Better have a smaller terrain which you can actually populate better, and not have huge distances with emptyness. Even a 128x128 terrain is quite big with a 10 times smaller scale, because you would have to populate a 1 square km area, and that would lead to lots of polygons too, if you want to keep it dense.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...