S
S
Stanislav Silin2015-12-29 13:04:08
3D rendering
Stanislav Silin, 2015-12-29 13:04:08

How to render to texture with custom shader for current viewport?

I need to get a texture which will then be used to render the post effect. As far as I understand, in order to get it, you need to render to a texture with a specific shader for the current viewporta-a. Then use this texture in the post effect shader.
In pure OpenGL, I would do this:

  1. We clear the buffer.
  2. Bind our custom shader.
  3. We render everything.
  4. Save to texture.
  5. We clear the buffer.
  6. Rendering with shaders that are attached to meshes.
  7. We make a post effect with the texture that we got in step 5.
  8. profit.

It's not clear to me how to stick steps 1-5 into Unity. Yes, there is Render to Texture, yes, you can render different layers, but there was no mention that this can be done with a custom shader.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2015-12-29
@byme

You need Camera.RenderWithShader , OnRenderImage and manual .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question