Axis lines, cameras, and clipping

Disclaimer: I am pretty new to Java, jMonkeyEngine, and game concepts in general. Some things I say may be extremely naive or ignorant.



I’m not even sure if this is an appropriate group to post this in, but here goes: I’m currently getting my toes wet with jMonkeyEngine by attempting to build a simple model viewer that loads a model, draws the (labelled) x/y/z axes, and allows the user to rotate/orbit around the loaded model. I’ve already mostly accomplished this, but am running into things that are mucking with my “vision” of how the app ought to behave. :slight_smile:



Namely, the axis lines are not quite what I imagined. I had hoped to always have them on the screen, drawn out to the absolute edges of the window in all cases. However, the camera seems to have two limitations: a maximum viewing distance, after which it clips the rest of the line regardless of the line’s CullHint or length, and another tendency to clip the line after it intersects the camera plane. I suppose the latter ought to have been predictable if I had a greater understanding of OpenGL camera mechanics, but alas I do not. I was wondering if there were camera settings I could tweak to get the effect I am after? I hope I’m doing an adequate job of explaining my intentions.



If there is no way to get this effect by tweaking the camera, I had thought about using orthographic projection to just draw the axis lines directly on the guiNode, but I’m not even sure where to start on this. How do I figure out where to draw the lines on the “lens” looking into the 3d space?



My current source is available here: https://bitbucket.org/rherriman/jmodelview/src/1a0f0f7d00f7/src/jmodelview/ModelView.java



Any assistance you can offer is appreciated!


  • ryan

What you are seraching for is the “frustum” of the camera, you can change its settings via methods in Camera.

Oops, I meant to talk about that. I did try tweaking some values for the frustum, but it also affected the camera in ways I did not expect. For example, I seemed to discover that the “near” value had to be greater than 0, but setting it to 0.1 also had the effect of “warping” the model, much like looking through a fish-eye lens or something similar. Is there some sort of rule or mathematical principle for adjusting frustum values without causing distortions of this kind? I imagine it has to do with perspective, but I’d like to keep the perspective the same as default.


  • ryan