Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Blinky Stuff  (Read 1280 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Blinky Stuff
« on: August 22, 2012, 03:48:10 PM »

Would like to be able to put dynamic lights onto ships.

I was thinking about how to go about implementing this, and I had an idea (this gets a bit technical)
Spoiler
1.  People would draw a secondary layer map, like the glow maps used for phase ships.

2.  Pass a uniform to a fragment shader that gives a time scale and blur scale.

3.  For each non-zero alpha texel, do a Gaussian blur to adjacent pixels using the time scale to determine overall speed of blinking and size of the blur and the blur scale to determine how many pixels to fade it out (default to 1).  Use the RGB component to draw an alpha * time variable, use the base alpha of the texel to skew the time scale, from 1.0 to slower transitions between sin waves.  

This would give artists a great deal of control and allow for small variations in alpha to create different blink cycles- perhaps you want really fast cycles on a "technical component" but you want slow throbbing glows for a "landing light", etc.

I think this method should be plenty fast; all zero-alpha texels could get discarded immediately and the resulting processing load on the GPU should be pretty small even though there's a fair amount of math involved for each non-zero alpha texel.
[close]

Anyway, just an idea; sorry if providing some implementation thoughts wasn't appropriate, I thought it might be helpful in this case, as the alternatives (like doing it with quads) could get complicated and expensive.  It'd add a lot of life to the ships :)
« Last Edit: August 22, 2012, 03:50:52 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Blinky Stuff
« Reply #1 on: August 22, 2012, 04:25:17 PM »

Ah, I love the idea!  Simple and uses exsisting code. :)
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.