# Camera Settings for a Fixed Clipping Plane

Salutations all!
I’m fairly inexperienced both with game dev and jMonkey. I’ve been digging into the engine tutorials/documentation, writing some test code and having a blast. First off thanks to all the developers and contributors. I hope to someday reach a point where I can start giving back.

Is it possible to configure the camera’s bottom clipping plane at a specific y value? For example, y=0? I tried playing with cam.setFrustrumBottom() but that just seemed to distort perspective.

Of course, if the camera is moved in the positive y, there will come a point where the bottom clipping plane will have to follow it up as well, but is it possible to clamp the bottom plane to a specific min value even if the camera is only a unit or two above it?

Any help is much appreciated. Thanks!

Yes there is a way.
We added it for water to be able to have an arbitrary clipping plane.
There is a camera.setClipPlane(Plane plane).
Everything is documented in the javadoc of the method.

Thanks for the input Nehon. I gave it a shot, but I’m obviously doing something wrong as I’m still seeing the objects I’m trying to clip. Tomorrow I’ll try looking at the water code for some examples, as at the moment, my brain = mega-mush.

Throwing the towel in on this one. I was able to get clipping working partially, but not quite the way I intended.
[java]Plane plane = new Plane(Vector3f.UNIT_Y, Vector3f.ZERO.dot(Vector3f.UNIT_Y));
cam.setClipPlane(plane,Plane.Side.Negative);[/java]
Using the code above (lifted right out of the water samples) I could see 2x2x2 cubes with their origins at (x,0,z) with their tops clipped off, but I could not for the life of me figure out how to clip the bottoms instead of the tops. I tried Plane.Side.Positive, tried moving the plane’s constant, and even tried .negate() on the plane’s vector. It seemed like when I used Plane.Side.Positive clipping wasn’t happening at all. I observed strangeness when moving the flycam angle where the entire scene seemed to clip out of existence and I couldn’t get it back. At any rate, I obviously have no clue what I’m doing here. I think I’ll move on to other topics as there is still a heaping mound of jmonkey know-how I’ve got to shove into the cranial filing system. Thanks again for the help anyway Nehon!

For the record: Vector3f.ZERO.dot(Vector3f.UNIT_Y)
…is always 0.

You said you tried it but definitely for positive to work the normal would have to be inverted (negated).

@pspeed said: For the record: Vector3f.ZERO.dot(Vector3f.UNIT_Y) ...is always 0.

You said you tried it but definitely for positive to work the normal would have to be inverted (negated).

Or, if Fancy Nancy were to explain it…
“Vector3f.ZERO.dot(Vector3f.UNIT_Y) is fancy, for zero.”

(My kids are avid Fancy Nancy Fans) .

Ok cool, at least I was on the right track. I’m sure I borked something else then. Thanks for the input!

We do both in the water processor. clipping the bottom and clipping the top. We clip the bottom for the reflection texture.
This technique changes the view matrix so that the near clip plane of the cam matches an arbitrary clip plane. It’s not classic opengl clipping. I guess it can give the strangeness you observed.