- Home /
Runtime generated RenderTexture as Displacement map weird behavior
Hey.
I'm using a compute shader to generate a displacement map at runtime. In order to write to a RenderTexture in a compute shader you need to assign some flag* to it before creating it and this (as far as I know) can only be done via scripting. So I'm stuck at creating it at runtime.
Now if I apply that texture as a diffuse to a material it works as one would expect it to, brilliant!
But if I try to use it as a displacement map it results in all kind of undefined behavior which is kind of funny in it's own way... Sometimes you get nothing and sometimes it seems like an instant wave generator.
Sometimes it also draws a couple of frames correctly when you hit play or stop.
I also double checked that RenderTexture is supposed work and does work as a displacement map, just not the runtime generated I suppose.
Anyone able to shed some light on this?
Edit: The flag is RenderTexture.enableRandomWrite. Could also be the root of the problem?
Answer by Dep · Mar 11, 2014 at 06:08 AM
I believe it has something to do with the order of the rendering pipeline.
One workaround I am using is to double buffer two RenderTextures.
Your answer
Follow this Question
Related Questions
How do int textures work in ComputeShaders? 2 Answers
CustomRenderTexture (RFloat) wont initialize in the same frame it is created. 0 Answers
sampler2d object has no methods 1 Answer
How to render a RenderTexture into a specific mipLevel 0 Answers
How to use Camera.RenderWithShader() to modify rendered image? 0 Answers