BramStoutProductions / MiEx

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

Cutouts not fully supported in UsdPreviewSurface export #48

Closed erich666 closed 1 month ago

erich666 commented 2 months ago

I noticed MiEx doesn't use opacityThreshold in the UsdPreviewSurface material when the alphas are meant for cutouts, i.e., in the texture are all either 0 or 255, such as for leaves, grass, and other vegetation, e.g.,

float inputs:opacityThreshold = 0.500000

Doing so gives a sharp cutout around leaf edges, which is more what is expected for Minecraft, vs. blurry edges due to interpolation. Admittedly, with low-res textures you don't get the Minecraft blocky look, but opacityThreshold expresses the intent of cutout alphas.

Also, you do have to pay attention: if the texture actually has semi-transparency to it, e.g., colored glass, then you don't want to set opacityThreshold. Normally Minecraft materials are one or the other, anyway: cutouts or truly semi-transparent, but not both.

Anyway, a minor thing you might consider adding.

BramStout commented 1 month ago

I'll add in a condition query for textures to check if they are cutout textures, so that in the material templates you can check for that and so set the opacityThreshold.

BramStout commented 1 month ago

Cutouts are now supported in the latest version of MiEx. In the material templates, you can now check whether a texture is a cutout texture and set the opacityThreshold accordingly. The built-in UsdPreviewSurface resource pack has been updated to add this in.

You can get the latest version of MiEx here: https://github.com/BramStoutProductions/MiEx/releases/tag/v1.6.0