Author Topic: How to implement damage Decals on ships  (Read 7654 times)

0 Members and 1 Guest are viewing this topic.

How to implement damage Decals on ships
Currently I've managed to think of two ways to do this though my relative inexeprience with 3D programming means it would take me ages to implement them.

The first is the traditional method where we draw a whole lot of blended polygons textured and blended with the decal. This has a number of problems - beam cannons leave a lot of decals, and ships take a lot of hits so this method would very rapidly pile up the poly count of a scene.

The second method would be to not actually use polygons but instead dynamically modify the textures of the ships themselves. This has a lot of problems though since textures are shared in memory across several models and in different parts of a model. However, it involves no extra poly's but it will need a creative way around the problem of shared textures and such.

So, does anyone have any additional solutions or refinements on my proposed two methods?

 

Offline Sandwich

  • Got Screen?
  • 213
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Brainzipper
How to implement damage Decals on ships
Uhm, yeah - the way it's always been done in games: paste on a new decal where a weapon hit occurs - oveerlaid on the ships texturing. No need for extra polys.
SERIOUSLY...! | {The Sandvich Bar} - Rhino-FS2 Tutorial | CapShip Turret Upgrade | The Complete FS2 Ship List | System Background Package

"...The quintessential quality of our age is that of dreams coming true. Just think of it. For centuries we have dreamt of flying; recently we made that come true: we have always hankered for speed; now we have speeds greater than we can stand: we wanted to speak to far parts of the Earth; we can: we wanted to explore the sea bottom; we have: and so  on, and so on: and, too, we wanted the power to smash our enemies utterly; we have it. If we had truly wanted peace, we should have had that as well. But true peace has never been one of the genuine dreams - we have got little further than preaching against war in order to appease our consciences. The truly wishful dreams, the many-minded dreams are now irresistible - they become facts." - 'The Outward Urge' by John Wyndham

"The very essence of tolerance rests on the fact that we have to be intolerant of intolerance. Stretching right back to Kant, through the Frankfurt School and up to today, liberalism means that we can do anything we like as long as we don't hurt others. This means that if we are tolerant of others' intolerance - especially when that intolerance is a call for genocide - then all we are doing is allowing that intolerance to flourish, and allowing the violence that will spring from that intolerance to continue unabated." - Bren Carlill

 
How to implement damage Decals on ships
As I understand it not quite otherwise why would we have decal limits? Each decal is a sprite and a sprite has to be drawn on to a polygon - its just blended so only the 2D sprite is visible. The polygon then sits at a certain point on the model. Hence why in some FPS's you can get decals sitting off the walls sometimes.

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
How to implement damage Decals on ships
Quote
Originally posted by ##UnknownPlayer##
As I understand it not quite otherwise why would we have decal limits? Each decal is a sprite and a sprite has to be drawn on to a polygon - its just blended so only the 2D sprite is visible. The polygon then sits at a certain point on the model. Hence why in some FPS's you can get decals sitting off the walls sometimes.


no, that's not the way it works: look at the shield effect for exemple. A decal would be a bitmap, that's all, but instead of being projected as a 2D bitmap (like engine glows), with only Z scaling, the bitmap will use the normals of the poly were it is applied ( note that it won't use the UV projection of the map applied to this poly ), which will give it rotation and scaling on all the axis, making it look really 3D ( which it is not I think ).
SCREW CANON!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
How to implement damage Decals on ships
decals are handeled in a completly diferen't way, there more like the sheild hit effect, exept they arn't animated (although it would be cool to have a few that were and the last frame was held as a normal decal), and they are blended onto the existing textured polys not the untextured sheild mesh
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
How to implement damage Decals on ships
Quote
Originally posted by Bobboau
and they are blended onto the existing textured polys not the untextured sheild mesh


nah, otherwise, they'd be stretched. In other games like FPS, maps aren't usually applied on perfect square surfaces, and still they are generally square (256*256 etc). If it was blened on the maps, the decal would be completly deformed most of the time.
SCREW CANON!

 

Offline delta_7890

  • Your Node Is Mine
  • 28
How to implement damage Decals on ships
Didn't they implement this feature in XWA?
~Delta

 
How to implement damage Decals on ships
Quote
Originally posted by sandwich
Uhm, yeah - the way it's always been done in games: paste on a new decal where a weapon hit occurs - overlaid on the ships texturing. No need for extra polys.


That is generally how it's done. There are decal limits because each poly that has decals that need to be applied has to have its texture stored seperately, instead of sharing textures as the program would in a normal situation. This dramatically increases the amount of memory required.

 

Offline Grey Wolf

How to implement damage Decals on ships
In Bridge Commander, it took a certain amount of damage at the point to cause a damage decal. If it continued to get hit there, the hull is "burned" away and a separate mesh is shown through the hole in the outer mesh. This caused some pretty interesting effects, like a Galaxy-class with it's forward torpedo tube are burned away or with a large chunk of it missing on the back.
You see things; and you say "Why?" But I dream things that never were; and I say "Why not?" -George Bernard Shaw

 
How to implement damage Decals on ships
Ok, well I doubt we''re going to be putting something like geo-mod in any time soon so let's focus on how we should do decals.

EDIT: People I did some research and it turns out that I'm right and your wrong. Yes we do just paste a decal there, but the decal as I said has to be pasted onto a new polygon (a square to be precise) that gets sized to be no larger then the face the decal is going onto. For more info go here: http://www.flipcode.com/tutorials/tut_decals.shtml
« Last Edit: May 11, 2002, 08:10:48 pm by 383 »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
How to implement damage Decals on ships
that is A "simple way to do it"
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
How to implement damage Decals on ships
Still, if you'll note the end it is also the way Quake III does it and I imagine that the id guys would know a thing or to. Still, I'll keep looking for examples of other methods but as far as I know this is the most common (thought that could be coz Quake engine games are among the most common).

 

Offline LAW ENFORCER

  • Turret Fiend
  • 210
    • http://www.armouredstar.com
How to implement damage Decals on ships
I don't know if some one said this but couldn't you make a special map of the ship (damage) then weapon hits would 'uncover' the map so a long line of damage wouldn't be just a line of damage decals???
Conflict GRDLA:
Operation Return To Riker
www.ARMOUREDSTAR.com - the latest site is not finished yet!
[What we have here is the source to the Freespace ENGINE, not the Freespace GAME. By allowing the ENGINE to support all kinds of cool stuff, we're allowing the creation of all new GAMES] - TurboNed

 
How to implement damage Decals on ships
Hmm...its possible. The easiest way to do it would be to just chnage the texturing of individual polygons. Problem is it would have to be solid otherwise it might not create the right effect for weapons. And on capchips we'd have issues....

 
How to implement damage Decals on ships
Quote
Originally posted by ##UnknownPlayer##
Still, if you'll note the end it is also the way Quake III does it and I imagine that the id guys would know a thing or to. Still, I'll keep looking for examples of other methods but as far as I know this is the most common (thought that could be coz Quake engine games are among the most common).


That is the most common method of doing it. I had thought it was pasted on the original poly (it actually is in some games), but that requires more texture memory, so they avoid that nowadays by using the method you said, because it allows both the original textures and the decal textures to be in memory only once. The drawback is that it increases the poly count, but unless there's a LOT of decals, it isn't likely to matter.

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
How to implement damage Decals on ships
Quote
Originally posted by Mysterial


That is the most common method of doing it. I had thought it was pasted on the original poly (it actually is in some games), but that requires more texture memory, so they avoid that nowadays by using the method you said, because it allows both the original textures and the decal textures to be in memory only once. The drawback is that it increases the poly count, but unless there's a LOT of decals, it isn't likely to matter.


a lot, indeed. a quad= 2 polys :p
SCREW CANON!

 
How to implement damage Decals on ships
The polycount thing is the problem - beams cannons would leave A LOT of decals on a ship so we'd probably want to cull them and tile the decal across just one or something, which would be a fairly complex thing to do. Then we've also gotta handle hits from fighters, which there are several thousand in any given mission where we attack capships. Lots of code would be needed to intelligently handle them.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
How to implement damage Decals on ships
we'd want to handel beams diferently, like takeing the start and end points and have a few specal beam decal textures
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
How to implement damage Decals on ships
Really good idea there! I hadn't thought of that.

 

Offline daveb

  • WHEE!!
  • 25
How to implement damage Decals on ships
There are two ways to approach this problem in general.

- Paste-on decals. You project a rectangular or cone shaped volume onto the model and generate vertices where the volume clips against the polys of the model. In theory this is the "best" way to do it since you're generating the smallest possible polys for the decals. But it suffers from the venetian blind problem. That is, because the vertices of the decal poly aren't the same as the vertices of the poly its being drawn on top of, inaccuracies in the 3d rotation/projection code will cause them to have slightly inconsistent Z values. So the two of them will end up "fighting" for the zbuffer in a view-dependant manner.  There are 2 fixes for this. First is to use the "z bias" setting available in D3D. The squad logos use this to work properly. Alternately, you can multiply 1/z value of each of the projected verts by some slightly-greater-than-1 value to fake their depth "out" of the wbuffer. For small decals (where "small" means small onscreen) this is the preferred method. But if you do this for blast decals which could be applied to, say, the side of a capital ship, they could potentially end up very large onscreen. In this case, you'd need to use a larger value to mess with the 1/z depth and that's going to result in really ugle view-dependant warping of the decal. Which brings us to method 2 :

- Multi-pass decals. As with the paste-ons you're projecting a 3d volume onto the model and "clipping" it against each relevant face. But the difference here is that instead of calculating vertex points, you just calculate texture UV's to map the decal texture onto the existing model verts. Kind of like a lightmap. As long as you draw the decal face with clamping enabled, you're all good. The main advantage is that you'll never have zbuffer fighting. The main disadvantage is that you're going to end up drawing more pixels per decal. In theory this could eat away framerate. But on newer 3d cards, maybe that's not an issue.

I'm not sure which I'd use in this particular case. If I were going to implement this for a "real" game in this circumstance, I'd probably go with method 2 and impose some hard limits on the # of decals per ship or something like that, to make sure fillrate doesn't skyrocket.