I am not familiar with Java, but usually you can customize the view matrix using some kind of "lookAt" function. A quick look at the documents came up with this one .
BTW, setNominalViewingTransform only translates along the z axis, so the screenshot shown is what I expect to see. You are right to try to customize the view transformation yourself.
Edit
As for the up direction for the lookAt function, this is just a way to control the camera roll. In other words, by specifying the viewpoint and the center point (the point the camera is looking at), you only determine the direction. The camera can still rotate on this axis 360 degrees. If you want to look at things correctly, then just point the vector in the up direction in your system - if it is y, then it will be (0,1,0). If you want to look at things upside down, it will be (0, -1.0).
Note that you do not have to check that the up vector is perpendicular to the direction defined by the eye and center. As long as it is not parallel to this direction, then the method should automatically use the component of your attached up vector, which is perpendicular to the direction.
Edit2:
Based on your changes, it looks like you put the position in place of “up” and not in the direction. It should be just a vector (0,1,0). Having said that, he still won’t fix your problem, because the wrong “up” vector means that the camera can turn around on its own axis so that it flips to its side, etc., but it won’t affect direction.
Therefore, there must be something wrong with the eye and center positions, or the matrix is still not inverted. Your edit for invert() does not look right, since you did not call it on lookAt Transform3D , but I assume this is just a typo. when did you update the question?
I would try a simpler viewing angle to get you started. Just try looking along the z axis with something like
Transform3D lookAt = new Transform3D(); lookAt.lookAt( new Point3d( 0.0, 0.0, 1.0 ) , new Point3d( 0.0, 0.0, 0.0 ) , new Vector3d( 0.0, 1.0, 0.0) ); lookAt.invert();
What is going on with this?
If you still get black, try moving the viewpoint along the z axis, maybe try 2.0, 3.0, and then a few negative values.
Another possibility is that your camera is looking in the right direction, but objects are selected due to clipping of a truncated cone. You might want to check the documentation to see why click planes are set by default. This may appear in the example above when you change the position of the eyes along the z axis. If you can see your objects for some z values, but not for others, this is probably a clipping problem.
Let me know how you are doing.