Leadwerks Game Engine

Leadwerks Game Engine

Not enough ratings
Displacement Maps for Decals
By nick.ace
This is a quick tutorial on the usefulness and application of displacement maps for more than just standard terrain painting.
   
Award
Favorite
Favorited
Unfavorite
Overview
I'm making this guide because I thought that displacement maps were nice to have, but weren't much more than that. Then, I needed to add decals to the ground, and since placing planes everywhere would lead to performance issues and a cluttered scene, I decided to take a different approach and began experiementing. Anyway, I hope it's helpful to someone!

I know this is basic stuff to many of you, but maybe someone might get insight into something that they hadn't before.
Making the Displacement Map




First, have the image of what you want ready. This image does not need to have different alpha channel values.




Second, make the displacement map. The displacement map is similar to a height map except that darker shades of gray make the material more transparent. What this means is that the displacement map essentially acts like an alpha map.
Terrain Texturing

This is the familiar layer menu for the terrain painter. I recommend placing decals lower on the list (high in number like layer 16) so that they draw over the rest of the terrain textures.






Now paint! Wait? What's with the black stuff? I think this might be an error with Leadwerks, but I'm not sure, so I'm hesitant to blame it on Leadwerks. This can occur if you paint on the terrain FULLY a texture with displacement map.










One possible solution that seems to work well for me is to CTRL-Left_Mouse. For those who don't know, this is how you erase textures off of the terrain for a selected layer. Just click on the black areas (1 click should be sufficient, do not hold down), and they you should get the image on the right. There you have it! This is an efficient way to paint decals onto scenes without extra geometry, but it only works on the terrain surface.
License
Just to be clear, all the images in this guide that I made can be used for commercial use (CC0 license - basically public domain). They might not be the highest quality stuff :), but I found these images useful for my own game.