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

examples: volume cloud: add jittering to reduce sampling artefacts #20222

Merged
merged 1 commit into from
Sep 29, 2020

Conversation

DavidPeicho
Copy link
Contributor

@DavidPeicho DavidPeicho commented Aug 29, 2020

This PR modify the example examples/webgl2_volume_cloud.html:

  • Adds the glsl version to the material to be able to send defines to the shader
  • Adds a jittering option that reduces artefacts from the volume

http://raw.githack.com/DavidPeicho/three.js/feature/volume-rendering-jittering/examples/webgl2_volume_cloud.html

@WestLangley
Copy link
Collaborator

@DavidPeicho Can you recommend GUI settings for which the sampling artifacts are particularly apparent -- and presumably, for which the jittering is particularly helpful?

@mrdoob
Copy link
Owner

mrdoob commented Aug 30, 2020

@WestLangley It's for reducing banding. He shared this on twitter:

https://twitter.com/DavidPeicho/status/1299831339504594945

image

@mrdoob mrdoob added this to the r121 milestone Aug 30, 2020
@DavidPeicho
Copy link
Contributor Author

Yes, forgot to mention that. You can set the opacity to 1 for instance. This will give a fair amount of artefacts.

Alternatively, you can also decrease the threshold to a lower value.

@DavidPeicho
Copy link
Contributor Author

Side note: jittering introduces randomness, and so is cache absolutely-not friendly. Using jittering is thus slightly slower.

However, to obtain the equivalent quality to the jittering, you will need to increase the number of steps, degrading performance even more

},
vertexShader,
fragmentShader,
side: THREE.BackSide,
transparent: true
} );
material.glslVersion = '300 es';
Copy link
Collaborator

@Mugen87 Mugen87 Sep 9, 2020

Choose a reason for hiding this comment

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

Please use THREE.GLSL3 in this line.

@mrdoob Using this constant instead of adding the version qualifier in the shader code should also be done in webgl2_volume_perlin.

Copy link
Owner

Choose a reason for hiding this comment

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

I'll clean it up 👌

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I was in holidays. Thanks for the cleanup!

@mrdoob mrdoob merged commit 2cef8dc into mrdoob:dev Sep 29, 2020
@mrdoob
Copy link
Owner

mrdoob commented Sep 29, 2020

Thanks!

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.

None yet

4 participants