setFarValue Limitation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Netan MalDoran
Posts: 5
Joined: Sat Aug 08, 2015 6:18 am

setFarValue Limitation

Post 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!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: setFarValue Limitation

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: setFarValue Limitation

Post 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.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Kojack
Posts: 67
Joined: Sun Jan 20, 2008 2:39 am

Re: setFarValue Limitation

Post 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.
Post Reply