Near objects disappearing - near camera frustum culling & FOV

How can I bring the camera’s near frustum closer without distorting the view? Objects are culled too far from the camera but moving the near plane seems to change the FOV dramatically.

2 Likes

By changing the cameras frustum settings.

Why isn’t this the default view?



cam.setFrustumPerspective(45, settings.getWidth() / settings.getHeight(), 1, 1000);



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:camera

http://hub.jmonkeyengine.org/groups/general-2/forum/topic/basic-camera-questions-sorry-in-advance/



Edit: The aspect ratio is an int divided by an int… adding a (float) makes everything fine.

1 Like

I just think the aspect could be omitted (on a new easifier method), when we already have:

setFrustumPerspective(float fovY, float aspect, float near, float far);

we could also have:

setFrustumPerspective(float fovY, float near, float far);

good you pointed out W/H for aspect!

btw, I could set near to 0.001f, and the character camera placed based on that value also, and things still looking good, we can “smell” the textures details now :smile: , thx!

Note: the farther apart near and far are the more z-buffer fighting you will have, especially for mid to far objects.

2 Likes

I am using near 0.001f, far 2000f,
and I intend to implement fog (lowering far one),
from what you said I guess if I see graphics glitches I must lower the far one?

EDIT: I found a minimum near that shadows wont glitch, it is 0.1f; I could up the far til 3000 (didnt tried more) and shadows where still ok as long I keep near at least 0.1f; thx! I will just increase the character colider so it stays a bit far from walls

I’m glad I have the opportunity to link that site again :
http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html

It contains all you need to know

2 Likes