-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Volume rendering compositing changes and wireframe rendering to vis c…
…hunks in volume rendering mode (#503) * feat: VR front-to-back compositing and chunk vis * chore: add comment about opacity correction source * refactor: clearer naming for compositing * chore: fix formatting * feat: add gain parameter to VR and python binds The gain float can be used to scale the VR intensity. Also bind that gain to Python controls and bind VR bool to Python. * refactor: pull OIT emit function out as standalone * feat: perform OIT along rays during VR * test: ensure that color and revealage are independent of sampling rate Refactored volume rendering shader to accomodate * feat: add depth culling to VR rays during marching * chore: format file * fix: break composite loop if VR ray goes behind opaque * fix: remove console.log during testing * feat: volume rendering chunk vis in wireframe mode * refactor: rename gain to volumeRenderingGain Also update relevant Python bindings * feat: change gain scale from linear to exponential * refactor: rename to depthBufferTexture (remove ID) * format: run python formatting * fix: default volume rendering slider gain of 0 (e^0 passed to shader)
- Loading branch information
1 parent
9524a72
commit a9939d6
Showing
7 changed files
with
221 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { fragmentShaderTest } from "#/webgl/shader_testing"; | ||
import { glsl_computeOITWeight } from "#/perspective_view/panel"; | ||
import { glsl_emitRGBAVolumeRendering } from "#/volume_rendering/volume_render_layer"; | ||
import { vec3 } from "gl-matrix"; | ||
|
||
describe("volume rendering compositing", () => { | ||
const steps = [16, 22, 32, 37, 64, 100, 128, 256, 512, 551, 1024, 2048]; | ||
const revealages = new Float32Array(steps.length); | ||
it("combines uniform colors the same regardless of sampling rate", () => { | ||
fragmentShaderTest( | ||
{ | ||
inputSteps: "float", | ||
}, | ||
{ | ||
outputValue1: "float", | ||
outputValue2: "float", | ||
outputValue3: "float", | ||
outputValue4: "float", | ||
revealage: "float", | ||
}, | ||
(tester) => { | ||
const { builder } = tester; | ||
builder.addFragmentCode(glsl_computeOITWeight); | ||
builder.addFragmentCode(` | ||
vec4 color = vec4(0.1, 0.3, 0.5, 0.1); | ||
float idealSamplingRate = 512.0; | ||
float uGain = 0.01; | ||
float uBrightnessFactor; | ||
vec4 outputColor; | ||
float depthAtRayPosition; | ||
`); | ||
builder.addFragmentCode(glsl_emitRGBAVolumeRendering); | ||
builder.setFragmentMain(` | ||
outputColor = vec4(0.0); | ||
revealage = 1.0; | ||
uBrightnessFactor = idealSamplingRate / inputSteps; | ||
for (int i = 0; i < int(inputSteps); ++i) { | ||
depthAtRayPosition = mix(0.0, 1.0, float(i) / (inputSteps - 1.0)); | ||
emitRGBA(color); | ||
} | ||
outputValue1 = outputColor.r; | ||
outputValue2 = outputColor.g; | ||
outputValue3 = outputColor.b; | ||
outputValue4 = outputColor.a; | ||
`); | ||
for (let i = 0; i < steps.length; ++i) { | ||
const inputSteps = steps[i]; | ||
tester.execute({ inputSteps }); | ||
const values = tester.values; | ||
const { | ||
revealage, | ||
outputValue1, | ||
outputValue2, | ||
outputValue3, | ||
outputValue4, | ||
} = values; | ||
const color = vec3.fromValues( | ||
outputValue1 / outputValue4, | ||
outputValue2 / outputValue4, | ||
outputValue3 / outputValue4, | ||
); | ||
expect(color[0]).toBeCloseTo(0.1, 5); | ||
expect(color[1]).toBeCloseTo(0.3, 5); | ||
expect(color[2]).toBeCloseTo(0.5, 5); | ||
revealages[i] = revealage; | ||
} | ||
for (let i = 1; i < revealages.length; ++i) { | ||
expect(revealages[i]).toBeCloseTo(revealages[i - 1], 2); | ||
} | ||
}, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.