Skip to content

Visualization - Grid shader update - #1264

Merged
dpasukhi merged 4 commits into
Open-Cascade-SAS:IRfrom
dpasukhi:vis_grid_improvements
May 5, 2026
Merged

dpasukhi merged 4 commits into
Open-Cascade-SAS:IRfrom
dpasukhi:vis_grid_improvements

Conversation

@dpasukhi

@dpasukhi dpasukhi commented May 4, 2026

Copy link
Copy Markdown
Member

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.

dpasukhi and others added 3 commits May 4, 2026 20:54
…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.
@dpasukhi
dpasukhi requested a review from Copilot May 4, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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” to gpu/“GPU”, plus viewAdaptive for 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 inf used 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 renamed gpu mode.
      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
@dpasukhi
dpasukhi merged commit 058ec16 into Open-Cascade-SAS:IR May 5, 2026
22 checks passed
@dpasukhi
dpasukhi deleted the vis_grid_improvements branch May 5, 2026 08:43
@github-project-automation github-project-automation Bot moved this from Todo to Done in Maintenance May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants