Skip to content

Improve ray marching in volume rendering examples#32235

Merged
mrdoob merged 2 commits into
devfrom
examples
Nov 10, 2025
Merged

Improve ray marching in volume rendering examples#32235
mrdoob merged 2 commits into
devfrom
examples

Conversation

@mrdoob

@mrdoob mrdoob commented Nov 10, 2025

Copy link
Copy Markdown
Owner

Description

This PR improves the ray marching algorithm in webgl_volume_perlin, webgl_volume_instancing, and webgl_volume_cloud.

The previous implementation used a DDA-like approach, which could be unstable and produce artifacts.
This PR replaces it with a more stable and correct ray marching loop that steps along the camera direction.

@mrdoob mrdoob added this to the r182 milestone Nov 10, 2025
@mrdoob mrdoob merged commit 6a149de into dev Nov 10, 2025
9 checks passed
@mrdoob mrdoob deleted the examples branch November 10, 2025 13:46
@gkjohnson

gkjohnson commented Nov 10, 2025

Copy link
Copy Markdown
Collaborator

Do you have images of the specific artifacts you're trying to address? Using a fixed length step feels like a less optimal approach, at least for non-interpolated voxelized data like in the volume instancing demo. It also looks like the previous approach wasn't really using DDA unless I'm misunderstanding?

@mrdoob

mrdoob commented Nov 10, 2025

Copy link
Copy Markdown
Owner Author

In the perlin example you can see less artifacts:

https://threejs.org/examples/webgl_volume_perlin.html
https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_volume_perlin.html

In the instancing one you can see less gaps in the volume:

https://threejs.org/examples/webgl_volume_instancing.html
https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_volume_instancing.html

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