Jump to content
  • Advertisement
Sign in to follow this  
Medo Mex

Bullet Impact on Mesh Edge

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

When the bullet impact billboard reaches the mesh edge, how do I make it appear like in the following screenshot? (Cut itself to fit on the mesh)

 

[attachment=17609:bullet_impact.png]

Share this post


Link to post
Share on other sites
Advertisement

This is how i do it, with help of physic library that i use, this is for static meshes, with dynamic it would be a bit different (never had time to try that also):
1. Get impact/hit point and face normal on that mesh
2. Create AABB based on decal size and that point
3. Get triangle list from AABB intersecting that mesh (in my case NewtonTreeCollisionGetVertexListTriangleListInAABB function)
4. Clip that triangles with AABB (search Sutherland-Hodgman algo for that), before that you could skip/discard triangles that are dot(hitFaceNormal, currentFaceNormal) < threshold
5. Generate uv coords, this i can't get right for now
6. Done

Edited by belfegor

Share this post


Link to post
Share on other sites

What kind of rendering/lighting pipeline do you use?

* Forward rendering? (lighting done in the shader on the object)

* Deferred shading? (lighting done as post-process using G-Buffer)

* etc...

Share this post


Link to post
Share on other sites

I know that he uses forward renderer, but i am interseted in other techniques for deferred one, and i see you have something interesting to write about that, so please share. biggrin.png

Share this post


Link to post
Share on other sites

I know that he uses forward renderer, but i am interseted in other techniques for deferred one, and i see you have something interesting to write about that, so please share. biggrin.png

 

I'm curious as well.

 

At one point I was dealing with a game what had highly detailed meshes used for rendering and exceptionally simplified meshes used for collision.  This meant the normal solution of projecting and clipping your decal against the collision geometry resulted a decal that was rarely consistent with the topology of the rendered object.  Obviously you can solve this by giving your decal system access to the render geometry for the purposes of projecting and clipping but this wasn't practical; the computational geometry code wanted triangles in a specific format that didn't mix well with rendering so there was a huge memory overhead.  Our render was deferred which meant easy access to the depth buffer and a normal buffer, for this reason the decision was made to render decals as boxes and use various tricks in the pixel shader to create the illusion of decals being projected onto the scene.  Essentially UV coordinates would be tweaked based on the result of a ray cast.  It worked fairly well but had some view dependent artifacts (sliding) that were distracting if you zoomed in on and rotated around a decal that had been projected onto a particularly complicated depth buffer topology.  There was also the issue of two dynamic objects overlapping, if one of the objects had a decal stuck to it in the region of the overlap the decal would appear on the other object; this only happened when the collision response was faulty so it wasn't that big a deal.

 

Anyway, waiting for Hodgman's insight...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!