# Creating Bullet Holes

This topic is 1862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone,

How do I calculate the billboard transformation to make a bullet hole at certain point on a mesh?

The mesh can be complicated (building, vehicle, interiors, etc...), so I'm looking for a way to place the bullet hole billboard on the mesh at the point the player is shooting.

##### Share on other sites
hey
you can use a decal system like this

http://www.humus.name/3D/VolumeDecals.zip

##### Share on other sites
You can also take a look at this one:
[url="http://blog.wolfire.com/2009/06/how-to-project-decals/"]http://blog.wolfire.com/2009/06/how-to-project-decals/[/url]

##### Share on other sites
I'm not looking to use shader now, is there is anyway to calculate the billboard position and vertex position information to set the billboard transformation according to that?

##### Share on other sites
1- "p" is your intersected point

2- "v1,v2,v3" are your intersected face vertices

3- "N" is your face normal or you can calculate it from your vertices
{
A = v2 - v1
B = v3 - v1
N = normalize( cross( A , B ) )
}

4- Calculate your Up and Right vector
{
up = normalize( p - v1 )
right = cross( up , N )
}

{
Q1 = p + up * scale
Q2 = p - up * scale
Q3 = p + right * scale
Q4 = p - right * scale
} Edited by stc.5421

##### Share on other sites
@stc.5421: What about the billboard rotation?

##### Share on other sites
You don't need it , that create a quad align to the mesh face . Edited by stc.5421

##### Share on other sites
this is a d3d10 sample, why is do you give him d3d10 code?, plus its not even the full source code...

##### Share on other sites
@stc.5421: I have LPD3DXMESH, how can I calculate the face normal, face vertices?

##### Share on other sites
Did you do intersect to your mesh by D3DXIntersect function?

##### Share on other sites
No, I'm using Bullet Physics Raytest.

##### Share on other sites
And what's your problem right now?
Can you get information from RayResultCallback ?

##### Share on other sites
Can I get the face normal and face vertices from ClosestRayResultCallback? I'm trying to get them to use the example you gave above.

##### Share on other sites
Sorry for delay , use this:

##### Share on other sites
Hi stc.5421,

I will be using D3DXIntersect() instead, how can I get the intersected face vertices when I use D3DXIntersect()?

Also, where normalize() and cross() are located? Do you mean btVector3::normalize() and btVector3::cross()? Edited by Medo3337