Visualization - Grid shader update - #1264
Merged
Merged
Conversation
…era view, improve handling of infinity scale, and update shader program for axis coloring. Co-authored-by: Copilot <copilot@github.com>
…ith GPU grid, update related methods and parameters for clarity, and enhance documentation for shader-based grid functionality. Co-authored-by: Copilot <copilot@github.com>
- Added a new function `unprojectGridPointToPlaneLocal` to handle unprojection of window-space coordinates to plane-local coordinates, improving grid rendering accuracy. - Updated `OpenGl_View::renderGrid` to utilize the new unprojection function for adaptive grid bounds calculation, enhancing performance and visual fidelity. - Introduced GPU-based grid rendering options in tests, allowing for circular and rectangular grids to be rendered using shaders. - Modified existing tests to validate the new GPU grid rendering capabilities, ensuring compatibility with various grid configurations and camera transformations. - Enhanced test descriptions for clarity, emphasizing the transition from CPU to GPU rendering paths.
There was a problem hiding this comment.
Pull request overview
Renames the shader-based grid path from “infinite”/inf to “GPU”/gpu, adds a new view-adaptive sizing mode, and updates the OpenGl grid renderer so shader bounds and axis rendering track the current camera/view more closely.
Changes:
- Renamed grid terminology and command/API surface from
inf/“infinite” togpu/“GPU”, plusviewAdaptivefor camera-relative sizing. - Updated OpenGl grid rendering to compute adaptive bounds from the visible region and to fix axis coloring for rotated rectangular grids.
- Refreshed Draw tests, help text, and API comments to match the new behavior.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/v3d/grid/view_adaptive |
Adds a new Draw test for camera-adaptive GPU grid behavior. |
tests/v3d/grid/rect_gpu |
Renames rectangular shader-grid test commands/docs to gpu. |
tests/v3d/grid/rect_cpu |
Updates CPU-grid test comments to reference renamed GPU path. |
tests/v3d/grid/persp |
Updates perspective GPU-grid test commands and adaptive option name. |
tests/v3d/grid/ortho |
Updates orthographic GPU-grid test commands and adaptive option name. |
tests/v3d/grid/mode_switch |
Updates backend toggle test text/commands to gpu. |
tests/v3d/grid/gpu_rotate |
Renames rotation regression test wording/command to gpu. |
tests/v3d/grid/gpu_plane |
Renames privileged-plane GPU-grid test command/text. |
tests/v3d/grid/gpu_pan |
Renames pan regression test wording/command to gpu. |
tests/v3d/grid/gpu_options |
Updates GPU-grid option coverage test and comments. |
tests/v3d/grid/circ_gpu |
Renames circular shader-grid test commands/docs to gpu. |
tests/v3d/grid/circ_cpu |
Updates CPU circular-grid test comments to new test names. |
tests/v3d/grid/bounded_rect |
Switches bounded rectangular shader test to explicit GPU backend. |
tests/v3d/grid/bounded_circ |
Switches bounded circular shader test to explicit GPU backend. |
src/Visualization/TKV3d/V3d/V3d_View.hxx |
Updates public grid-display docs to new terminology. |
src/Visualization/TKV3d/V3d/V3d_RectangularGrid.hxx |
Updates deprecated CPU-grid docs around shader-grid behavior. |
src/Visualization/TKV3d/V3d/V3d_CircularGrid.hxx |
Updates deprecated CPU-grid docs around shader-grid behavior. |
src/Visualization/TKService/GTests/Aspect_GridParams_Test.cxx |
Renames tests from infinity flag to view-adaptive flag. |
src/Visualization/TKService/Graphic3d/Graphic3d_ShaderManager.hxx |
Renames shader-manager docs for grid program. |
src/Visualization/TKService/Graphic3d/Graphic3d_ShaderManager.cxx |
Adjusts grid shader axis-coordinate handling. |
src/Visualization/TKService/Graphic3d/Graphic3d_CView.hxx |
Updates abstract view docs for grid display/erase. |
src/Visualization/TKService/Aspect/Aspect_GridParams.hxx |
Renames the public adaptive-grid flag/accessors and docs. |
src/Visualization/TKOpenGl/OpenGl/OpenGl_View.hxx |
Updates OpenGl view docs/member comments for renamed grid mode. |
src/Visualization/TKOpenGl/OpenGl/OpenGl_View.cxx |
Implements view-adaptive scale/bounds computation and refactors grid-plane sampling. |
src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.hxx |
Updates OpenGl shader-manager docs/member comment. |
src/Visualization/TKOpenGl/OpenGl/OpenGl_ShaderManager.cxx |
Renames shader compilation error text. |
src/Draw/TKViewerTest/ViewerTest/ViewerTest_ViewerCommands.cxx |
Renames vgrid CLI options/help and routes GPU-specific options through the new names. |
Comments suppressed due to low confidence (1)
src/Draw/TKViewerTest/ViewerTest/ViewerTest_ViewerCommands.cxx:5082
vgrid -type infused to be the documented way to select the shader grid, but this branch now rejects it outright. That breaks existing Draw scripts and user workflows instead of providing a backwards-compatible alias to the renamedgpumode.
else if (anArgNext == "gpu" || anArgNext == "shader")
{
isGpuGrid = true;
}
else
{
Message::SendFail() << "Syntax error at '" << anArgNext << "'";
| //! (or Scale() when ScaleY() is zero) is used as the target number of cells | ||
| //! across the view height. | ||
| void SetIsViewAdaptive(const bool theIsViewAdaptive) { myIsViewAdaptive = theIsViewAdaptive; } | ||
|
|
Comment on lines
+5205
to
+5213
| else if (anArgIter + 1 < theArgNb && (anArg == "-viewadaptive" || anArg == "-adaptive")) | ||
| { | ||
| hasGpuOnlyOpt = true; | ||
| const int aVal = Draw::Atoi(theArgVec[++anArgIter]); | ||
| aGridParams.SetIsInfinity(aVal != 0); | ||
| aGridParams.SetIsViewAdaptive(aVal != 0); | ||
| } | ||
| else if (anArg == "-gpu" || anArg == "-shader") | ||
| { | ||
| isGpuGrid = true; |
|
|
||
| # Same again with a circular grid to exercise the polar bounds branch. | ||
| vzoom 0.0001 | ||
| vgrid -type gpu -viewAdaptive 1 -step 0.5 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update GPU based grid behaviour.
The infinity parameter renamed to adaptive and now showing the grid size as relative to camera.
Fixed issue with axis for rectangular, when axis was flexible.