realism-effects icon indicating copy to clipboard operation
realism-effects copied to clipboard

SSGI Instacned & GPUComputationRenderer support

Open momentchan opened this issue 3 months ago • 0 comments

I used GPUComputationRenderer to compute the position and velocity for particles and save them as texture, and pass them to instancedMesh for rendering.

<instancedMesh>
       <boxGeometry args={[0.2, 0.2, 0.6]}>
               <instancedBufferAttribute attach="attributes-uvs" args={[uvs, 3]} />
        </boxGeometry>
        <ThreeCustomShaderMaterial/>
</instancedMesh>

In the vertex shader of the material for instancedMesh, I did something like this:

 void main() {
         vec3 pos = texture2D(positionTex, uvs.xy).xyz;
         csm_PositionRaw =  projectionMatrix * modelViewMatrix * vec4( position + pos, 1.0 );
},

When I apply the SSGI, all particles become bunch of boxes in the origin, and the positions I modified with the positionTex are not correctly reflected. Is it some kind of the limit of SSGI?

螢幕擷取畫面 2024-04-13 153801 螢幕擷取畫面 2024-04-13 153920

momentchan avatar Apr 13 '24 07:04 momentchan