Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SRP (URP/HDRP) Material mapping on Asset Import #38

Open
bitinn opened this issue Mar 14, 2022 · 3 comments
Open

Support SRP (URP/HDRP) Material mapping on Asset Import #38

bitinn opened this issue Mar 14, 2022 · 3 comments

Comments

@bitinn
Copy link

bitinn commented Mar 14, 2022

This is more of a feature request than a bug, but currently UnityGLTF import materials with BIRP shader, so they do not work under URP or HDRP.

Screen Shot 2022-03-14 at 18 07 57

(glb file imported with glTFast, GLTFUtility, UnityGLTF)

2 ways to address this issue:

  1. Map materials to URP and HDRP Lit shaders when they are active, or provide some compatible shader graph.
  2. Expose material replacement in the import settings.3.

Personally I prefer option (2), as it matches what Unity model importer does; but it can't hurt to also have (1).

Screen Shot 2022-03-14 at 18 02 27

Currently both glTFast and GLTFUtility offers (1) using a custom shader graph, and GLTFUtility in addition support (2).

(Hope this doesn't create too much competition between plugins, but I also don't want to switch between 3 GLTF plugins just to get work done :) )

Thx!

@bitinn bitinn changed the title Support SRP (URP/HDRP) Material on import Support SRP (URP/HDRP) Material mapping on Asset Import Mar 14, 2022
@hybridherbst
Copy link

hybridherbst commented Mar 14, 2022

Thanks for the request, it's been a long-standing one :)
For our projects we have actually switched to a workflow that does use multiple packages:

  • glTFast for import (editor and runtime)
  • UnityGLTF for export (editor and runtime)

because that's where both of these have their strengths, at least right now.

The issue with (2) above is that it will not properly capture material properties as in the GLB file (there are simply features that do not map to any shader shipping with Unity/URP/HDRP); I agree that it would still be useful to have.

Two more options:

  1. using the ShaderGraphs shipping with glTFast for UnityGltf import if both packages are in the same project
  2. making new ShaderGraphs but only for 2021.2+ so that there's one graph for all (BiRP/URP/HDRP)

instead of the current approach of having divergent features across multiple shaders.

@bitinn
Copy link
Author

bitinn commented Mar 18, 2022

Yeah personally I think (4) might be the better option, though I think it's important for a glTF plugin to be able to repack texture channel according to SRP Lit shader's preference, so that users can switch to Lit when needed.

One common roundtrip problem:

  • Export a Unity prefab as glTF asset.
  • Import the same prefab back into Unity, now texture packing is different, so can no longer use the original shader.

(For example, how do we export a Tree? atteneder/glTFast#343 I end up first replacing Unity's SpeedTree shader with Lit, then on import, using a custom shader to support ORM map.)

@hybridherbst
Copy link

Option (4) above is implemented for a while (cross-pipeline Shader Graphs); there are a number of other issues listed here (e.g. remapping shaders on import) remaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants