custom viewing frustum

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Avalanche
Posts: 18
Joined: Tue Sep 05, 2006 7:21 am

custom viewing frustum

Post by Avalanche »

i mean, i want my terrain far clipping at say 10000.0f
enemy meshes farclip at say 4000.0f
grass farclip at 2000.0f

have any one done this?
i think this will need to recompile irrlicht
xtheagonyscenex
Posts: 131
Joined: Fri Jun 03, 2005 7:26 pm

Post by xtheagonyscenex »

you can set the visibility clipping i beleive also you can use fog values depending on your game if its dark like f.e.a.r. you can have everything fade to black after a certain length it saves performance too
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
Avalanche
Posts: 18
Joined: Tue Sep 05, 2006 7:21 am

Post by Avalanche »

thats not what i mean

i mean i want my terrain clipping to be far away, and grass clipping very near

thx anyway
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

Do a length squared comparison from the camera to the scene node and setVisible(false) to clip it. You could come up with a nicer system that sets the material vertex alpha so that the node fades out, not just snaps out.

You use length squared, because its inexpensive to calculate x^2 + y^2 + z^2 of your vector, but do do a square root to get the true length is bad bad bad. Square roots should always be avoided if possible.
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
Avalanche
Posts: 18
Joined: Tue Sep 05, 2006 7:21 am

Post by Avalanche »

thx sgt_pinky for the tip
it could be computational expensive to call it every frame tho

but for grass and trees, they can be calculated when camera moves, since tree and grass obviously dont move by themselfs

this should optimiz abit

thx again
Post Reply