- Home /
How to read self when CustomRenderTexture dimension is Tex2DArray
When creating a CustomRenderTexture shader, Unity provides _SelfTexture2D
, _SelfTextureCube
and _SelfTexture3D
to read the value of the texture in the previous frame. I now want to set dimension
to TextureDimension.Tex2DArray
. Trying to read from any of these seems to result in a zero values. I'm always writing and reading from the 0th slice. Double buffering is enabled.
I've also tried passing the texture manually back into the shader, and this sort of works but produces a "Custom Render Texture cyclic dependency should not exist" error.
I could create 2 textures and manually blit them each frame, effectively doing the double buffering myself, but I assume there is a better way I am not seeing.
How can I sample a doubly-buffered texturearray while writing to it?
I ended up just having 2 textures and blitting them like so: Graphics.Blit(mirrorRenderTextures, mirrorRenderTexturesBuffer, sliceIndex, sliceIndex);
Your answer
Follow this Question
Related Questions
Rendering a Pygame surface in Unity 0 Answers
RenderTexture being wiped/changed on play or undo. 0 Answers
Render textures doesnt exist in unity 4.7.2 0 Answers
Render texture and shader issues 0 Answers
Render object ID to texture 2 Answers