Sign in to follow this  
cubicwang

How to create decal on geometry use GPU feature?

Recommended Posts

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 [i]Decals[/i] to Arbitrary Surfaces[/size][/font][/color]> in[font="arial, sans-serif"][size="2"] game programming gems 2, the article give the math method for picking triangles from geometry. But I think the method is a [/size][/font][font=song, Verdana][size=4]CPU-intensive process, can someone give me a method for better performance or use such as the graphic feature to do that?[/size][/font]
[font="song, Verdana"][size=4]
[/size][/font]
[font="song, Verdana"][size=4]Thank you so much!
[/size][/font]

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this