You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SpeedTree 9 - Add dependency on extracted materials & Fix remapping of materials
Big conversation here: https://unity.slack.com/archives/C05C7C93RL4/p1701979272164239
Big description here: https://jira.unity3d.com/browse/UUM-57578?filter=-1
`ISSUE 1`
This is a fix for SpeedTree9 assets only. That's the best solution I found, considering the limitation of the Preview system. Basically, with this PR, we now have a dependency on the extracted materials (so outside the Prefab).
With it, if the user deletes an extracted Material (non-reversible operation), it re-triggers the preview generation (thanks to the function `GenerateAssetData` in `PreviewImporter.cpp`).
Also, instead of having a pink Mesh in the scene (since there's no more material attached to the Mesh), the importer is regenerating the materials as embedded automatically, so the user doesn't have to `Reset` the asset or manually press `Apply & Generate Materials). Pretty convenient.
`ISSUE 2`
Also, there was issues with the remapping options. Basically, the entry materials were duplicated and sometimes the remapping wasn't working (material was set to null after hitting `apply`). Adding the variable `defaultName` avoid those issues, by always keeping the initial material name (e.g `RulesExampleMat`) on the left of the entry, and having the real material name and instance (e.g MyMatyellow) in the object field.
Here's the final results in action (sorry for the poor gif quality, had to compress a lot the gif):

`ISSUE 3`
When textures were moved somewhere else in the project (i.e not next to the assets), it was breaking the material references to them. Now it's not the case anymore, we are checking for them if they are not next to the asset.

Copy file name to clipboardExpand all lines: Packages/com.unity.render-pipelines.high-definition/Editor/Material/Nature/HDSpeedTree9MaterialUpgrader.cs
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ private static class HDProperties
0 commit comments