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

WebGPURenderer: support using 3d textures in shaders with texture3d() and add VolumeNodeMaterial() and examples. #28418

Merged
merged 6 commits into from
May 21, 2024

Conversation

aardgoose
Copy link
Contributor

As title,

WebGPU and WebGL2 backends supported.
Note WGSL doesn't support a matrix inverse function so the inversion of the object's matrixWorld is carried out in JS.

Two examples based on WebGL2 examples: volume - cloud (simplified) and volume - perlin, both using the VolumeNodeMaterial().

(also Chrome release 125 now supports rendering to 3d textures. https://chromestatus.com/feature/5196871364771840 )

@sunag sunag added this to the r165 milestone May 18, 2024
@RenaudRohlinger
Copy link
Collaborator

RenaudRohlinger commented May 19, 2024

Overall, what do you think about letting the users handle the map property themselves into the custom testNode?

For example something like this:
image

The VolumeNodeMaterial does not require a map by default to work, and it is used only within the custom testNode override function. This change would also allow for more complex custom testNode functions, UV mapping, and so on. /cc @sunag

@aardgoose
Copy link
Contributor Author

@sunag I had to add a hack in ReferenceNode after #28407 (before that PRm this hack wasn't needed) not sure what the correct solution is.

Overall, what do you think about letting the users handle the map property themselves into the custom testNode?

For example something like this: image

The VolumeNodeMaterial does not require a map by default to work, and it is used only within the custom testNode override function. This change would also allow for more complex custom testNode functions, UV mapping, and so on. /cc @sunag

It works for me, initially I was just getting the functionality of the existing examples. Things like the base color should probably use materialColor etc to match existing materials.

@mrdoob
Copy link
Owner

mrdoob commented May 20, 2024

I guess this PR should be updated now that #28433 got merged?

@aardgoose
Copy link
Contributor Author

I guess this PR should be updated now that #28433 got merged?

done.

@sunag sunag merged commit b38ef16 into mrdoob:dev May 21, 2024
9 of 10 checks passed
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.

4 participants