#Setting RenderGraph Material Properties

1 messages · Page 1 of 1 (latest)

gritty dome
#

Hi, we recently upgraded to Unity6 and migrated our Blur shader to RenderGraph.
I'm using KawaseBlur, so we are running multiple ping pong passes and want to increase the Offset parameter with each iteration.
Currently I'm doing the pingpong passes like this in RenderGraph

{
    Shader.SetGlobalFloat(OffsetProp, data.Offset);
    Blitter.BlitTexture(context.cmd, passData.Source, Vector2.one, data.BlurMaterial, 0);
});```

However, I've just come to realize, that the blitting is only QUEUED at this point, not actually performed.
This results in the Offset of the LAST queued render func to be used, not the one i've defined here.
What is the intended way to set material properties here?
The only thing I found to work so far would be to actually duplicate the Material a bunch of times, giving each one a separate Offset Property value. Is there a better approach? 😅  Thanks!
elder dawn
gritty dome
#

Yeah, I found that as well.
However it requires me to set AllowGlobalStateModification, which reads

        /// reordered before this pass. This may nave negative impact on performance and memory use if not used carefully so it is recommended to only allow this in specific use cases.
        /// This will also set AllowPassCulling to false.```
I mean, it makes total sense, I think this disables the queueing issue alltogether, but wouldn't creating a separate material for each pingpong pass be better?
I don't want to set a global state, I basically only need the property on the specific material that i'm blitting
#

I'm a big fan of your ShaderGraphVariable plugin btw! It's such a lifesaver!

elder dawn