KhronosGroup / KhronosGroup/glTF-Sample-Viewer
Support clipping planes
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 264
- Avg merge
- 5h 49m
- Merged PRs (30d)
- 1
Description
Custom clipping planes could be used for more convenient model inspection.
This feature would consist of:
- Six planes forming a rectangular cuboid either axis- or viewer-oriented
- Sliders to control them, each plane should move only along its normal
Rendering implementation would require a relatively simple vertex shader update:
```glsl
gl_ClipDistance[0] = dot(position, planeXPos);
gl_ClipDistance[1] = dot(position, planeXNeg);
gl_ClipDistance[2] = dot(position, planeYPos);
gl_ClipDistance[3] = dot(position, planeYNeg);
gl_ClipDistance[4] = dot(position, planeZPos);
gl_ClipDistance[5] = dot(position, planeZNeg);
```
where `position` is a vertex position in the world (or view) space and each `plane*` is a vector with plane equation coefficients in the same space.
The feature would require support for the [WEBGL_clip_cull_distance](https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/) extension.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the viewer's rendering path and the vertex-shader change described in the issue, along with the WEBGL_clip_cull_distance extension requirements. Define how six axis- or viewer-oriented planes and their sliders should be represented and updated. Done means a rectangular clipping cuboid can be controlled through six normal-constrained sliders and clips rendered models correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100