PDA

View Full Version : Rendering damaged walls/objects



chronozphere
28-01-2007, 07:34 PM
Hi guys :)

At the moment i'm playing Half life 2 and i must say that it's the best game i've played so far. :) Especially the graphics and the physics are great. When you try to destroy/damage something with e.g my crowbar, a hole appears in the object.
the HL2 engine uses parallax-mapping to make these holes look realistic (with real depth, while it's just a flat texture). :)
So that raises a question:
How can i add damage to an object. (doesn't need to be with parallax-mapping). Just a hole that appears on the 'damaged place'.
How do they do that?? Is it some kind of multitexturing??

Can someone explain this?? :?

JSoftware
28-01-2007, 08:01 PM
What you are looking for is decals

I saw a very good (but mathy) article a few years ago which I sadly can't find anymore, but this might also be a solution: http://www.gamedev.net/reference/articles/article1986.asp

chronozphere
04-02-2007, 11:22 AM
So it's not just texturing... polygons and triangles also need to be modified isn't it??

Pitty there aren't much articles on this :( The simple/beginner stuff is very well documented, but when you want to get further.... :?

P.S Gamedev.net is down :x Stupid hackers... why on earth hack Gamedev.. what's the point :?

Sly
04-02-2007, 10:32 PM
HL2 still uses flat decals to render "holes" in walls. No polygons are modified. The texture on the decal makes it look like it has taken a chunk out of the wall, but it is just a visual illusion. If you hit a wall enough times, you will see the first "holes" start disappearing as it recycles decals.

chronozphere
05-02-2007, 05:56 PM
Okay... that technique was called 'parallax mapping'.. isn't it;)

But i've one question:

How can i map a texture on a wall at a specific location.
The decals aren't tiled in any way... so how to position them on a mesh??? Do i need to use textures with transparent borders, and stretch the borders so the rest of the object seems untextured??
Are there other methods? :?

JSoftware
05-02-2007, 06:55 PM
You'll have to know the normal of the face of the mesh that the decal will cover.
With that you can create a new plane which your decal will reside on. This plane however must be a bit displaced so it will not be culled by depth. Or you could disable depth testing when you draw the new quad on the plane.

You will ofcourse need an alpha mask or colorkey transparency to make the decal fade correct with the mesh

chronozphere
05-02-2007, 07:56 PM
Yeah i get it ;) and when a grenade explodes in the corner of a room, a smart algorithm should create a decal mesh that covers e.g a piece of the floor, the front and the right wall. isn't it.

Things will get a lot harder when the decal must be mapped on different objects e.g the terrain and a rock. Apperantly you should create an algo that determins the most important mesh(es) to apply the decal on.
But i dont think there are any multi-object-decal games/engines around yet... because it must be very computational intensive.
Having nice 'parallax-mapped' decals like HL2 does, seems sufficient to me. :)

JSoftware
05-02-2007, 07:57 PM
Actually I was talking about a paper which would explain computionally inexpensive clipping of decals over complex geometry

chronozphere
05-02-2007, 08:43 PM
The gamedev article?? i've quickly looked at it when you posted.
I initialy thought the article was about changing existing geomitry (creating holes/damage in the mesh). :oops:

Unfortunatly i cant take a look at it because Gamedev is down for a few days :(
bloody hackers :x

JSoftware
05-02-2007, 08:47 PM
No not that one. I couldn't find the other article. It might reside on gamasutra but I can't remember anymore...