I have a shaderMaterial, i want to use the scene’s Depth Texture to displace it vertically, so far the examples return a ‘Z’ val ue only, could i access the vec3 position, or the Y
Here is the example code :
float readDepth( sampler2D depthSampler, vec2 coord ) {
float fragCoordZ = texture2D( depthSampler, coord ).x;
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
}