setFarValue limitations?

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
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

setFarValue limitations?

Post by Abraxas) »

I posted previously some problems with using getRayFromScreenCoordinates, and I've found the cause of it.

I would use

Code: Select all

camera->setFarValue(50000000.0f);
Apparently when the far value is too high, the GRFSC function produces many errors.

I'm assuming this is because of 32bit precision, am I right?

If so, what should my limits on farvalue be so then GRFSC works properly?

Thanks!
Serg88
Posts: 30
Joined: Mon Oct 19, 2009 5:52 pm
Location: Moscow/Russia

Post by Serg88 »

float use 4 bytes

this value included in range for "long int"(signed or not) is exactly
for float must also if believe to written:
http://cplus.about.com/od/introductiont ... atdefn.htm

if you use getRayFromScreenCoordinates you also must use sentiment triangle selector.
I had same problem when i projected mouse coordinates to 3D position/

shorter: check selector

PS
also i advise you make you world smaller
use node->setscale and all fit.
50 million units is very for world
with estimated that 1 units == 1 meter in real life
Last edited by Serg88 on Thu Nov 12, 2009 3:03 am, edited 1 time in total.
from Russia with love :))))
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Post by Abraxas) »

My selector is fine.

What I did was setfarvalue to something short like 1E3, do the raycast, then set it back to 1E7 (which is what I need.. :/)

I guess another solution would be to scale everything down a hundred times.

BTW the raycast is more for plane3d::getintersectionwithline then it is for nodecollision actually, since I'm making a strategy game here.
Serg88
Posts: 30
Joined: Mon Oct 19, 2009 5:52 pm
Location: Moscow/Russia

Post by Serg88 »

im talking about getRayFromScreenCoordinates and getCollisionPoint

especially if you make strategy don`t set so big FarValue, it`s clip far from camera polygons
from Russia with love :))))
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Actually, most depth buffers are 16bit or 24bit. Using such a huge value will make the projection matrix rather wrong, and all results that involve object-to-world transformation pretty unreliable. Usual values are between 1000 and 50000.
Post Reply