So I tried to test it out first:
I have a camera placed at vec (0, 10, 0)
a ground mesh placed at vec (0, 5, 0)
I would then expect the values in the texture to all be 5. Instead they are all zero…
I noticed you first assign the ground.material.emissiveTexture the value returned by renderer.getDepthMap()
, but then assign it the value of convert, new BABYLON.ProceduralTexture('convert', 512, 'convert', scene)
Is this intentional?
@Cedric OR is it actually like this:
mat.emissiveTexture.readPixels().then((data) => window.tData = data)
tData.length / 4 // → 262144
tData.length ** 0.5 // → 512
So my clip space is a 515 x 512 plane centered on the camera, looking straight down, where each coordinate on the plane is of the form Vector4(x,y,z,w)?
I would use a renderTarget with a r32f or rgba32f output.
don’t forget default texture format is 8bits per component. you can’t store normalized value > 255
1 Like