-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel
authored
Nov 20, 2016
1 parent
c0ff2f6
commit a1bc57a
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <multisample> | ||
#include <perlin> | ||
|
||
parameter float timeScale = 1.0 : range(0.5, 6.0); | ||
|
||
glsl vec4 drawStars(vec2 pos) { | ||
vec2 origin = shadron_Dimensions / 2; | ||
vec2 loc = pos * shadron_Dimensions; | ||
float distFromOrigin = distance(loc, origin); | ||
|
||
float noiseMult = 10 + distFromOrigin + shadron_Time * timeScale; | ||
|
||
// Color some of the stars | ||
float blueValue = step(0.75, perlinNoise((pos + vec2(0.33, -0.1)) * noiseMult)); | ||
float redValue = step(0.75, perlinNoise((pos + vec2(0.39, 0.94)) * noiseMult)); | ||
vec4 red = vec4(redValue, 0.0, 0.0, redValue); | ||
vec4 blue = vec4(0.0, 0.0, blueValue, blueValue); | ||
vec4 background = red + blue + vec4(1.0); | ||
|
||
vec4 starMask = vec4(vec3(0.0), 1.0 - step(0.9, perlinNoise(pos * noiseMult))); | ||
|
||
return vec4(mix(background.rgb, starMask.rgb, starMask.a), 1.0); | ||
} | ||
|
||
animation distortionField = glsl(multisample<drawStars, 4>, 1600, 900); |