VMT Export: $envmapmask Open Discussion

Started by wallworm, May 17, 2015, 11:30:57 AM

Previous topic - Next topic


The $envmapmask is the VMT parameter that controls the reflectivity of a material. If you are unfamiliar with how it works see VDC: $envmapmask.

There are some special rules for $envmapmask for some shaders like VertexLitGeneric. The code for Wall Worm's VMT exporter takes those rules into account when exporting a Standard Material into a VMT.

The VMT Exporter checks to see if the Specular Level Map is the same as one of these maps in this order:

1) Bump Map
2) Displacement Map
3) Self Illumination Map
4) Diffuse Map

If the maps are the same and the map has a bitmap and the bitmap has an alpha channel, WW will use the appropriate command for $envmapmask, which is one of these:

1 & 2: $normalmapalphaenvmapmask 1
3: $selfillum_envmapmask_alpha
4: $basealphaenvmapmask

The issue up for discussion relates to new tools in the WW Pro Materials/Texture capabilities.

In the current Dev version of WW+WW Pro, any type of texture can be a valid input for a VMT texture (for example, Noise, Cellular, etc). Those procedural textures do not have bitmaps or, obviously, bitmaps that can have alpha. So at this moment, the test will fail and WW falls back to using the $envmapmask.

My gut is telling me to remove the bitmap.hasAlpha check in the code and simply check if the maps are reused.

The question here is: For those of you who really understand the VMT and textures, can you see any reason that that the bitmap.hasAlpha check should remain? In other words, are there times you've ever re-use a bitmap in the slots mentioned above and not simply expect the tools to presume there is an alpha?

Share your thoughts, as this will affect the next release of WW's VMT code.


I just updated the DEV build linked above. It now includes the new logic. It isn't in the release build, however. It's still open for debate.


I forgot to update this thread. The changes above are now part of the VMT exporter.

SMF spam blocked by CleanTalk