Help with frustum culling and perspective

Started by phlux, August 20, 2013, 08:44:21 PM

Previous topic - Next topic

phlux

Hi,

I'm quite helpless in figuring out how to choose the correct FOV and also adjusting the nearPlane so my objects are not cut off. As mentioned in previous threads I'm working on some kind of dungeon crawler (eg Grimrock or Dungeon Master, Realms of Arkania). In the old games it is possible to stand directly in front of a wall and see the complete facing wall and some portions of the floor and ceiling. This is exactly the perspective I'm aiming for. Here is an example:



one step closer (standing direct in front of the wall)



Okay you can see here that at least a small area of floor is visible.

My implementation
Each tile (wall, floor, ceiling) is a 2x2 units small Object3D. So if a floor tile is created with the coords (0,0) (2,0) (0,2) (2,2) I position the camera at point (1,1) for example.
When I rotate the camera 90 degrees, walls will be cut off during rotation and you can see what's behind that block. From my limited 3D graphics knowledge I knew that I need to fiddle with the clipping planes in order to reduce this effect. I reduced the nearPlane to a size of 0.78f which suited my needs at first.

Same scene as the first screenshot.



Now going one step forward...



*donk* looks like I'm hugging the wall.

I tweaked the nearPlane and also the world cams FOV, nearPlane size of 0.4f and FOV of 1.2f



step closer



Looks better but editing the two values anymore makes it looks like an alien view, especially when rotating the camera. Anyone got an idea how to accomplish the desired perspective?

Here's also a movie, showing off what I got till now. It was taken with just the adjusted nearPlane: https://www.youtube.com/watch?v=7HDvKI6M5y0

EgonOlsen


phlux

Yes I did, also forgot to mention this uses the hardware renderer.

EgonOlsen

To me, it looks like as if in your positive example, the camera isn't centered. I.e. you are seeing a part of the floor, because the camera is closer to it.

phlux

Haha ;D I never noticed that. Thanks for pointing that out. I will try and lower the cam a bit. When I look at the lines it also looks like the camera is tilted a bit downward.

phlux

Okay, i tweaked the nearPlane value a bit and added 10 degree tilt to bottom. Works veeery well:



Step closer.



Thanks Egon!