Examples: Add webgpu_caustics and shadow revisions#30962
Merged
Conversation
webgpu_causticswebgpu_caustics and shadow revisions
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Collaborator
Author
|
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 |
Owner
Collaborator
Author
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 |
This was referenced Apr 24, 2025
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
Methuselah96
reviewed
Nov 1, 2025
Comment on lines
+119
to
+125
| const chromaticAberrationOffset = normalView.z.pow( - .9 ).mul( .004 ); | ||
|
|
||
| const causticProjection = vec3( | ||
| texture( causticMap, textureUV.add( vec2( chromaticAberrationOffset.x.negate(), 0 ) ) ).r, | ||
| texture( causticMap, textureUV.add( vec2( 0, chromaticAberrationOffset.y.negate() ) ) ).g, | ||
| texture( causticMap, textureUV.add( vec2( chromaticAberrationOffset.x, chromaticAberrationOffset.y ) ) ).b | ||
| ); |
Contributor
There was a problem hiding this comment.
@sunag It seems like there might be a typo here. chromaticAberrationOffset is a float, but is being accessed with .x and .y?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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
three.js.webgpu.-.volumetric.caustics.-.Google.Chrome.2025-04-19.15-30-21.mp4
Summary
material.receivedShadowPositionNode