How to create decal on geometry use GPU feature?

Started by
1 comment, last by Eric Lengyel 12 years, 6 months ago
Hi, I am trying to generate decals such as the bullet hole on a geometry, I read the article <[color=#222222][font=arial, sans-serif][size=2]Applying Decals to Arbitrary Surfaces[/font]> in[font="arial, sans-serif"] game programming gems 2, the article give the math method for picking triangles from geometry. But I think the method is a [/font][font=song, Verdana]

CPU-intensive process, can someone give me a method for better performance or use such as the graphic feature to do that?[/font]
[font="song, Verdana"]


[/font]
[font="song, Verdana"]

Thank you so much!
[/font]

[font="arial, sans-serif"]
[/font]

Advertisement
One thing that works quite well is just projected decals. Similar to deferred lighting, you create simple geometry to encompass your decal, then after GBuffer is made, do a pass where you draw these simple meshes, and apply decals based on gbuffer content, exactly like you would for a spotlight.
The method described in GPG2 is very efficient and practical. I've been using it for over ten years (since the time I wrote the article), and I've been extremely happy with it. It's important to realize that the polygon clipping only happens once, when the decal is created, so it's not like you're spending time building the decal every frame. It does not cause a performance problem. Managing the decal on the CPU also has certain advantages that you can't get in a GPU-only method. For example, suppose a decal was created on an object that later moves, like a door opening or a barrel rolling down a hill. If the portions of the decal applied to those objects inherit the transform properly, then the decals move with the objects they are attached to. Even if the transforms were communicated to the GPU, a deferred rendering technique would have a serious problem trying to distinguish between the geometries to which the decal should be applied and those that may be near the decal now but shouldn't have the decal applied to them.

This topic is closed to new replies.

Advertisement