Siccity/GLTFUtility

Support for URP shader

dblatner opened this issue · 10 comments

Hey there!

Wether using GLTFUtility for VR or mobile application, URP would boost performance a lot. This would be the first GLTF solution supporting URP at the moment.

Probably the only thing to update is:

  • have a compile-time check if URP is used
  • if URP then: change shader references from standard shaders/materials to URP shaders in the material importer

What do you think?

Sounds simple enough. I can try, but I have no experience with URP.

Any update on this?

Please, URP is a must for mobile projects. Specially WebGL.

@Siccity Is URP support coming soon?

Just added basic URP support. Please verify that the shaders work correctly.

@Siccity It works! Just one thing, it seems to add a metallic material to the model for no reason. There is no metallic material in the original model, is there a way to configure this?

So it's working, but it seems to assign the wrong materials/material properties.

I will give you an example, check out this model

Using Piglet, it looks like this, exactly how it looks like on sketchfab. But using GLTFUtility, it looks like this:

Untitled

EDIT
Oops, Piglet also assigns a metallic material. But on GLTFUtility it looks way, way more metallic for some reason.

It would be nice if it was possible to edit the material from the model directly without having to create a material preset. This would be extremely useful when there are tons of meshes, Because right now, I need to reassign the material to each mesh.

EDIT 2
If I edit the model to use a specular material with the same texture instead of metallic, it works perfectly. Maybe all you need to do is change to use a specular material by default instead of metallic? I tested with many models, this issue doesn't happen with just the example I showed above.

@marcusx2 In normal PBR rendering conditions, a material is either metallic or specular. The model you are using is exported using metallic settings. GLTFUtility is correct to use metallic shader, and I assume both sketchfab and Piglet does the same. I think the problem here is that I set up the shader graph wrong, due to my inexperience with URP. You can edit the default shaders in GLTFUtility/Materials/URP. If you are able to spot the issue I can fix it.

@Siccity Oh I see. Sorry, I don't know the next thing about shaders either! Maybe you can try Unity Discord? They have a shader channel there.

I just committed a small fix for the materials. I found that i had hooked the roughness input to the metallic output, and not hooked the metallic input to anything. Now it's all hooked up and hopefully looks better!

@Siccity Thanks! It's working perfectly now. Is there a way that I can edit the materials in the editor without having to create a copy? I mean
image
clicking on the material right there and editing it.

@marcusx2 this is the default way Unity does it. You can't edit source materials on fbx or obj either. I might make a setting in the future that exports these source materials as editable copies