| Summary: | Graph: Use Frustum Clipping instead of AABBox + GraphUI Support | ||
|---|---|---|---|
| Product: | [JogAmp] Jogl | Reporter: | Sven Gothel <sgothel> |
| Component: | graph | Assignee: | Sven Gothel <sgothel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | sgothel |
| Priority: | P4 | ||
| Version: | 2.6.0 | ||
| Hardware: | All | ||
| OS: | all | ||
| Type: | FEATURE | SCM Refs: |
1040bed4ecc6f4598ea459f1073a9240583fc3c3
5cca51e32999a882e2a5f00cb45ecafc824ffd86
c1531c3d99b19032040018b9414263b0d3000147
|
| Workaround: | --- | ||
| Bug Depends on: | |||
| Bug Blocks: | 805 | ||
commit 1040bed4ecc6f4598ea459f1073a9240583fc3c3
Add Cube to Frustum Plane mapping, supporting transformation of object-space AABBox into model-view Cube to Frustum.Plane for culling (cpu) and clipping (gpu)
+++
commit 5cca51e32999a882e2a5f00cb45ecafc824ffd86
Frustum: Revise code and its Plane definition to support Cube->Frustum as well as to extract planes for float[] vec4-shader uniforms.
commit 1040bed4ecc6f4598ea459f1073a9240583fc3c3 added AABBox -> Cube -> Frustum mapping (incomplete)
and requires Frustum.Plane.set(..) by normal and point-on-plane for distance.
Frustum.isOutside(Cube) has been added, testing all its 8-points similar to AABBox.
Further all 6 Frustum.Plane shall be extracted to Vec4f and float[],
the latter to pass the whole float[4*6] as a vec4[6] uniform array to the shader.
Constructor, setter and getter have been adjusted accordingly.
Most of the loops have been unrolled.
Method names to query Frustum, i.e. 'is*Outside(<Type>)'
have been reduced to 'isOutside(<Type>)'
where <Type> uniquely indenticates the purpose.
Hence only 'isSphereOutside()' is left over.
+++
commit c1531c3d99b19032040018b9414263b0d3000147
Graph Clipping: Use Frustum Clipping using AABBox -> Mv transformed Cube -> Frustum mapping + GraphUI Support
AABBox clipping naturally couldn't be transformed into 3D Model-View (Mv) Space,
as it is axis aligned and only provided 2 points (min/max).
Therefor we map the Group's AABBox to a 8-point Cube,
perform the Mv-transformation and then produce the 6-plane Frustum.
As before, we cull fully outside shapes within the Group's draw method
and perform fragment clipping with same Frustum planes in the shader.
With clipping enabled, the 3D z-axis getBounds() depth
will be slightly increased for functional Frustum operation.
This is also done for setFixedSize(Vec2f).
The Frustum planes are copied to the Graph shader
via float[4*6] -> uniform vec4 gcu_ClipFrustum[6]; // L, R, B, T, N, F each {n.x, n.y, n.z, d}
Screenshot w/ debug code demonstrating the Frustum clipping w/ rotation. The red-part is clipped by the shader, while the other thousand Glyphs of that glyph-grid are culled by the Group. https://jogamp.org/bugzilla//show_bug.cgi?id=805#c17 (In reply to Sven Gothel from comment #2) (wrong link) https://jausoft.com/blog/wp-content/uploads/2024/01/FontView01-norm-q1-s01-fsaa4-FreeSerif_Regular_cp106-snap04-1280x0720-1.png |
AABBox clipping naturally couldn't be transformed into 3D Model-View (Mv) Space, as it is axis aligned and only provided 2 points (min/max). Therefor we map the Group's AABBox to a 8-point Cube, perform the Mv-transformation and then produce the 6-plane Frustum. As before, we cull fully outside shapes within the Group's draw method and perform fragment clipping with same Frustum planes in the shader.