Skip to content

Examples: Add webgpu_caustics and shadow revisions #30962

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

Merged
merged 17 commits into from
Apr 22, 2025
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Apr 19, 2025

Description

I created a approach for caustic effects using the same shadow-map pass, without affecting the functionality of the current shadow map. Which seems to have a good performance.

Live example

Live example + volumetric lighting

image

three.js.webgpu.-.volumetric.caustics.-.Google.Chrome.2025-04-19.15-30-21.mp4

Summary

@sunag sunag changed the title Dev caustic Examples: Add webgpu_caustics Apr 19, 2025
@sunag sunag changed the title Examples: Add webgpu_caustics Examples: Add webgpu_caustics and shadow revisions Apr 19, 2025
@sunag sunag added this to the r176 milestone Apr 19, 2025
Copy link

github-actions bot commented Apr 19, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.33
78.33
336.33
78.33
+0 B
+0 B
WebGPU 546.51
151.52
547.03
151.61
+520 B
+93 B
WebGPU Nodes 545.86
151.36
546.38
151.46
+520 B
+94 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.78
112.28
465.78
112.28
+0 B
+0 B
WebGPU 620.88
167.96
621.42
168.06
+535 B
+109 B
WebGPU Nodes 575.75
157.27
576.29
157.38
+535 B
+108 B

@sunag sunag marked this pull request as ready for review April 19, 2025 16:44
@sunag sunag mentioned this pull request Apr 19, 2025
12 tasks
@sunag
Copy link
Collaborator Author

sunag commented Apr 19, 2025

Good to know it worked with volumetric lighting.

image

@Brackets-Coder
Copy link

This might be the coolest thing I've seen a while. Blender's Cycles struggles to render caustics in a performant render and WebGPU can do it in realtime.

I'm probably just going to move to Three.js for renders at this point

@sunag sunag merged commit 51f4b78 into mrdoob:dev Apr 22, 2025
12 checks passed
@sunag sunag deleted the dev-caustic branch April 22, 2025 03:34
@mrdoob
Copy link
Owner

mrdoob commented Apr 23, 2025

Is it expected for the dragon shadow to look like this now?

Screenshot 2025-04-23 at 18 39 19

@sunag
Copy link
Collaborator Author

sunag commented Apr 23, 2025

Is it expected for the dragon shadow to look like this now?

It was expected because at some point the color blending was removed, but it doesn't look so nice in this example because of the model, so I created an example with both approaches. #30984

RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* `material.shadowPositionNode` renamed to `material.receivedShadowPositionNode`

* add `shadow.mapType`

* add `material.castShadowPositionNode`

* add `webgpu_caustics` example

* update title

* add stats

* use webgpu

* add `webgpu_volumetric_caustics` example

* updates

* Update puppeteer.js

* Update puppeteer.js

* Update webgpu_volume_caustics.html

* fix shadow-map alpha

* add glass example

* Update webgpu_shadowmap_opacity.jpg

* Update webgpu_volume_caustics.html
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* `material.shadowPositionNode` renamed to `material.receivedShadowPositionNode`

* add `shadow.mapType`

* add `material.castShadowPositionNode`

* add `webgpu_caustics` example

* update title

* add stats

* use webgpu

* add `webgpu_volumetric_caustics` example

* updates

* Update puppeteer.js

* Update puppeteer.js

* Update webgpu_volume_caustics.html

* fix shadow-map alpha

* add glass example

* Update webgpu_shadowmap_opacity.jpg

* Update webgpu_volume_caustics.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.

3 participants