Repository navigation
Conversation
Implements IVpeMaterialEditorImporter for URP (port of the HDRP importer) so an editor/batch .vpe import rebuilds URP materials and saves them as assets. Masks UrpMaskRemap bakes into RenderTextures are read back and saved as linear PNGs: AssetDatabase.CreateAsset drops references to non-asset textures, which left remapped steel materials without their mask (matte white). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcbenji
marked this pull request as ready for review
October 19, 2026 15:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Engine has
IVpeMaterialEditorImporterand HDRP registersHdrpMaterialEditorImporter, but the URP package has no implementation, so an editor/batch.vpeimport into a URP project leaves the materials unconverted.Change:
UrpMaterialEditorImporter, a port of the HDRP importer that drivesUrpMaterialResolverwith the imported texture assets and saves the materials as.matassets, registered with[InitializeOnLoad]. HDRP-only parts (templates, normal-map packing, ray tracing mode) are left out.It also keeps the masks
UrpMaskRemapbakes. For HDRP mask remaps that URP scalars cannot express,UrpMaskRemap.Bakeassigns a RenderTexture to_MetallicGlossMap/_OcclusionMapand sets metallic 0 / smoothness 1 (the mask carries the values). The RenderTexture is alive afterCreateMaterial, butAssetDatabase.CreateAssetdrops a material's references to objects that are not assets, so the saved material had an empty mask slot. The importer now reads each baked RenderTexture back into a Texture2D right afterCreateMaterialand, afterCreateAsset, saves it as a linear PNG next to the materials (one file per distinct bake, shared by every material that uses it) and assigns that asset.Evidence (Attack From Mars, Engine .221 / Urp .205):
_MetallicGlossMapempty, metallic 0, smoothness 1 (e.g.AFM Steel - Microscratch (Light) ST5), although the package carries the mask and remaps (MetallicRemap 0..0.983, SmoothnessRemap 0.22..0.97, same as the HDRP source). In the player every wire ramp, bracket and rail rendered matte white.AFM Steel ST5referencessteel-microscratch(light)-mask (remapped).png(linear). Material folder 25 MB (an earlier variant that embedded the masks uncompressed in the .mat files was 329 MB). In the player the wire ramps, brackets and rails are chrome again, matching the pre-.205 conversion (before/after screenshots available).Tests: the URP repo has no test assembly. Manual: batch import of the AFM .vpe (350 material profiles) into a URP project, then reopen the scene and check that the materials and the remapped masks persist. Results: the AFM import above (Linux, Unity 6000.5, batch). We have used the importer (without the RenderTexture part) in our AFM URP pipeline since 2026-10-15.
🤖 Generated with Claude Code