-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
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.
|
|
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 |
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 |
* `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
* `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
| 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 | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunag It seems like there might be a typo here. chromaticAberrationOffset is a float, but is being accessed with .x and .y?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing, thank you :)


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