Skip to content
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

feat(multiple scatter): support experimental multiple scatter option #2490

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JiayiXuu
Copy link
Collaborator

@JiayiXuu JiayiXuu commented Jun 24, 2022

Context

This PR adds multiple scatter option as an alternative to simple ray casting. If this option is turned on, gradient-based and volumetric shading are turned off by default due to computational limit. Multiple scatter accentuate the translucency of the volume and captures a little bit of shadow. Three parameters are added:

  • multipleScatter: toggles scatter on and off
  • multipleScatterSamplingDistFactor: increase or decrease sample distance for higher order scatter ray
  • sphericalSampleNumber: number of sampled in-scatters on uniform sphere

Parameters that are not exposed:

  • Amount of scatter sampled based on light direction versus phase function. Hard coded value is a half-half split. Gradient direction is not used sample scattered light to avoid gradient computation.
  • Number of samples for evaluating transmittance at each sample location. Hard coded value for maximum sample number is 50.

Results

Because scattering contribution is added on top of regular rendering it increases the overall brightness level. The scattering effect is not obvious for solid, opaque volume.

This function is very much work in progress.

image

Changes

  • vtkVolumeFS.glsl: added path integration algorithm for multiple scatter
  • opengl/VolumeMapper: added parameters and uniforms
  • core/VolumMapper: expose get/set of new parameters

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js: latest master
    • OS: Windows 10
    • Browser: Chrome 89.0.4389.128

@finetjul
Copy link
Member

It would be great to add a live example as well as a unit test to make sure it does not "break" with new commits.

@JiayiXuu
Copy link
Collaborator Author

It would be great to add a live example as well as a unit test to make sure it does not "break" with new commits.

Yep, I'll push a new example/test when this feature is better curated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants