realism-effects
realism-effects copied to clipboard
SSGI Instacned & GPUComputationRenderer support
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?