I am looking to make a specific effect in three js, by using the effect composer. For that effect I need an output from one of the passes that outputs (in the render target) the coordinates of each pixel in world space. From what I read on the net, it seems that whatever I do, WebGL will clamp the color values I output to [0,1], meaning that I cannot output the world coordinates. My question is whether there’s another way to output the world space coordinates of each pixel from the pixel shader. I am aware that I can output the NDC of each pixel and then transform them to world space in the pass accepting the output by multiplying by the inverse of the view*projection matrix, I just want to avoid these unnecessary computations since speed is important in my case.
You should be able to use
THREE.FloatType type to hold your world space coordinates.
I am targeting WebGL 1 with no extensions. I found a workaround where you encode a float into 4 u8 http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/