Is there a way to read the pixels from a ShaderMaterial?

I am trying to read the pixels from my ShaderMaterial texture, after the shader has been applied to a plane.
For other kinds of textures, you can readPixels or grab the url and you should be able to have the data.

But in the case of the ShaderMaterial, I am not sure how to get the raw pixel data after the shader is applied. I can’t find any exposed place where a texture has the shader applied.

Is there a way to directly read from the texture that the shader has drawn on or is there a way to get the data from a gl buffer?

This unfortunately does not work this way.

When using a shader, the pixels are directly rendered on screen for a given mesh. They might contain mixed information from several textures and such.

When reading pixels, you either grab the raw data from one texture or the screen/offscreen data. They are not in “mesh space”.

Could you detail a bit more what you are trying to do ? so that we can find the best approach ?

2 Likes