Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 100
Volume quality slider#283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
cafedcaa78c935ba568d33cd574f1b65ca6adeaac0bb8100dc1770bdf112453723ec4ceacf745a7a4bec35a05028b0900fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -326,34 +326,40 @@ export default defineComponent({ | ||
| light.setPositional(false); | ||
| } | ||
| const dims = image.getDimensions(); | ||
| const spacing = image.getSpacing(); | ||
| const spatialDiagonal = vec3.length( | ||
| vec3.fromValues( | ||
| dims[0] * spacing[0], | ||
| dims[1] * spacing[1], | ||
| dims[2] * spacing[2] | ||
| ) | ||
| property.setScalarOpacityUnitDistance( | ||
| 0, | ||
| (0.5 * getDiagonalLength(image.getBounds())) / | ||
| Math.max(...image.getDimensions()) | ||
| ); | ||
| if (animating) { | ||
| mapper.setSampleDistance(0.75); | ||
| mapper.setMaximumSamplesPerRay(1000); | ||
| mapper.setGlobalIlluminationReach(0); | ||
| } else { | ||
| const dims = image.getDimensions(); | ||
| const spacing = image.getSpacing(); | ||
| const spatialDiagonal = vec3.length( | ||
| vec3.fromValues( | ||
| dims[0] * spacing[0], | ||
| dims[1] * spacing[1], | ||
| dims[2] * spacing[2] | ||
| ) | ||
| ); | ||
| // Ensure that the maximum samples per ray are not exceeded. | ||
| let sampleDistance = mapper.getSampleDistance(); | ||
| if ( | ||
| spatialDiagonal / sampleDistance > | ||
| mapper.getMaximumSamplesPerRay() | ||
| ) { | ||
| sampleDistance = | ||
| spatialDiagonal / (mapper.getMaximumSamplesPerRay() - 1); | ||
| // Use the average spacing for sampling by default | ||
| let sampleDistance = spacing.reduce((a, b) => a + b) / 3.0; | ||
PaulHax marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // Adjust the volume sampling by the quality slider value | ||
| sampleDistance /= 0.5 * (params.volumeQuality * params.volumeQuality); | ||
| const samplesPerRay = spatialDiagonal / sampleDistance + 1; | ||
| mapper.setMaximumSamplesPerRay(samplesPerRay); | ||
| mapper.setSampleDistance(sampleDistance); | ||
| // Adjust the global illumination reach by volume quality slider | ||
| mapper.setGlobalIlluminationReach( | ||
| enabled ? 0.25 * params.volumeQuality : 0 | ||
| ); | ||
sankhesh marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| mapper.setSampleDistance(animating ? 0.75 : sampleDistance); | ||
| mapper.setGlobalIlluminationReach(enabled ? 0.5 : 0); | ||
| property.setShade(true); | ||
| property.setScalarOpacityUnitDistance( | ||
| 0, | ||
| getDiagonalLength(image.getBounds()) / | ||
| Math.max(...image.getDimensions()) | ||
| ); | ||
| property.setUseGradientOpacity(0, !enabled); | ||
| property.setGradientOpacityMinimumValue(0, 0.0); | ||
| const dataRange = image.getPointData().getScalars().getRange(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a stronger and more succinct typing for
selectLightingMode: