Author Topic: Request: Explosion shader tweak  (Read 7345 times)

0 Members and 1 Guest are viewing this topic.

Offline Nighteyes

  • 211
Request: Explosion shader tweak
Hi guys :)
I assume you all know how when a capship propagates when dieing, the resulting explosions stack onto each other, creating a very bright\white effect, without really being able to see the details of the explosion itself...
this is caused because the game uses an "add" filter on the explosion, similar to the one in photoshop, now, if its possible to change the filter to something like "screen" filter(as in displaying the effect with its opacity, without intensifying it when on top of another effect) in photoshop, the explosions will look 10 times better :D

on a side note, is there a way of determining the time it takes the ship to propagate? the Colossus if I remember correctly took ages to finish propagating, but other ships propagated very fast...
Thanks :)

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Request: Explosion shader tweak
It doesn't use a shader for that...

And anyway, the problem is that in order to make them not add up the way they do, they'd have to be sorted and drawn in order from back to front (based on distance from the camera), which would eat up processor time. The current setup produces the same results regardless of the order the explosions are drawn in, and thus avoids the need to sort them.

Simply put, though, it's not as easy to do photoshop-like 2d blending as you might think.

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: Request: Explosion shader tweak
The time it takes is determined by either the hitpoints of the ship or the damage caused by the explosion of the ship.  I know the more damage an exploding ship does the longer it takes to explode (overrideable by the kamikaze flag).
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
It doesn't use a shader for that...

And anyway, the problem is that in order to make them not add up the way they do, they'd have to be sorted and drawn in order from back to front (based on distance from the camera), which would eat up processor time. The current setup produces the same results regardless of the order the explosions are drawn in, and thus avoids the need to sort them.

Simply put, though, it's not as easy to do photoshop-like 2d blending as you might think.
Well considering that it would "eat up" the processor in the same manner as using alpha mapped explosions, I don't really think its a factor, and as the ability to add alpha mapped effects was added to the code, I assume there is someone here that is familiar with how these things work :)
I know its not that simple,but as I said, we will have a much nicer game if possible :)

 
Re: Request: Explosion shader tweak
they'd have to be sorted and drawn in order from back to front (based on distance from the camera)

This will eat your processor. Also I'm not sure that the infrastructure for sorting that kind of effect currently exists.
STRONGTEA. Why can't the x86 be sane?

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
they'd have to be sorted and drawn in order from back to front (based on distance from the camera)
what I meant is keeping the way they are drawn out the same as it is now, as in all facing the camera, not based on distance, just remove the brighten filter thing :)
What I mean is use effects only based by their opacity, If we want certain explosions to look brighter, we can add the glow\adjust brightness when creating the explosion... not having the game force this brighting thing on us...
as it is now, it doesn't really matter what explosion I use, as we get to see mostly white centers, and only the outskirts of the actual explosion...
here is an example I made:

By gbtf67 at 2009-08-04

By gbtf67 at 2009-08-04

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Re: Request: Explosion shader tweak
Nighteyes, rendering explosions additive is very simple.

You don't have to sort them.
When two explosions overlap, on each pixel in the overlapping area, the color values from the corresponding pixels of the explosions will be added to the color of the pixel of the background.

The order doesn't matter. 1+2+3=6    2+3+1=6    3+1+2=6

Once there is alpha you have to sort them.
FS2 didn't really sort this stuff originally, afaik.

Taylor improved the sorting a lot already, but don't underestimate it.


With camera-facing sprites, it might still be "easy", but once you've odd-shaped alpha geometry, there will be some situations when it will be impossible to sort them right.

Just an example. Two meshes with an alpha texture intersect like this:


Now... the engine has to render one of them first and it will cover the other one.
Which one would you render first?  :drevil:


So much for the sorting.
The other thing you request sounds like a pretty complex shader+screen effect system.
It might be possible with just  a shader and a modified blending (not just additive) though.
« Last Edit: August 04, 2009, 12:52:18 pm by DaBrain »
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
When two explosions overlap, on each pixel in the overlapping area, the color values from the corresponding pixels of the explosions will be added to the color of the pixel of the background.
This is what I want to remove, I don't want them to add the color to the pixel under it... this is what creates the super bright explosions...

The other thing you request sounds like a pretty complex shader+screen effect system.
It might be possible with just  a shader and a modified blending (not just additive) though.
Yeah, a modified blending shader is what we need, modified to not add to the color :) no need for a complex screen effect :D
If this can be achieved... ahh... the pure beauty of what awaits... :D

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Re: Request: Explosion shader tweak
Well, the only things you can do without sorting are "add" ""subtract" and "multiply".

Once you mix them, you'll have to sort again...

--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
ahh so it looks like some sorting is in order... :(
how hard is it? maybe I can give it a go? where do I check stuff like this out? will someone be able to give this some time? :)

 

Offline Sushi

  • Art Critic
  • 211
Re: Request: Explosion shader tweak
It would have to be in the rendering engine. Something I don't feel like touching with a 10-foot pole at the moment. :p

To be fair, my motivation is low... as I've mentioned before, I like the stacking effect, since it makes for a sort of "poor man's bloom." I actually prefer the first screenshot mockup to the second one. :D


 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Request: Explosion shader tweak
Wait, that's a comparison? Yeah, I like the first one better, too. Until it was pointed out I didn't even see a difference.

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
sushi, you don't get what I'm saying, if we can fix this thing, we can create this fake bloom in a controlled manner, by just adding some glow to the effect...
those shots aren't good, the game generates much more explosions then I had in my test... as your a tough crowd, here are some test ingame...

Original explosion, without stacking... very natural, has depth and detail...

By gbtf67 at 2009-08-04

By gbtf67 at 2009-08-04



same effect stacked 20+ times in the game... superbright stacked explosion, no detail at all in the middle, just one big white blob, especially ugly when looking at a white blob filling half the screen... in motion its even worse, since all the middle part is white and static while the outer parts are moving...

By gbtf67 at 2009-08-04

By gbtf67 at 2009-08-04

 

Offline Sushi

  • Art Critic
  • 211
Re: Request: Explosion shader tweak
I understand that it allows for more artistic freedom (including bloomy effects) but my big worry is the computational complexity and overhead involved (what DaBrain was talking about). If it turns out that the cost is overstated, then I'll be as happy as anyone else. :D

In the meantime...maybe a MAX filter? Instead of adding the two values, it would simply take the brightest of the two and use that? That at least sounds easy (I'm not familiar with the rendering engine) and might give less washed-out results... anybody more familiar with rendering want to chip in on that?

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
hmm a MAX fillter? I can make one... but does the engine supports things like that?

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Request: Explosion shader tweak
So yeah, we've all been saying the same thing, and you've been ignoring it.

The reason we can't "not add them" is because any other blending alternative would require us to sort them based on depth.

And furthermore,

hmm a MAX fillter? I can make one... but does the engine supports things like that?

No, as I said in the first reply you got (or tried to explain, anyway), the engine does not support 'filters' period.

And the engine's support for alpha-blended explosion sprites seems to be shoddy anyway.

 

Offline Nighteyes

  • 211
Re: Request: Explosion shader tweak
I do understand that it will need to be sorted based on depth... similar to the way it does alpha blended explosions... only a bit differant...(always showing the brightest pixel)

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Request: Explosion shader tweak
just because photoshop or max can render something like that, doesn't mean the math can be done in real time fast enough to allow a playable frame rate. for example try working on a huge texture (were talking 4096^2 or bigger) on an average computer. you will be twiddling your thumbs for at least a couple seconds every time you change something.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Tomo

  • 28
Re: Request: Explosion shader tweak
I think you may have misinterpreted the 'MAX filter' statement.

I read that as meaning "For each pixel, if NEW_PIXEL brightness > CURRENT_VALUE, then CURRENT_VALUE := NEW_PIXEL"

That will automatically prevent the existing 'clamping to white', isn't dependent on processing order and doesn't actually require an Alpha channel at all.

However, I don't know how easy that is to implement.

 

Offline Krackers87

  • 158 crew
  • 29
Re: Request: Explosion shader tweak
Nighteyes, rendering explosions additive is very simple.

You don't have to sort them.
When two explosions overlap, on each pixel in the overlapping area, the color values from the corresponding pixels of the explosions will be added to the color of the pixel of the background.

The order doesn't matter. 1+2+3=6    2+3+1=6    3+1+2=6

This seems to simple to work but..
What if you averaged it?
1+2+3=6/3 = 2


Put this in your profile if you know someone who is fighting, has survived, or has died from an awp no scope.

just like seventies goofballs
he's waiting on last calls
well listen method man
'cause if you leave on the last line
don't leave on the ground kind
born just a little too slow