Standard SpeedTree static export/import support
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently the support for SpeedTree are problematic in 3 ways:
-
Nature/*
class shaders are special and require reading from a different set of texture ids, currently glTFast ignore all textures on such materials. -
Large trees often need to be visible from a long distance, so have LODGroup on them, glTFast currently doesn’t recognize Unity’s LOD import convention. So on a round trip export/import, the LODGroup component is lost. (Obviously even a FBX round trip will lose the LODGroup settings, but Unity is able to set a sensible default LOD cascade on import.)
-
I also ran into an issue exporting TIFF (
.tif
) normal maps, glTFast doesn’t appear to recognize them as linear map, so the exported texture looks much bluer than the original, PNG normal map doesn’t suffer from this issue.
I don’t use SpeedTree assets in real-time due to their performance cost, and I generally convert them to static meshes for my Blender / Unity workflow. So having a semi-automated workflow via glTF would be great.
Describe the solution you’d like
-
Handle texture export for PBR maps for bulit-in
Nature
class of shaders, note that their Metallic/AO channel are packed differently from default Lit Shader (and isn’t ORM). In addition we need to check if texture ids are different among BIRP, URP and HDRP shaders. -
Reconsider texture import strategy, currently the glTF spec’s ORM texture is not compatible with default Lit in Unity, this makes round trip more time consuming (potential solution includes 1. texture import post processor, 2. glb importer allowing texture channel repack).
-
LOD solution can be solved via #20 , should be mostly compatible with Unity’s LODGroup, barring the cross fade settings.
-
Reopen #67 as it appears only partially resolved.
Describe alternatives you’ve considered
Doing all of these manually.
Additional context
Unity has recently released free SpeedTree assets and scenes, in case you want to investigate this issue. It contains both TIFF normal map and usage of SpeedTree (Nature) shaders. I tested with the HDRP demo.
https://assetstore.unity.com/packages/3d/environments/unity-terrain-hdrp-demo-scene-213198 https://assetstore.unity.com/packages/3d/environments/unity-terrain-urp-demo-scene-213197
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
In general I think the way to support “each and every weird custom thing” (trees, TMPro, Canvas, whatever you want to export/import) is to build custom callbacks, at least that’s the plan for UnityGltf. Some of those could of course be built in at some point (trees make sense) but others would be very workflow and project specific.
Just to limit the scope a bit: for now, I am happy if I can get the basic PBR maps out and in again. Main problem currently is texture channel packing differences and import material assignments.
Sent from my iPhone