Siccity / GLTFUtility

Simple GLTF importer for Unity
MIT License
1.01k stars 218 forks source link

Support HDRP materials #73

Open cpetry opened 4 years ago

cpetry commented 4 years ago

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.

Siccity commented 4 years ago

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

cpetry commented 4 years ago

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.

cpetry commented 4 years ago

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?

Siccity commented 4 years ago

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

cpetry commented 4 years ago

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

cpetry commented 4 years ago

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"

cpetry commented 4 years ago

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?

cpetry commented 4 years ago

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.

LaserYGD commented 2 years ago

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

LaserYGD commented 2 years ago

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.

dirrogate commented 2 years ago

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

keyserjaya commented 2 years ago

Bump +1

ghost commented 2 years ago

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