Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/webgpu_postprocessing_ssgi.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script type="module">

import * as THREE from 'three/webgpu';
import { pass, mrt, output, normalView, velocity, add, vec3, vec4 } from 'three/tsl';
import { pass, mrt, output, normalView, diffuseColor, velocity, add, vec3, vec4 } from 'three/tsl';
import { ssgi } from 'three/addons/tsl/display/SSGINode.js';
import { traa } from 'three/addons/tsl/display/TRAANode.js';

Expand Down Expand Up @@ -78,11 +78,13 @@
const scenePass = pass( scene, camera );
scenePass.setMRT( mrt( {
output: output,
diffuseColor: diffuseColor,
normal: normalView,
velocity: velocity
} ) );

const scenePassColor = scenePass.getTextureNode( 'output' );
const scenePassDiffuse = scenePass.getTextureNode( 'diffuseColor' );
Copy link
Collaborator

@Mugen87 Mugen87 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind adding this below the getTextureNode() block? This will change the format from RGBA16 to RGBA8 saving half of the memory and bandwidth. For modulating the GI, this precision should be sufficient.

const diffuseTexture = scenePass.getTexture( 'diffuseColor' );
diffuseTexture.type = THREE.UnsignedByteType;

const scenePassDepth = scenePass.getTextureNode( 'depth' );
const scenePassNormal = scenePass.getTextureNode( 'normal' );
const scenePassVelocity = scenePass.getTextureNode( 'velocity' );
Expand All @@ -98,7 +100,7 @@
const gi = giPass.rgb;
const ao = giPass.a;

const compositePass = vec4( add( scenePassColor.rgb, gi ).mul( ao ), scenePassColor.a );
const compositePass = vec4( scenePassColor.rgb.mul( ao ).add( scenePassDiffuse.rgb.mul( gi ) ), scenePassColor.a );

// traa

Expand Down
Loading