Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
111 stars 0 forks source link

MainAndMaskTexturePropertyBlock MaskTexture Does Not Apply To Any Material #1454

Open lxw404 opened 2 months ago

lxw404 commented 2 months ago

Describe the bug?

The MaskTexture on the MainAndMaskTexturePropertyBlock seemingly has no effect on any material whatsoever.

To Reproduce

Observe that the mask texture is not applied. The above can be done for any material with a MaskTexture, and the result is the same.

Here is a minimal example object: resrec:///U-LuxKitty/R-A15215D5EF0A13C36AE3482BFA61369C0F54355976695B3C721E0650C6BA59B3

Expected behavior

The MaskTexture in the property block should apply to the MaskTexture in a material with that property.

Screenshots

Resonite_n3xKgWt1oR

Resonite Version Number

2024.3.1.1178

What Platforms does this occur on?

Windows

What headset if any do you use?

Valve Index, Desktop

Log Files

MainAndMaskTexturePropertyBlock Mask - 2024.3.1.1178 - 2024-03-07 07_31_42.log

Additional Context

No response

Reporters

LuxKitty

XDelta commented 2 months ago

Looks like the MaskTexture on the MainAndMaskTexturePropertyBlock only gets applied if you have a MaskTexture set on the main material. In your example, the material variant is not using a MaskTexture and by the time it gets to the PropertyBlock there is no MaskTexture to replace as the variant doesn't include it.

With a white texture used as the Mask Variant 6: 91787d0ef0

Without a Mask, Variant 4: 94923f4adb

lxw404 commented 2 months ago

That is definitely confusing from a usage standpoint since the MainTexture can apply without having to set it on the material itself. I do notice that this happens on the UnlitMaterial as well with MaskTexture since its base variant does not have this property.

shiftyscales commented 2 months ago

Seeking feedback from either of @Frooxius or @Geenz - this sounds like it might be a consequence of how the shader variants are toggled between rather than explicitly being a bug?

There'd probably need to be a mechanism implemented to switch a shader variant when it is being referenced in a property block component.

As @XDelta highlighted above- it seems this issue can be worked around through use of a dummy/placeholder texture to ensure the material is using the proper variant with the appropriate properties.