• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

PC SDK: Masked Materials not producing Precomputed Static Shadows for Lightmaps

Delta69er

Grizzled Veteran
Sep 13, 2017
176
73
Category: SDK

Reproducibility: Always - Its complicated

Summary: Masked materials do not create precomputed shadows for static lighting.

Description: Essentially for well over a year the SDK has not been able to create precomputed shadows for light maps when you bake static lighting. This means very big objects that cast interesting and large shadows (such as foliage/tree leaves, gratings, fences) that would be critical for level design cannot be properly utilized. For a number of Mappers, this is basically a show stopper as Lighting makes or breaks maps. This was reported a couple of times to devs but it has yet to be addressed.

Current Shadows on Zed Landing: https://i.imgur.com/1GJLmwd.png
Public SDK Rebuild of Shadows: https://i.imgur.com/fk8MY1f.png

There is a fix for this in-house, as Zed Landing which bakes shadows from lots of foliage was rebaked for the update. We would like this fixed for beta2 of the current update please.


Please download the following testmaps:
  1. https://drive.google.com/file/d/14Xg...KA3RoTNSm/view
  2. https://drive.google.com/file/d/10qR...y_znAQAV4/view
The following research was primarily done by MixMakMax and some test materials provided by KillMaster so many props to them.

Here are some notes for map 1:
Spoiler!


Here are some quick reference for the notes in the map 2:
Spoiler!


According the Max, The bug is inconsistent, any current standard textures that use an Alpha channel for an Opacity Mask flat out do not work with the current materials. However this is highly inconsistent if you check the above provided maps; some materials work, some don't it's mostly a total gamble in some cases.

A partial workaround is to export the texture, edit it Photoshop/GIMP to save the Alpha channel into a separate Texture or reexport the texture with a new Alpha channel and reapply it to a Basic Material (that only contains 1 Texture sample to Diffuse/Opacity Mask). TWI's own Materials DO NOT WORK.

RSWJ7za.png


However through my own testing these are the results can also be inconsistent:
  1. Saving a separate Alpha Texture results in non-cutout shadow: https://i.imgur.com/sPyJC9N.png
  2. Using the Alpha Channel of a Reimported Diffuse results in correct shadows: https://i.imgur.com/Ry10TWj.png
Note that the workaround is partial, and in addition to that, exporting textures from the SDK is not always guaranteed as sometimes its not possible and using an external program like UModel also can sometimes mess up only exporting 1 or 2 channels of the entire image or in a different format.

The issue continues to get more complex with more complex materials.

From further investigation of my own it looks like there might be some broken interaction when a Diffuse goes through modifications to the original Texture (ie through WPO, brightness adjustmens, multiplies/adds, etc). If it is required for diffuse as Mask - a separate texture sample of the original Diffuse needs to be used for the cutoff.

For the below I used the exact same Parent Material the Zed Landing Foliage/Tree Leaves used I just split off a separate input for the Opacity Mask. See here: https://i.imgur.com/W4tLPvG.png

kT5Nlzj.png


One final thing to note is that not all TWI materials suffer from the bug as the following material seems to cast shadows fine: https://i.imgur.com/t226pDz.png

Online/Offline: NA
 
Last edited:
  • Like
Reactions: simplecat