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

0 Members and 1 Guest are viewing this topic.

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Request: Explosion shader tweak
Then around the edges of explosions (where it's black), you'd be darkening stuff from whatever brightness it was to half that brightness. It would look crazy.

 

Offline Krackers87

  • 158 crew
  • 29
Re: Request: Explosion shader tweak
Then around the edges of explosions (where it's black), you'd be darkening stuff from whatever brightness it was to half that brightness. It would look crazy.

.... then dont count zeros? or lower than any number not considered visable?
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

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Request: Explosion shader tweak
Well then, it's no longer the 'simple' formula you proposed.

 

Offline Tomo

  • 28
Re: Request: Explosion shader tweak
Per-pixel Maximum function as suggested by Sushi is relatively computationally cheap, but I'm not sure how it'll look in practice.

- I don't think Photoshop has that filter, so it's hard to try out.

 

Offline Krackers87

  • 158 crew
  • 29
Re: Request: Explosion shader tweak
Well then, it's no longer the 'simple' formula you proposed.
why not? just ignore the values? just add a ( x >= y) before the average. or you can still ad 0's just divide the average by the visible pixels present, for example, lets say we have 5 pixels; 1, 3, 3, 0, 0,

if n<=0    then, y+1, x+1
if n>0 then, x+1
(1+3+3+0+0)/(X-y)

X = total intergers added to average
y = intergers equal to or less than 0

or if its simpler, change the equation to take out 0's without ever averaging them in the first place.
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

 

Offline Aardwolf

  • 211
  • Posts: 16,384
Re: Request: Explosion shader tweak
Well then, it's no longer the 'simple' formula you proposed.
why not? just ignore the values? just add a ( x >= y) before the average.

I believe that would require depth sorting. But it's the best I've heard so far, actually.

or you can still ad 0's just divide the average by the visible pixels present, for example, lets say we have 5 pixels; 1, 3, 3, 0, 0,

if n<=0    then, y+1, x+1
if n>0 then, x+1
(1+3+3+0+0)/(X-y)

X = total intergers added to average
y = intergers equal to or less than 0

or if its simpler, change the equation to take out 0's without ever averaging them in the first place.[/color]

AFAIK that's not (easily) possible, because there's no (easy) way to keep track of all of the colors drawn to a certain pixel. At least, not without all-out support for deferred rendering, and even then I don't know.

 

Offline Dark RevenantX

  • 29
  • anonymity —> animosity
Re: Request: Explosion shader tweak
What stops you from sorting depth by order of effect creation?  Or is the system already so f--ked up that something that hackish is still a royal pain in the balls.

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Steam
    • Twitter
    • ModDB Feature
Re: Request: Explosion shader tweak
So far as I know, we don't have depth sorting of any kind right now. See Mantis 1583
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Request: Explosion shader tweak
for particles and weapon effects there is no sorting, they are drawn more or less in the order they were first created, IIRC.

interestingly the SHIPS could be drawn sorted relatively easily if the internal geometry format was just a tiny bit more flexible.
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 Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: Request: Explosion shader tweak
Depth sprites are usually used by most game engines today to make explosions seem rounder/ clip to the surrounding geometry spherically. It's a pretty simple concept, get a pre rendered depth map of a sphere then using shaders, use the values of that map based on the Texture coords of the explosion sprite and add them to the depth values of the fragments. Then we let z-buffering take it from there.

Too bad fireballs are renderred using the fixed pipeline right now. Maybe I or someone else should work on that :p   

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Request: Explosion shader tweak
Well then, it's no longer the 'simple' formula you proposed.
why not? just ignore the values? just add a ( x >= y) before the average.

I believe that would require depth sorting. But it's the best I've heard so far, actually.
No, it would not require depth sorting.  It does not matter in which order the values are added before the averaging of the non zero values.  This is no different than the MAX(x,y) function, it does not matter in which order you find the MAX of a list of numbers, you will still find the same maximum number.

As for accessing the colour information, I don't know how the engine processes and renders explosions and cannot comment on it.  But algorithmically MAX(x, y) and average_non_zero both on about the same level, except average_non_zero would require keeping track of both the zero values and the total values for the average.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Re: Request: Explosion shader tweak
Depth sprites are usually used by most game engines today to make explosions seem rounder/ clip to the surrounding geometry spherically. It's a pretty simple concept, get a pre rendered depth map of a sphere then using shaders, use the values of that map based on the Texture coords of the explosion sprite and add them to the depth values of the fragments. Then we let z-buffering take it from there.

Too bad fireballs are renderred using the fixed pipeline right now. Maybe I or someone else should work on that :p   

That would be a requirement to allow custom shaders anyway... so there is no way around it.
--------------------------------------------------
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 Topgun

  • 210
Re: Request: Explosion shader tweak
Per-pixel Maximum function as suggested by Sushi is relatively computationally cheap, but I'm not sure how it'll look in practice.

- I don't think Photoshop has that filter, so it's hard to try out.
lighten only.

  
Re: Request: Explosion shader tweak
Well then, it's no longer the 'simple' formula you proposed.
why not? just ignore the values? just add a ( x >= y) before the average.

I believe that would require depth sorting. But it's the best I've heard so far, actually.
No, it would not require depth sorting.  It does not matter in which order the values are added before the averaging of the non zero values.  This is no different than the MAX(x,y) function, it does not matter in which order you find the MAX of a list of numbers, you will still find the same maximum number.

As for accessing the colour information, I don't know how the engine processes and renders explosions and cannot comment on it.  But algorithmically MAX(x, y) and average_non_zero both on about the same level, except average_non_zero would require keeping track of both the zero values and the total values for the average.
It would be a good idea to use proper alpha value from the texel, this would allow smooth gradient from invisible to visible.

The problem with custom blending is that no hardware supports it, so it must be made with couple of tricks.
Easiest might be rendering explosions into a different buffer and composite later with the image.

Finding MAX should be possible by writing the explosion brightness into a Z-Buffer and right color would be the last visible. (if one needs blending between explosions, sort particles and render them as feathered particles.)
Write alpha into texture.  (how you blend here affects the transparency of explosion, not color.)

Now we have color and alpha and transparent buffer ready to be composited to a final image. (before post processing.)
« Last Edit: October 09, 2009, 04:09:49 am by Pottuvoi »