diff --git a/examples/screenshots/webgpu_compute_birds.jpg b/examples/screenshots/webgpu_compute_birds.jpg index fa9301798a65c6..1293dd5f12be58 100644 Binary files a/examples/screenshots/webgpu_compute_birds.jpg and b/examples/screenshots/webgpu_compute_birds.jpg differ diff --git a/examples/screenshots/webgpu_instance_sprites.jpg b/examples/screenshots/webgpu_instance_sprites.jpg index fe6a223fcfacea..a452698dd728e6 100644 Binary files a/examples/screenshots/webgpu_instance_sprites.jpg and b/examples/screenshots/webgpu_instance_sprites.jpg differ diff --git a/examples/screenshots/webgpu_postprocessing.jpg b/examples/screenshots/webgpu_postprocessing.jpg index 055e2fcb46c646..33d1d0850c7172 100644 Binary files a/examples/screenshots/webgpu_postprocessing.jpg and b/examples/screenshots/webgpu_postprocessing.jpg differ diff --git a/examples/screenshots/webgpu_postprocessing_afterimage.jpg b/examples/screenshots/webgpu_postprocessing_afterimage.jpg index 4a1032c93cd0a4..004fc4afb6b348 100644 Binary files a/examples/screenshots/webgpu_postprocessing_afterimage.jpg and b/examples/screenshots/webgpu_postprocessing_afterimage.jpg differ diff --git a/src/materials/nodes/NodeMaterial.js b/src/materials/nodes/NodeMaterial.js index cc1a777611e284..043f14f004e251 100644 --- a/src/materials/nodes/NodeMaterial.js +++ b/src/materials/nodes/NodeMaterial.js @@ -590,9 +590,9 @@ class NodeMaterial extends Material { if ( fogNode ) { - const fog = vec4( fogNode ); + output.assign( outputNode ); - outputNode = vec4( fog.a.mix( outputNode.rgb, fog.rgb ), outputNode.a ); + outputNode = vec4( fogNode ); } diff --git a/src/nodes/fog/Fog.js b/src/nodes/fog/Fog.js index 3cd015cdbce9d2..0478f619fe95a3 100644 --- a/src/nodes/fog/Fog.js +++ b/src/nodes/fog/Fog.js @@ -1,6 +1,6 @@ import { positionView } from '../accessors/Position.js'; import { smoothstep } from '../math/MathNode.js'; -import { Fn, vec4 } from '../tsl/TSLBase.js'; +import { Fn, output, vec4 } from '../tsl/TSLBase.js'; /** @module Fog **/ @@ -69,7 +69,7 @@ export const densityFogFactor = Fn( ( [ density ], builder ) => { */ export const fog = Fn( ( [ color, factor ] ) => { - return vec4( color.toVec3(), factor.toFloat() ); + return vec4( factor.toFloat().mix( output.rgb, color.toVec3() ), output.a ); } );