Advertisement

Decal control design question

Started by August 01, 2024 11:31 PM
4 comments, last by Josh Klint 1 month ago

I have implemented decals in our new game engine, and I am having trouble with some design decisions.

Decals can be large or small. Sometimes they might appear only on a moving object, like a bullet wound in a character's leg, or a blast from a grenade that marks the corner of a room.

In our renderer, decals are drawn using the lighting system, so by default they appear on all surfaces within their volume. I need to pass information to the GPU that will allow the decal to select which objects it should appear on, but I am not sure how this should be decided. Without this, any dynamic object through near a puddle or scratch marks on a wall will have the decal appear on them.

I could specify one specific ID of the only object a decal appears on. I could use a filter system of bitwise flags to control the type of object a decal appears on.

Do you have any better ideas? What would be best for the end user?

10x Faster Performance for VR: www.ultraengine.com
Unless you only want to be able to post on ****ing Reddit, we should all get a GDNet+ subscription. It's not expensive.

Josh Klint said:
Sometimes they might appear only on a moving object, like a bullet wound in a character's leg

I know nothing about decals and what's current state of the art, but it might be an option to support them only for static geometry. If users want wounds, they would need to implement this themselves. Would make it much easier for you.

I have some concerns about the quoted example regarding mesh deformation.
Let's say you project a 2d decal to the leg. This means you have to apply skeleton skinning to the projector quad. But this won't be robust. If the leg is still moving, or the dead character is sliding down, or dragged by the player, etc., the decal will swim on the surface. Which is probably not acceptable in many cases.

A robust solution would be to modify the character textures just once on impact of the projectile.
Which has it's own problems, e.g. requiring unique textures for each character or creating duplicates on demand.

Advertisement

Not sure how you would get decals on objects as they move around in any decal system. But regardless if you are making a shooter game. You can either have each character have a unique texture in which you can 3D project/paint directly into the UV texture when blood comes from a certain angle (like how substance painter will project when painting). Or you can have a pre-made blood decal texture and for each character you can turn on certain parts of the texture to be shown. If you tag areas 1,2,3,4,5, you can send down a bitflag 0x10010 and test against the id. If the pixel passes,then allow the blood texture to mix over top of the characters base texture.

NBA2K, Madden, Maneater, Killing Floor, Sims

Btw, watching this may get you some ideas on how it can work on static scene geometry. You have a set of blood textures that can repeat. As more blood comes, you switch to the next blood texture. To get rid of tiling effect, you can have textures that have 100 blood around the edge to join with adjacent tiles. Deferred rendering also has some decal tricks.

NBA2K, Madden, Maneater, Killing Floor, Sims

I am going with the bitwise flags, and then if more is needed I will deal with it then.

10x Faster Performance for VR: www.ultraengine.com
Unless you only want to be able to post on ****ing Reddit, we should all get a GDNet+ subscription. It's not expensive.

This topic is closed to new replies.

Advertisement