Bug 1487 - Graph: Use Frustum Clipping instead of AABBox + GraphUI Support
Summary: Graph: Use Frustum Clipping instead of AABBox + GraphUI Support
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: graph (show other bugs)
Version: 2.6.0
Hardware: All all
: P4 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks: 805
  Show dependency treegraph
 
Reported: 2024-01-20 05:19 CET by Sven Gothel
Modified: 2024-01-20 05:44 CET (History)
1 user (show)

See Also:
Type: FEATURE
SCM Refs:
1040bed4ecc6f4598ea459f1073a9240583fc3c3 5cca51e32999a882e2a5f00cb45ecafc824ffd86 c1531c3d99b19032040018b9414263b0d3000147
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2024-01-20 05:19:17 CET
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.
Comment 1 Sven Gothel 2024-01-20 05:22:18 CET
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}
Comment 2 Sven Gothel 2024-01-20 05:43:26 CET
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