Is it possible to have multiple lightmaps?
Hello, I'm trying to create a wet ground effect that would only affect areas exposed to the rain direction (not under a car, for instance). Usually, one would just manually paint those areas using vertex colors, but I'm trying to automate that process. Here's an example (notice how the ground is not as wet under the bridge):
So, since the rain has a global direction, and objects can block it, I was thinking about creating an extra lightmap with just a directional light casting shadows, and no light bounce, to use it as a mask for the wet effect latter in the shader.
However, I can't figure out how to store it without overwritting it when I bake the real lighting.
Lightmaps use the second UV channel, so maybe using the third one for this mask would be possible, but I have no idea how.
Does anybody have experience on this?
Your thinking direction seems to be the right one for specific purpose, but instead of lightmaps, you can just use scene capture actor with render target. Your logic would be to place scene capture actor above the scene and match its orientation to desired rain direction. You would then capture scene depth and write it to a render target. Now you have a texture, that virtually shows distance from rain origin to the nearest surface, exposed to the rain. For next step, in every scene material you should perform a check. You would need to transform pixel's position into rain coordinate space, and compare its depth-axis position with a depth stored in a render target. If it is less, the pixel is exposed to rain.
There are some challenges connected to implementing it, but overall it is doable with some efforts.
answered Jul 09 '17 at 10:27 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here