HDRP materials API

So it has been mentioned in a number of threads but it is more than tricky to change some HDRP material settings in code.
And some typical Material class functions no longer work, as I guess they internally focus on builtin shader naming schemes (?)
e.g. is Material.CopyPropertiesFromMaterial not working for HDRP?

I am resorting to looking up Lit shader variable names to make Material extensions but an API would be nice!

Hi, we are well aware of this issue and doing an API for HDRP Material (or fixing existing one) is one our roadmap. But we have no ETA for now.

however Material.CopyPropertiesFromMaterial should work. What kind of issue are you seeing with it?

1 Like

Great, Material.CopyPropertiesFromMaterial may be ok - probably just me

hmm… I what you may experience with HDRP vs builtin with this function is that once you call it, HDRP require to update all the passes and the keywords to work correctly and it isn’t something we have expose currently (it is an internal function). There is exatly the same problem in builtin except builtin have very few kewyord compare to HDRP and so the problem is less noticeable.

We are working on exposing this ‘reset keyword’ API.

Ah update, the function is public in HDShaderUtils
public static bool ResetMaterialKeywords(Material material)

https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDShaderUtils.cs#L85