View Frustum Difficulties

I’m trying to get a simple flyby cam set up which will hover over a mostly flat plane (picture hovering over a terrain landscape) and I’m having a heck of a time getting it to display the way I want. For some reason no matter how I adjust the camera’s frustum settings I always get a huge curvature/magnification effect (screen below). I’m extending SimpleApplication with the following cam settings:

float aspect = cam.getWidth() / cam.getHeight();

cam.setFrustumPerspective(45, aspect, 100.0f, cam.getFrustumFar());

Another thing I’m having difficulty with is, when I aim the camera any higher than shown below, everything is culled and nothing shows up. So far I’ve been unable to determine camera settings which prevent that from happening as well.

As you can see above I’m not using what I’d think is a “close” near plane value (100), I’ve also tried other values (1, .01, 200) which seem to have no effect. What’s going on?

The image below is the type of effect I’m looking for, using a different 3d engine. The dark blue in the background isn’t 3d geometry, just a canvas background color (“edge of the map”), and you can see there’s no curvature at all. IIRC in the other engine the default camera settings were sufficient so I’m not really sure what the difference here is.

I’ve never noticed any curvature with the default camera settings. Is that why you switched them or for some other reason? How big in units is the mesh in question?

Any idea what the field of view was in the other default camera setting you were using before in the other framework?

Regarding culling… that’s a setting on the object but it sounds like its bounding volume was never updated. You can also give it a cull hint of never… but really it’s better to try and figure out why it’s getting culled while still in view. And usually that’s because the bounding volume isn’t in the frustum.

Well, the default settings do the same thing. I’m thinking it has to do with the scale/size, possibly, but I’m still not sure what the relative numbers should look like if that’s the case.

I was able to resolve the culling issue as far as I can tell by just doing this:

mapGeometry.setModelBound(new BoundingBox());

This is how it looks with the default camera:


Camera Position: (-0.38168892, 73.297195, 709.6983)

Camera Rotation: (-7.6219454E-5, 0.98774153, 0.15609732, 4.8229625E-4)

Camera Direction: (9.289728E-4, 0.30836767, -0.95126665)

Some random vertex coords to get an idea for the size of this ‘model’:

322.934235 -299.179138 0.024158

343.248291 -310.984863 0.949096

142.688766 -333.865448 0.000000

-237.818710 -322.303162 -0.000002

-297.893616 -333.864929 -0.000002

-177.735748 10.117273 -0.000002

-177.735748 7.226697 -0.000002

This seems like it’s pretty large at least in absolute terms to me, considering camera position. Still just confused about why the frustum settings I’ve been trying haven’t seemed to make a difference and I still get this ‘fish eye’ view.

It does seem like increasing the scale (tried mapGeometry.setLocalScale(10, 10, 10); so far) reduces this curvature appearance, but I still feel like I’m doing something wrong since this is basically a flat plane, not a curved surface. Never really looked into what the settings were in the other engine, I might need to look for that.

That’s a lot of curve. Personally, I’d suspect the mesh itself is curved. You are just using a standard material, right? I’m curious which one.

I’ve created terrain tiles of a few kilometers in size without such curvature… regardless of camera settings. So something odd is definitely happening.

1 Like

Oh, for crying out loud. I think the daft thing IS curved!

I loaded another simpler mesh that I know is flat and–no curve at all.

Going back to the older implementation, with some camera overrides so I can back up outside the central area I care about, and…

Geez - thanks for pointing out what should have been the obvious. Still need to work out my scaling and camera stuff (I guess so this curve isn’t so obvious) to keep the user within that central part of the map, but at least now I think I know what’s going on.