Jump to content

  • Log In with Google      Sign In   
  • Create Account

Creating Bullet Holes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
15 replies to this topic

#1 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 05 December 2012 - 09:47 PM

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.

Sponsor:

#2 stc.5421   Members   -  Reputation: 119

Like
0Likes
Like

Posted 06 December 2012 - 02:23 AM

hey
you can use a decal system like this

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

#3 mk1x86   Members   -  Reputation: 442

Like
0Likes
Like

Posted 06 December 2012 - 05:36 AM

You can also take a look at this one:
http://blog.wolfire.com/2009/06/how-to-project-decals/

#4 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 06 December 2012 - 07:18 AM

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?

#5 stc.5421   Members   -  Reputation: 119

Like
2Likes
Like

Posted 06 December 2012 - 09:11 AM

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 )
}

5- "Q1,Q2,Q3,Q4" are your Quad vertices and can calculate like this
{
Q1 = p + up * scale
Q2 = p - up * scale
Q3 = p + right * scale
Q4 = p - right * scale
}

Edited by stc.5421, 06 December 2012 - 09:20 AM.


#6 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 06 December 2012 - 11:32 AM

@stc.5421: What about the billboard rotation?

#7 stc.5421   Members   -  Reputation: 119

Like
0Likes
Like

Posted 06 December 2012 - 12:06 PM

You don't need it , that create a quad align to the mesh face .

Edited by stc.5421, 07 December 2012 - 02:23 AM.


#8 Anddos   Members   -  Reputation: 520

Like
0Likes
Like

Posted 06 December 2012 - 03:11 PM

this is a d3d10 sample, why is do you give him d3d10 code?, plus its not even the full source code...
:)

#9 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 07 December 2012 - 01:55 AM

@stc.5421: I have LPD3DXMESH, how can I calculate the face normal, face vertices?

#10 stc.5421   Members   -  Reputation: 119

Like
0Likes
Like

Posted 07 December 2012 - 02:23 AM

Did you do intersect to your mesh by D3DXIntersect function?

#11 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 07 December 2012 - 02:51 AM

No, I'm using Bullet Physics Raytest.

#12 stc.5421   Members   -  Reputation: 119

Like
0Likes
Like

Posted 07 December 2012 - 10:37 AM

And what's your problem right now?
Can you get information from RayResultCallback ?

#13 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 07 December 2012 - 10:47 AM

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

#14 stc.5421   Members   -  Reputation: 119

Like
0Likes
Like

Posted 08 December 2012 - 12:31 PM

Sorry for delay , use this:

http://bulletphysics.org/Bullet/phpBB3/download/file.php?id=588

Edited by stc.5421, 08 December 2012 - 12:32 PM.


#15 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 09 December 2012 - 08:07 PM

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, 09 December 2012 - 08:26 PM.


#16 Medo3337   Members   -  Reputation: 680

Like
0Likes
Like

Posted 15 December 2012 - 06:11 AM

Any update guys? I still didn't resolve the issue.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS