Siccity/GLTFUtility

Support HDRP materials

cpetry opened this issue · 13 comments

Hi there,

I would like to update my project to HDRP.
Currently this package uses its own shaders.
Is there a way to put in a switch to use HDRP shaders instead of the custom GLTF shaders?

I would gladly contribute when I got time again.

I think we did something along those lines already in a previous update. Have you tested?

Did not yet test it but I know of materials being able to convert from StandardShader to HDRP Lit and alike. This though only works in editor mode. I would need that in runtime.
I'll test and report back.

By the way:
What is the reason behind the custom shaders? Wouldn't it be possible to just set all material parameters on Standard shaders?

GLTF packs textures a bit differently. Instead of repacking textures, i figured i'd let people use their GLTF textures as-is.

Just noticed something:
I changed normal map handling in the shaders to using UnpackScaleNormal().
As you don't convert them to "Unity NormalMaps" this is wrong.
Sorry for this.

It would greatly reduced import speed I assume if this conversion would be implemented. See https://answers.unity.com/questions/801670/runtime-loading-normal-texture.html
Therefore this should be changed back in your shaders

After thinking about it further:
Shouldn't there be any unpacking at all inside the shader? The direction itself should be already existing "as-is"

Just checked it. It seems UnpackScaleNormal() is right here after all. Sorry for the confusion.
Didn't find though a conversion inside the scripts. Does GLTF by default save it correctly for Unity?

Just checked: HDRP does not work out of the box like this. Shader parameter names are completely different. On the HDRP package are editor scripts for converting these.
I will see if I can start on using the HDRP Lit shader and setting some basic parameters accordingly.

Also interested in this, just found out it's not supported.

Works fine on URP/built-in, would be great to get it on HDRP since that's the render pipeline most archviz and high-end graphics use which would be helpful since we'd be able to get unreal assets to unity HDRP.

same here. Would love to have a way to upgrade Gltf shaders to Hdrp. Even, if only from editor.

Bump +1

I got this working on HDRP simply by opening the shaders and adding HDRP to the target list on 2021.2, works fine just with that one simple step!
https://i.gyazo.com/f73410e23cdf8d219f6916c4fe22d520.png