Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Knife scratch and bullet holes in CSS


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 lanceking   Members   -  Reputation: 126

Like
0Likes
Like

Posted 10 October 2004 - 04:46 PM

I wonder how to implement knife scratch and bullet holes just like what is in counter strike source? Anyone can give me any ideas so I can start? Many thanks!!

Sponsor:

#2 Mushu   Members   -  Reputation: 1396

Like
0Likes
Like

Posted 10 October 2004 - 04:48 PM

I thought it was done with decals - basically textured quads slapped over the surface where the bullet/kinfe hit.

Just a random guess, though.

#3 Boku San   Members   -  Reputation: 428

Like
0Likes
Like

Posted 10 October 2004 - 04:57 PM

Uh, no. It's totally done with ublar l337 deformable terrain that you can shoot a rocket launcher at and break out a wall because it's such a ubl4r l33t engin3.

...Actually, Mushu's right. It's a decal, layered onto the background. If you set max decals to 0, you won't even see them.

Things change.

#4 lanceking   Members   -  Reputation: 126

Like
0Likes
Like

Posted 11 October 2004 - 08:08 PM

Quote:
Original post by Boku San
Uh, no. It's totally done with ublar l337 deformable terrain that you can shoot a rocket launcher at and break out a wall because it's such a ubl4r l33t engin3.

...Actually, Mushu's right. It's a decal, layered onto the background. If you set max decals to 0, you won't even see them.


Yeah, it is decals. I was fooled by my eyes again...
Then how to make the glass window? It seems shape of the
hole is random.

#5 Cypher19   Members   -  Reputation: 768

Like
0Likes
Like

Posted 12 October 2004 - 01:59 AM

I think the glass gets decomposed into a series of quads with a texture that uncludes full transparencies.

One thing I'd like to see though, is on metallic materials, have a decal that isn't just a black dot but is a normal map showing an indentation, so that the bullet dent is seen with just bump mapping and specular lights.

#6 LucidIon   Members   -  Reputation: 198

Like
0Likes
Like

Posted 12 October 2004 - 03:44 AM

A simple way to have 'random' holes, is to have a few decals and use one randomly whenever you need one (if you use decals, remember to clip them, so you don't have bits hanging off the edges of scenery.)

#7 Dominicds   Members   -  Reputation: 122

Like
0Likes
Like

Posted 12 October 2004 - 04:59 AM

In CS: Source, the decals such as bullet holes and spray paint can be stretched accross multiple quads. How is this effect implemented?

#8 Boku San   Members   -  Reputation: 428

Like
0Likes
Like

Posted 12 October 2004 - 05:02 AM

I'm not sure what you mean by that, Dominicds.

I was in the Beta of CS:S, but now I happen to be too broke to buy it (well...more like not willing to spend money until HL2 reviews come out), so...a picture would be nice.

EDIT: It looks like you had some pictures...did you link them incorrectly (referring to deleted post)?

[Edited by - Boku San on October 12, 2004 12:02:48 PM]

Things change.

#9 onnel   Members   -  Reputation: 124

Like
0Likes
Like

Posted 12 October 2004 - 06:26 AM

Any suggestions on easy ways to clip the decals? Or to bend them around corners where they lay on multiple faces?

Onnel

#10 Dominicds   Members   -  Reputation: 122

Like
0Likes
Like

Posted 12 October 2004 - 06:27 AM

Quote:
Original post by Boku San
I'm not sure what you mean by that, Dominicds.


Yeah, now I realize I wasn't very clear, maybe these images will clear things up a bit.


The bullet hole decal is mapped onto both sides of the pillar.


The "No War" spray paint is mapped onto both the ground and the stump.

#11 scgames   Members   -  Reputation: 2012

Like
0Likes
Like

Posted 12 October 2004 - 06:51 AM

Quote:
Any suggestions on easy ways to clip the decals? Or to bend them around corners where they lay on multiple faces?


The best reference I know of on this is Eric Lengyel's article 'Applying Decals to Arbitrary Surfaces' in GPG2. The book also comes with code for the implementation on a CD. My decal system is based on this method, and it works great.

The basic idea is as follows. You construct the decal from an intersection point (i.e. where a bullet hits) and the surface normal at that point. From this info you create a rectangular volume centered on the intersection point and aligned with the normal. The width and height of the volume are the desired width and height of the decal, and the depth is chosen as appropriate to include the appropriate polygons.

Then what you do is take each surface that intersects this volume, and add its triangles to the decal one by one. As the triangles are added, they are clipped to the volume so that only the portions inside the volume remain.

What you are left with is a decal surface that perfectly follows the contour of the surfaces it affects. You can then use the z-tweaking method of your choice to avoid z-fighting.

The implementation is a little involved, but it's not too bad. If you don't have GPG2, I highly recommend picking it up for the source code if nothing else.

#12 Dominicds   Members   -  Reputation: 122

Like
0Likes
Like

Posted 12 October 2004 - 07:09 AM

Quote:
Original post by jyk
... Smart stuff...


So is this a multi-texturing effect rather than a texture mapped quad?

#13 scgames   Members   -  Reputation: 2012

Like
0Likes
Like

Posted 12 October 2004 - 09:32 AM

Quote:
So is this a multi-texturing effect rather than a texture mapped quad?


If you're refering to the Lengyel method, no, it doesn't use multitexturing. Multitexturing would require that the exact input tris be used, but in this case the tris must be clipped to get the right results.

Also, it's only a quad in the simplest case, i.e. a flat surface with no clipping. In the general case, it's a mesh of tris that maps to the underlying surface.

Not sure if I answered your question, though...

#14 Mussi   Crossbones+   -  Reputation: 2293

Like
0Likes
Like

Posted 12 October 2004 - 11:13 AM

Maybe a good idea to check for the 3 closest point on the 3 triangle-edges, if a point lies in the bullet-hole area then check which triangle shares the same edge, where the point was on, and put another decal on that point facing it to the normal of that triangle. should work too

#15 LucidIon   Members   -  Reputation: 198

Like
0Likes
Like

Posted 12 October 2004 - 03:46 PM

To get stuff on to multiple surfaces you clip the decal to each of the multiple surfaces. You can see Quake 3 doing this with triangle outlining on (/r_showtris 1), I'm sure there are similar commands for other games. There's a tutorial on decals over at flipcode, although the links to the example images and the source code are unfortunately broken.

#16 Madster   Members   -  Reputation: 242

Like
0Likes
Like

Posted 14 October 2004 - 02:07 PM

Quote:
Original post by Cypher19
One thing I'd like to see though, is on metallic materials, have a decal that isn't just a black dot but is a normal map showing an indentation, so that the bullet dent is seen with just bump mapping and specular lights.


Actually, what i'd like to see is decals with bumpmapping+parallax mapping, so they would have depth, and actually look like a hole.
Should be coded just like a regular decal, but with a nice shader.
I wonder if anyone has tried that yet... there were talks of "geometry decals" a while ago to carve smallish holes in walls, but parallax makes it much simpler.




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