Z Offset Shader Parameter

Simple question:

In the past we were unable to use anything but a constant for Offset values. Has that changed with Unity 5.5?

It appears there is a work-around using LOD but I’d still like to know.

Thanks.

As far as I know you can only use constants for the offset, also in Unity 5.5. I guess you could do a workaround with custom RenderTypes or LOD, but both seem kind of hacky to just adapt the offset. Describe what you want to do, maybe there is an other solution than using only Offset.

Pardon me looking really stupid for making this thread but,

I just tried using a shader parameter for offset and it worked. You can even change it at run-time!

Maybe this is simply an undocumented change or not very well-known one. The reason I’m using it is to have characters overlap each other in a fighting game. And to be able to change their Z-offset at run-time is amazing!

Can you provide the code of the shader that does this? Using a shader parameter as the value for Offset does not compile for me.

You can find a lot of examples and documentation for Offset and other parameters here: https://github.com/supyrb/ConfigurableShaders/wiki/Rendering
The repo includes all parameters I know of that can be exposed like that. Should get you on the right track if you’re using the builtin pipeline.

I see. Thanks! It’s the [_Offset] syntax I was missing.

Is there a way to use Offset in URP in shadergraph? I can’t seem to find it

Because they don’t expose it as an option.

I posted a way to roughly approximate it in this thread.

1 Like