Automated way to make all materials have the Polyspatial Lightning Node?

We have a number of assets that use standard lit urp shaders, I was wondering if anyone would know if we could make a batch process to convert them to the new shader but still allow them to maintain their textures that’s we’ve already set?

If you have a shader graph using the PolySpatial Lighting node that has the same property names as the URP/Lit shader (_BaseMap, _BaseColor, _MetallicGlossMap, etc.–you can see the full list by pressing the Edit… button next to the shader in the material inspector), you should be able to write a script that changes the shader in existing materials to use it. You could either do this as a persistent conversion activated by an editor tool (searching either for materials in the scene or in assets), or use a tool that converts on build, such as the one I described in another thread on replacing shaders for light mapping.

1 Like