Hello, I am struggling to find a way to access, overwrite and read values of a shader graph through a C# script. I found a few posts about the same question, but they dont solve my case. In my situation, I use shader graph to combine two textures but not for a material that is applied on a 3d object. Here is the shader graph, its quite simple:
So, I need to paste the output(base color) into cloud map property in a post processing element, but how do I paste it there and set the shader graph fields/variables trough code? Or maybe, there is a way to do the same effect without shader?
Well, I believe the answer is almost in the question.
For a Shader Graph to do anything you need a Material instance to be used somewhere, whether thatβs in a Render Pass, Custom Render Texture or Renderer.
Whatβs your use case?
If I understood your question correctly, I do not render the texture at all, I just want to combine two textures for a map. How do I achieve the same goal of my shader graph without material or shader?
Re-reading your original question this makes sense.
To process a texture and feed the result in a Texture input slot somewhere, you need a Custom Render Texture.
Hereβs an example of the setup.
Hope this helps.
Thanks a lot man! I will read the whole page, and mark your answer as the solution when I see it works.
No, this wasnt the solution. I simply did not understand what Custom Render Texture shader does.
It renders to a render texture via the Custom Render Texture.
That Render Texture can then be used anywhere a Texture can be to do things such as Post Processing or other effects.
The key difference being that when set to Double Buffered, you can access the previously rendered frame to do things like accumulation.
Hereβs a very simple example:
And its result set on a UI Raw Image.