Author Topic: How luminance and the splash velocity system work.  (Read 1949 times)

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,886
  • Make it so.
    • View Profile
    • My Website
How luminance and the splash velocity system work.
« on: 19 April 2011, 14:42:02 »
This topic in a nutshell: https://docs.megaglest.org/Particles

Title says it all. I checked the wikia.

This is for Constellus, so it's GAE related. :P

Edit by Omega: Link to the wiki, since all the questions answered here will be on the wiki, in an easier to read format.
« Last Edit: 18 June 2016, 15:25:00 by filux »
Egypt Remastered!

Proof: Owner of glest@mail.com

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: What does particle 'luminance' do?
« Reply #1 on: 20 April 2011, 09:54:24 »
It tells the engine/GL that the texture is to be a single channel, indicating the 'luminance' (it turns the image into a greyscale texture which indicated the 'strength' of colour to apply at that texel (black == transparent, white fully opaque), this is multiplied into the colours defined for the particle system.

If it is off, then it a regular 4 channel rgba texture.

If you change the battlemage's particle to this,


but leave luminance on, you get none of those colours, when loaded only the 'colour intensity' at each pixel was kept to build the grey scale texture.  If you turn luminance off, it loads it as a regular texture and you get those colours... it's still doing something funny with turning black into transparent, but that can be changed with the blend functions & blend mode.

Glest Advanced Engine - Code Monkey

Timeline | Downloads

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: What does particle 'luminance' do?
« Reply #2 on: 20 April 2011, 21:18:41 »
Thanks for the info Silnarm, this will surely be useful in future  :thumbup:
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,886
  • Make it so.
    • View Profile
    • My Website
Re: What does particle 'luminance' do? (another question too)
« Reply #3 on: 20 April 2011, 21:20:00 »
Thanks man!

Also I have another question: How does the splash 'a-b' '0-1' stuff work?
Egypt Remastered!

Proof: Owner of glest@mail.com

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: What does particle 'luminance' do?
« Reply #4 on: 21 April 2011, 14:30:55 »
They (help) determine the direction component of each particle's velocity.

The direction vector for each particle is determined as such,

For each component (x, y & z),
a (0.0 -> 1.0) is multiplied by a random number (in the range -1.0 -> 1.0), and the resulting number (which is also in the range -1.0 -> 1.0) has b (in the range -1.0 -> 1.0) added to it.

for the x and z components a and b are the horizontal-spread numbers, and for y it uses the vertical-spread.

So what the hell does that all mean ?

The a in horizontal-spread determines the amount of the velocity that points out from the splash centre, if a=0.0 (and b=0.0) then the particles will have no velocity in the x or z directions and will only move up or down, depending on the vertical-spread.

If a is not 0.0, then the x and z components of the resulting velocity vector will not be zero either and the particle will by directed (horizontally, believe it or not) away from the centre of the splash.

The magnitude of a in this way is only important if the vertical-spread a is not 0.0, if the vertical-spread a is 0.0 then a horizontal-spread a of 0.1 and 1.0 will give identical results, the direction has no vertical part to it, it will always point horizontally away from the splash centre (ie, archmage's ice-nova).

I'll say something about b with horizontal-spread after I describe vertical...

Ok, so for vertical-spread the a is much the same as in horizontal, it determines if there will be any vertical component to the initial velocirty vector, and if so, how much compared to the horizontal a (unless the horizontal a is 0.0 of course, in which case the magnitude of the vertical a is largely irrelavant).

The b in vertical-spread can then be used to fine tune the result of multiplying a by a random number between -1.0 and 1.0. The result of the multiplication is also guaranteed to be in the range -1.0 to 1.0, which could be down or up. As b can be itself -1.0 to 1.0 and is added after the multiply, you can completely cancel out any downward pointing velocities (+1.0), or partially (so most, but not all, head upwards) (+0.x), or likewise have no upward travelling ones (-1.0), or favour downward ones (-0.x).

Now, 'horizontal-spread has a b too...' you may note, and while yes it does, unfortunately it is useless. Firstly, it biases BOTH x and z with the same number, and secondly, its aligned to the global axis, not the attack direction vector.
My advice: Leave it on 0, waste time playing with it if you like, but you wont get any good results from doing so... One day we'll get the attack vector in there and you'll be able to do more interesting things, but now is not the time :(

Yikes...

Picture time! Yay!

horizontal-spread a="1.0" b="0.0"
vertical-spread a="1.0" b="0.0"
With both as at 1.0 and vertical b at 0, the direction of each particle will be completely random, the net effect is of course particles heading out in all directions.


horizontal-spread a="1.0" b="0.0"
vertical-spread a="1.0" b="1.0"
This time we bias the vertical component with a +1.0, giving all particles a positive y component to their velocity.


horizontal-spread a="1.0" b="0.0"
vertical-spread a="1.0" b="-1.0"
vertical bias -1.0, make them all go downward.


horizontal-spread a="0.0" b="0.0"
vertical-spread a="1.0" b="1.0"
and back to a positive bias for vertical, but with no horizontal spread, all particles move directly upwards.


Obviously using numbers more like 0.2 and 0.7 for these things will give you more interesting results than shown above, but hopefully you now have some sense of what they do.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,886
  • Make it so.
    • View Profile
    • My Website
Re: How luminance and the splash velocity system work.
« Reply #5 on: 21 April 2011, 19:00:40 »
It's Jesus'narm!

Great explanation man! It should be copy-pasted to the wikia!
Egypt Remastered!

Proof: Owner of glest@mail.com

Zoythrus

  • Guest
Re: How luminance and the splash velocity system work.
« Reply #6 on: 22 April 2011, 02:51:21 »
this reminds me, we need a place to post awesome particles. i think that we could use a particle repository of some sort.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: How luminance and the splash velocity system work.
« Reply #7 on: 22 April 2011, 03:23:17 »
Wow, that was a great reply, Silnarm. Thanks! I'm making a wiki page for particles now, and will probably have subpages for particle examples, though you'll all have to flesh it out. Give it an hour to be created.



And done. Take a look at it here: https://docs.megaglest.org/Particles

I couldn't put as much information as I wanted, as I realized I am not entirely sure of myself on some of the attributes... :( Perhaps someone with more knowledge there can fill in the blanks? Missing headers are:

  • Speed
  • Emission rate
  • Energy var
  • Energy max
  • Fixed


As well, some parts like the GAE only blending type and blending equations I basically just copied and pasted available options. I know the basics to how the blending equations work, but they could use the TLC of someone who can explain it properly.

And of course, I added a gallery. The particle spread was so huge that I split it into a separate page. :D Looks pretty.
« Last Edit: 18 June 2016, 18:53:18 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: How luminance and the splash velocity system work.
« Reply #8 on: 22 April 2011, 08:57:20 »
Glad to hear it helped, was trying not get too 'mathy' with the vector stuff.. wasn't sure how successful it would be ;)

  • Speed
  • Emission rate
  • Energy var
  • Energy max
  • Fixed


As well, some parts like the GAE only blending type and blending equations I basically just copied and pasted available options. I know the basics to how the blending equations work, but they could use the TLC of someone who can explain it properly.

Nice work Omega, I've got a page for cloaking almost ready to put up, and I see someone has put some 'outdated' and 'recurring elements' things on some pages which I should sort out... I'll add the particle pages to the list, will give it some attention as 0.4 draws near.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: How luminance and the splash velocity system work.
« Reply #9 on: 17 June 2011, 23:36:40 »
Combing through the wiki some more, I thought I would bump this in hopes that someone would be capable of explaining these functions:
  • Speed
  • Emission rate
  • Energy var
  • Energy max
  • Fixed
Feel free to add them to the wiki article at https://docs.megaglest.org/Particles or post replies here.
« Last Edit: 18 June 2016, 13:07:59 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

 

anything