Author Topic: Weapon impact decal test builds  (Read 16497 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
Weapon impact decal test builds
Apparently there has been a decal implementation in FSO before but that got removed again for some reason. This new decal system should work better and more importantly should work for the foreseeable future. This new system is based on our deferred renderer infrastructure which makes it very easy to render decals onto arbitrary geometry. Here are the test builds: http://swc.fs2downloads.com/builds/test/decals/

Typically these decal system would also allow to change the normal data of the surface where the decal is created but due to the way the rendering engine of FSO works at the moment that is not possible to implement. Once this initial version is integrated into FSO I will take a look at how the engine can be changed in order to allow normal mapped decals to be implemented.

The integration of the decals into the engine is quite limited at the moment since I first wanted to actually have a working system before adding more elaborate features. The builds introduce a new decal table type. There is no main table so you have to use modular tables that are named <something>-dcl.tbm. At the start of the table you need a #Decals and terminate that with #End at the end of the file. After that you can add as many decals as you like with $Decal.

After $Decal you need to specify the name of the decal definition e.g. $Decal: TestDecal.

+Diffuse: This specifies the texture or animation that should be used as the color channel of the decal. Currently there is no other channel but more features will be added in the future.

+Loop: This lets you specify if the animation should reset once it reached its last frame or stay on that last frame.

The only option currently supported is +Diffuse which specifies what diffuse texture should be used for this decal. This may be an animation.

Here is a complete table that I used for testing:
Code: [Select]
#Decals

$Decal: TestDecal
+Diffuse: ExpMissileHit1
+Loop: False

#End

To use that decal as the impact decal of a weapon you need to add $Impact Decal after the location where the engine expects $Shots:. You specify both which decal you want to use and how big the decal should be in the game world like this:
Code: [Select]
$Impact Decal: TestDecal
 +Radius: 20
 +Lifetime: (1.0 5.0)

+Lifetime specifies for how long the decal should stay around after being created. You can specify the range of possible values by using two values. The lifetime of each individual decal will then the chosen within that range. You can also specify the string "Eternal" (I'm still searching for a better term here so let know if you know one) if the decal should never vanish. This should only be used for very important effects since every decal uses some performance so too many will cause FPS issues.

As soon as that weapon hits a ship (it only works for ships at the moment) it will spawn the decal. The decals do not expire at the moment so performance will probably suffer if too many decals are created.

Please let me know if you find any bugs and while you are here, please let me know how this system should be integrated into FSO.
« Last Edit: October 15, 2017, 11:36:31 am by m!m »

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Weapon impact decal test builds
I'd like to test, if you could add the soundsets to this build.
Because my sounds.tbl is already too far mutated now, to use build's that don't have it  :p

(so close to adding dlc to the game)
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker- you've probably heard me
    • My old squad sub-domain
Re: Weapon impact decal test builds
And one day......geomod.
#holygrail
Campaigns I've added my distinctiveness to-
- Blue Planet: Battle Captains
-Battle of Neptune
-Between the Ashes 2
-Blue planet: Age of Aquarius
-FOTG?
-Inferno R1
-Ribos: The aftermath / -Retreat from Deneb
-Sol: A History
-TBP EACW teaser
-Earth Brakiri war
-TBP Fortune Hunters (I think?)
-TBP Relic
-Trancsend (Possibly?)
-Uncharted Territory
-Vassagos Dirge
-War Machine
(Others lost to the mists of time and no discernible audit trail)

Your friendly Orestes tactical controller.

Secret bomb God.
That one time I got permabanned and got to read who was being bitxhy about me :p....
GO GO DEKKER RANGERSSSS!!!!!!!!!!!!!!!!!
President of the Scooby Doo Model Appreciation Society
The only good Zod is a dead Zod
NEWGROUNDS COMEDY GOLD, UPDATED DAILY
http://badges.steamprofile.com/profile/default/steam/76561198011784807.png

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
I'd like to test, if you could add the soundsets to this build.
Because my sounds.tbl is already too far mutated now, to use build's that don't have it  :p
Here are your special builds: https://www.mediafire.com/file/t3kw3w1c8i949x6/specialSpoonBuilds.7z

I changed the syntax of $Impact decal a bit so now it needs to look like this:
Code: [Select]
$Impact Decal: TestDecal
+Radius: 20

And one day......geomod.
#holygrail
Uhh, I'll let other people implement that because that's actually hard to do...  :warp:

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Weapon impact decal test builds
Crashes a the start of a mission with normal build, with a debug its crashes when firing:


Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
I just encountered something similar to that myself. I'm not sure why that suddenly happened...

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Weapon impact decal test builds
Does it work on beams yet?
The Trivial Psychic Strikes Again!

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
No, it only works on weapons right now and beams will be very hard to implement since they move across the surface of the target so a single decal will not look right.

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
I think I fixed the crash described by Spoon. The builds in the first post have been updated. Those builds also include the sound set changes.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Weapon impact decal test builds

Well, it doesnt crash anymore at least.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
 :banghead: I forgot to remove the debug code from the shader again but at least that shows that the decal rendering is working correctly. The builds from the first post have been updated and should now render the correct textures.

What GPU are you using? I could only test this with AMD hardware so I would like to make sure that it also works with Nvidia and Intel.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Weapon impact decal test builds
Geforce GTX760 here


Can truely produce works of art with this

There should probably be some degree of culling, be it life time or maximum number of decals. Possibly defined per $decal?
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
As I mentioned in the first post, this is mostly a tech-demo for testing if the decal rendering works reliably. Since rendering the decals seems to be working now we can discuss how to integrate the decals into the engine properly.

I will definitely add a maximum life for most decals but I would also like to add support for "permanent" decals which would also have better integration with the rest of the engine, e.g. by adding scripting access to these permanent decals. Another feature that could be useful could be time based scaling of the decal radius. If the decal is supposed to simulate a burning hull then it could be scaled down the longer it is present until it is gone completely.

I would like to avoid having a maximum number of decals since removing old decals would introduce ugly effects when a decal suddenly disappears.

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
I added support for specifying the lifetime of a decal and added documentation on how to use that to the first post.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Weapon impact decal test builds
The original decal system was of a black charred spot with a fuzzy edge and transparency.  I also believe that it was discussed using a glowmap to give a burn glow, that lasted only a few seconds after impact.
The Trivial Psychic Strikes Again!

 
Re: Weapon impact decal test builds

Looks ok on nvidia :p


On Intel on windows not
« Last Edit: October 15, 2017, 07:00:07 am by tomimaki »

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
The original decal system was of a black charred spot with a fuzzy edge and transparency.  I also believe that it was discussed using a glowmap to give a burn glow, that lasted only a few seconds after impact.
Since you can use any texture you like with the new system this should already be supported by using an animation appropriate for the effect.

<snip>
On Intel not
Thank you for testing. Unfortunately, I have no easy way of debugging this with Intel so until I find a way to reproduce this somehow I won't be able to fix it.

 
Re: Weapon impact decal test builds
Well atleast, Intel and Nvidia on Linux works. ;)

 

Offline m!m

  • 211
Re: Weapon impact decal test builds
That's good! I can blame the Windows driver since the hardware obviously supports it if Intel works :p

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Weapon impact decal test builds
The original decal system was of a black charred spot with a fuzzy edge and transparency.  I also believe that it was discussed using a glowmap to give a burn glow, that lasted only a few seconds after impact.
Since you can use any texture you like with the new system this should already be supported by using an animation appropriate for the effect.
Would need an function to define if the animation plays only once or loops though. A looping fading glowmark doesn't look so great.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them