World.setClippingPlanes has no effect for me

Started by Roland, March 21, 2012, 10:20:49 AM

Previous topic - Next topic

Roland

when i'm not to close to an object, i still start to see through it because it is cutting the closest parts, so i tested change the world to this: theWorld.setClippingPlanes(0.01f, 1000f);
But still I see no difference. is there any other way I should do, for it to render even when the object is quite close to the camera?

EgonOlsen

To make the near plane have an effect, you have to set Config.glIgnoreNearPlane=false; This is to keep compatibility with the software renderer, which behaves different for the near plane. However, i've never seen a case where 1 isn't sufficient. Maybe you should avoid coming that close in the first place...

Roland

didn't help att all, tested first

theWorld.setClippingPlanes(0.1f, 1000f);
      Config.glIgnoreNearPlane = false;

and then

theWorld.setClippingPlanes(0.01f, 1000f);
      Config.glIgnoreNearPlane = false;

made no different, tested putting Config.glIgnoreNearPlane = false; a little bit here and there, but no different.

I need to come closer then a meter, ever seen a fps where the closest the person is, is 1 meter away from the wall?
In the template for the fps jpct provided, the person was like 30 meters high, that is why you didn't see. but my game need to be more close to reality since i'm using larger worlds, and want to use the precision of meters

EgonOlsen

jPCT doesn't allow for a near clipping plane lower than 1. And you don't want that anyway, because the resulting frustum will cause a look like this: (0.1, 1000):



Using one unit in world space as one meter in the real world isn't very much anyway. You'll most likely run into accuracy problems with collision detection when doing this. The person in the fps example isn't 30 meters high...it might by 30 units high. But as long as you scale everything by the same amount, the visual outcome of using 1 unit/meter or 10 units/meter or 1000 units/meter will be exactly the same (except for the mentioned problems with accurcy for very small or very large scales).
I suggest to scale everything by 10, so that in your scene, 10 units are the equivalent of 1 meter. That's the scale that i'm using most the time, too. It's a good compromise and the near plane at 1 means a clipping 10cm before the viewer. That should be fine.

Roland

If there isn't any other way I must do like that, but the problem with is that then I haveto add another thing to the game, which is moving the world as I walk.
If I have 1 unit as 1 meter, then I can have a world that is 32 kilometers with 1 millimeter precision, however, if I use a much higher value for everything, the scaled precision will not be as accurate, and then I have to make a solution for that, which I wished to avoid if possible.
Hoever, I think it must be a way to not have to change the size of everything, but to change the clipping instead.

EgonOlsen

Quote from: Roland on March 22, 2012, 10:21:42 AM
If there isn't any other way I must do like that, but the problem with is that then I haveto add another thing to the game, which is moving the world as I walk.
If I have 1 unit as 1 meter, then I can have a world that is 32 kilometers with 1 millimeter precision, however, if I use a much higher value for everything, the scaled precision will not be as accurate, and then I have to make a solution for that, which I wished to avoid if possible.
Hoever, I think it must be a way to not have to change the size of everything, but to change the clipping instead.
The near value is set directly into the glFrustum-function. It defines the clipping plane, but it also defines the view frustum which leads to the results that you are seeing in the screen shot. You can of course specify additional clipping planes, but they can't be located behind the near plane itself.