GeometryBufferRenderer issues

The GeometryBufferRenderer of the scene doesn’t seem to work like expected.

The depth texture doesn’t seem to come through correctly. If I check the inspector, I can see the depth texture working, but if i pass it to a shader it’s the same as the position texture.

Also, both scene.geometryBufferRenderer.getTextureIndex(BABYLON.GeometryBufferRenderer.DEPTH_TEXTURE_INDEX) and scene.geometryBufferRenderer.getTextureIndex(BABYLON.GeometryBufferRenderer.NORMAL_TEXTURE_INDEX)
return -1 even tough they are in the textures array.

The following example shows the depth texture having the same content as the position texture. I got the indexes for the textures by logging the array to the console and checking the name of the textures.


Also, for some reason, getTextureIndex only handles POSITION_TEXTURE_TYPE / VELOCITY_TEXTURE_TYPE / REFLECTIVITY_TEXTURE_TYPE as parameters… Maybe that’s because the depth and normal textures are always created and are always indices 0 and 1 respectively…

Right, had the wrong constant while I was testing in the playground, but the correct ones in my dev env.

It does seem a bit inconsistent though for the getTextureIndex not to handle all textures, even if those values will always be the same.

Also, the texture at index 0 (gBuffer_Depth) seems to be always 100% red for an object at both the near and far clipping planes. I tested this with putting the clipping planes quite close to each other.

The gBuffer_Depth texture holds the viewPos.z component. So, except if you are at less than one unit from the object, you will see the texture all red when viewPos.z >= 1.

1 Like

Hey there just checking in, are you still having issues? @vinhui