BramStoutProductions / MiEx

A modern Minecraft Exporter
BSD 3-Clause "New" or "Revised" License
61 stars 9 forks source link

Scale connection problematic in UsdPreviewSurface export #49

Closed erich666 closed 6 months ago

erich666 commented 7 months ago

If I export, say, leaves and use the UsdPreviewSurface, I see in the shader: float4 inputs:scale.connect = </materials/MAT_minecraft_block_jungle_leaves_BIOME/BIOME_minecraft_block_jungle_leaves.outputs:result> This connects this shader:

        def Shader "BIOME_minecraft_block_jungle_leaves"
        {
            uniform token info:id = "UsdPrimvarReader_float3"
            float3 outputs:result
            string inputs:varname = "Cd"
        }

The problem is that there's a mismatch. That shader has a float3 outputs:result, but the scale.connect is asking for a float4 input. Most DCC apps try to gracefully recover from such mismatches, but I can verify that this scale mismatch fails in USD Composer:

image

Unfortunately, short of commenting out the "inputs:scale.connect" line out of every shader, I don't know how to properly fix the shader. I've asked around a bit; it doesn't seem possible for UsdPreviewSurface. Maybe you know.

BramStout commented 7 months ago

Looks like a mistake on my part. I thought it would work when I originally made the UsdPreviewSurface material template, but it turns out it doesn't work. I'll get the material template updated for the next release to fix this.

Unfortunately, I am currently sick with a cold (been sick since Saturday, so it should be over soon), so it'll probably take a couple of days before I get a new version out.

In the mean time, you can easily fix it yourself by going to resources/UsdPreviewSurface/materials/minecraft/templates/base.json and remove the entire "@biomeColor@' section starting at line 75. When you then restart MiEx and export using the UsdPreviewSurface resource pack, it won't try to add the UsdPrimvarReader node and make that problematic connection.

erich666 commented 7 months ago

Get better soon! No rush on my part - I'm just reporting things as I find them, but they're not holding me back. Thanks for the workaround, I'll give that a try.

BramStout commented 6 months ago

This has been fixed in the latest version of MiEx, which you can find here; https://github.com/BramStoutProductions/MiEx/releases/tag/v1.6.0