Page 1 of 1

setFarValue Limitation

Posted: Fri Sep 04, 2015 7:17 am
by Netan MalDoran
So I am working on a game that deals with scenes that are a realistic replica of solar systems, as you can imagine, the rendering distances are very large but is sparsely populated. To extend the camera range, I am using the setFarValue on the camera, bit it tops out at 9,999,999 units. After googling, it seems that this limitation is because of maxing out the memory value that is assigned to it (4 bit float i think), is there any way around this or a different function that I can use?
There is also the option of rendering other small objects in this local area manner and rendering celestials that are far away some way else? Also, even if the render distance is low and I wouldn't be able to see the system star (That is generating light), would the light being generated still travel through the system and illuminate objects?

Thank you!

Re: setFarValue Limitation

Posted: Fri Sep 04, 2015 9:48 am
by CuteAlien
You either fake it somehow or you need a logarithmic z-buffer. I've not tried yet if it's possible to get those with the current shader support in Irrlicht. Maybe google for glsl and logarithmic z buffer.

Re: setFarValue Limitation

Posted: Fri Sep 04, 2015 11:08 am
by Mel
Keep in mind the precission. It is not that much a matter of distance than precission. Think that a regular ZBuffer has 24 bits, and it has to distribute along the near and far planes, thus, setting the distances may saturate the range of the objects you're rendering losing accuracy. The solution i'd think about is rendering the objects in diferent passes, with diferent near/far planes. IF you're getting too close to a planet, render that planet with another distance setting. Of course, keeping in mind that the objects distances won't affect each other, i.e. a far planet can be discarded when it comes to ZBuffering and the like.

Re: setFarValue Limitation

Posted: Sat Sep 26, 2015 1:57 am
by Kojack
A great resource for near/far plane values is http://www.sjbaker.org/steve/omniv/love ... uffer.html
It has a javascript calculator that lets you enter the near and far values and tells you the precision at different distances.