1
\$\begingroup\$

I have been having an issue with frustum culling, specifically culling planes (not to be confused with the frustum planes). I am using JOML in Java with the FrustumIntersection class, and using the projection matrix * the view matrix for the matrix (for the projection view matrix). The way I am finding the minimum and maximums for the AABB is by simply iterating through the vertices and multiplying that by the transformation matrix in JOML. Although this issue doesn't appear to happen with any meshes other than planes, here is a gif of what is happening:

As you can see, the plane is being culled when the camera moves on a certain axis when looking straight down (it should not be doing that), but only on that axis. Any answer that could hint me in the right direction would be great.

Thanks!

UPDATE: The issue was fixed, it was just a simple problem with the way I was storing the vertices, getting the axises intertwined.

\$\endgroup\$

closed as off-topic by DMGregory Jun 3 '18 at 5:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem must provide a minimal, complete, verifiable example of the issue so that readers can diagnose it without needing to guess, read all of your code, or engage in extensive back-and-forth dialog. For more information, see this meta thread." – DMGregory
If this question can be reworded to fit the rules in the help center, please edit the question.

0
\$\begingroup\$

All frustum intersection test methods in FrustumIntersection expect the input vectors to be defined in the local coordinate frame defined by the supplied matrix. So, if your matrix is a model-view-projection matrix, then you need to give the frustum intersection test methods (such as testAab()) coordinates in model-space. Since you surely know the model-space coordinates of your plane - which is probably something like (-1, 0, -1)..(+1, 0, +1) - then the minimum and maximum of that is exactly the minimum and maximum of the axis-aligned box you need to input into FrustumIntersection.testAab(), for example. Like I said, this assumes that you have your model-space transformations encoded inside the MVP matrix you also give to FrustumIntersection.

\$\endgroup\$
  • \$\begingroup\$ The problem still persists. I have also tried calculating the eight points from the minimum and maximum values, transforming them (with the matrix), then recalculating the min and max to no avail. Does this issue have to do with the way JOML multiplies matrices? I have noticed that JOML treats matrices differently than glsl, but I could be wrong. \$\endgroup\$ – naKK May 6 '17 at 21:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.