Spellcaster Studios

Make it happen…

Started with decals

One of the effects I would like to use extensively in the game is “decals”…

A decal is just a kind of painting you put on top of the geometry.

Decals used to be done by intersecting the world geometry with the decal shape and drawing those polygons, but since I now have the normal/depth of each point on screen available, I can probably get away with using screen-space decals… I got the idea first from this presentation: Screen Space Decals in Warhammer 40K: Space Marine.

As the rest of my rendering engine, I’m betting a lot of batching, which introduces some complications: since I can’t pass the decal property as a constant to the shader, I need to find another way to pass it in. For now, I’m using the texture coordinates of the box itself, which is a bit wasteful. I could use an array and just pass an index, but that would be more complex and would have other limitations, like the number of decals on a single batch.

So, to be able to add this kind of “custom data” to each vertex, I had to code in a new vertex declaration system, but that was quite fast (I had to do most of the groundwork before for the OpenGL port anyway).

So, the current state of this is:

screen422

“What am I looking at?!”, I hear you say…

Basically, you’re looking at the rendered decal volume, in which every point is colored with the normal extracted from the Normal+Depth buffer…

Tomorrow I’ll work on actually generating UVs from that and discard the points that don’t belong inside the decal box… Just look at the tree below:

screen423

Most of the code on the decal shader is to prevent that from happening… Smile

Now listening to “The Burning Halo” by “Draconian”

Comment