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: Distortion Maker  (Read 6863 times)

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Distortion Maker
« on: October 05, 2014, 05:47:55 AM »

Distortion Maker


+


=



The distortion maker, as used to create the distortion maps in ShaderLib.
  • Create a static wave distortion
  • Create an animated wave distortion
  • Create a swirl wave

Created in co-operation with the ever awesome Dark Revenant for ShaderLib.

EDIT: Added the needed libraries for functionality (like Vector2f). LWJGL License
« Last Edit: October 05, 2014, 03:28:31 PM by Debido »
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Distortion Maker
« Reply #1 on: October 06, 2014, 11:38:22 PM »

Interesting, I was wondering how the ShaderLib ripples were put together. Out of curiosity (and somewhat off topic), how would I go about creating a more complex shaders that aren't simple ripples or waves?
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Distortion Maker
« Reply #2 on: October 06, 2014, 11:43:03 PM »

Interesting, I was wondering how the ShaderLib ripples were put together. Out of curiosity (and somewhat off topic), how would I go about creating a more complex shaders that aren't simple ripples or waves?

It depends, you can hand paint them if you know what you're doing, or procedurally generate them with more involved math or a combination of the two'. So you may generate a radially outward vector base layer, then you take it into gimp overlay your ship, trace a path around the mask. Make that traced path 20pixels wide and fill it with gradient blue. You then have a distortion effect that goes around the edge of your ship radially outwards.
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Distortion Maker
« Reply #3 on: October 07, 2014, 12:41:59 AM »

Basically, red/green is which direction to displace the pixel by, blue is how much to displace by.  If you paint them, you must do it channel-by-channel.  I wouldn't suggest painting smooth/mathematical distortions like lenses, ripples, or spirals.  You can paint more complicated or animated distortions like engine haze or something, though.

Distortions need not be radial, by the way; you can make them any shape you want and freely rotate them via the API in ShaderLib.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Distortion Maker
« Reply #4 on: October 07, 2014, 12:45:23 AM »

Hah, you posted just as I was about to ask what the RGB values were. Alright, I have a few ideas- I guess the trick is somehow animating them.

Definitely should do a more thorough digging through the ShaderLib APIs when I get the chance. Thanks!  :D
Logged