Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tome
Tales of MajEyal
Commits
811cd322
Commit
811cd322
authored
10 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
improve starfall
parent
f34b6f7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game/modules/tome/data/gfx/shaders/starfall.frag
+10
-105
10 additions, 105 deletions
game/modules/tome/data/gfx/shaders/starfall.frag
with
10 additions
and
105 deletions
game/modules/tome/data/gfx/shaders/starfall.frag
+
10
−
105
View file @
811cd322
...
...
@@ -5,8 +5,6 @@ uniform float time_factor;
float
antialiasingRadius
=
0
.
99
;
//1.0 is no antialiasing, 0.0 - fully smoothed(looks worse)
float
snoise
(
vec3
v
);
vec4
Uberblend
(
vec4
col0
,
vec4
col1
)
{
// return vec4((1.0 - col0.a) * (col1.rgb) + col0.a * (col1.rgb * col1.a + col0.rgb * (1.0 - col1.a)), min(1.0, col0.a + col1.a));
...
...
@@ -22,15 +20,14 @@ vec4 Uberblend(vec4 col0, vec4 col1)
void
main
(
void
)
{
vec2
radius
=
vec2
(
0
.
5
,
0
.
5
)
-
gl_TexCoord
[
0
].
xy
;
float
shieldIntensity
=
0
.
1
;
//physically affects shield layer thickness
//radius.x *= ellispoidalFactor; //for simple ellipsoid
//comment next line for regular spherical shield
//radius.x *= (1.0 + ellipsoidalFactor) * 0.5 + (ellipsoidalFactor - 1.0) * 0.5 * pow(cos(tick / time_factor * oscillationSpeed), 2.0);
//on-hit wobbling effect
float
coreTime
=
0
.
3
;
float
outerSphereTime
=
0
.
42
;
float
debrisStartTime
=
0
.
38
;
float
coreTime
=
0
.
4
;
float
outerSphereTime
=
0
.
55
+
0
.
1
;
float
debrisStartTime
=
0
.
52
;
/*float coreTime = 0.1;
float outerSphereTime = 0.9;*/
...
...
@@ -43,6 +40,7 @@ void main(void)
vec4
sphereColor
=
vec4
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
float
phase
=
clamp
((
tick
-
tick_start
)
/
time_factor
,
0
.
0
,
1
.
0
);
//float phase = mod((tick - tick_start) / time_factor, 1.0);
float
innerSpherePhase
=
clamp
(
phase
/
coreTime
,
0
.
0
,
1
.
0
);
vec3
color
=
clamp
(
gl_Color
.
rgb
*
(
1
.
0
+
pow
(
innerSpherePhase
,
2
.
0
)
*
10
.
0
),
0
.
0
,
1
.
0
);
...
...
@@ -72,15 +70,15 @@ void main(void)
texCoord
.
y
=
mod
(
texCoord
.
y
,
0
.
995
)
*
0
.
5
;
vec4
fractureColor
=
texture2D
(
tex
,
texCoord
);
float
phaseSubstraction
=
(
1
.
0
-
fracturePhase
)
*
0
.
5
;
float
fractureShininess
=
0
.
2
+
clamp
((
fractureColor
.
a
-
phaseSubstraction
)
/
(
1
.
0
-
phaseSubstraction
+
0
.
1
),
0
.
0
,
1
.
0
)
*
(
0
.
5
+
fracturePhase
*
4
0
.
0
);
float
fractureShininess
=
0
.
0
2
+
clamp
((
fractureColor
.
a
-
phaseSubstraction
)
/
(
1
.
0
-
phaseSubstraction
+
0
.
1
),
0
.
0
,
1
.
0
)
*
(
0
.
0
5
+
fracturePhase
*
4
.
0
);
float
resultShininess
=
fractureShininess
*
shieldIntensity
/
cos
(
alpha
);
float
resultShininess
=
fractureShininess
/
cos
(
alpha
);
sphereColor
=
blackColor
+
vec4
(
color
*
resultShininess
,
0
.
0
);
sphereColor
.
a
*=
min
(
1
.
0
,
sphereColor
.
a
)
*
antialiasingCoef
;
gl_FragColor
=
vec4
(
0
.
0
,
0
.
0
,
texCoord
.
x
,
1
.
0
);
}
float
rayPhase
=
clamp
(
innerSpherePhase
*
1
.
1
,
0
.
0
,
1
.
0
);
float
rayPhase
=
clamp
(
innerSpherePhase
*
0
.
9
+
0
.
1
,
0
.
0
,
1
.
0
);
vec2
raysTexPos
=
(
clamp
(
radius
/
(
radiusScale
+
1e-5
)
+
vec2
(
0
.
5
,
0
.
5
),
0
.
01
,
0
.
99
))
*
vec2
(
0
.
5
,
0
.
5
)
+
vec2
(
0
.
5
,
0
.
0
);
vec4
raysTexColor
=
texture2D
(
tex
,
raysTexPos
);
float
raysSubtraction
=
(
1
.
0
-
rayPhase
)
*
1
.
0
;
...
...
@@ -112,9 +110,8 @@ void main(void)
texCoord
.
x
=
mod
(
texCoord
.
x
,
0
.
995
)
*
0
.
5
;
// + 0.505;
texCoord
.
y
=
mod
(
texCoord
.
y
,
0
.
995
)
*
0
.
5
;
// + 0.505;
outerSphereColor
=
vec4
(
color
,
1
.
0
-
exp
(
-
100
.
0
*
texture2D
(
tex
,
texCoord
).
a
*
shieldIntensity
/
cos
(
alpha
)));
outerSphereColor
=
vec4
(
color
,
1
.
0
-
exp
(
-
55
.
0
*
(
pow
(
1
.
0
-
outerSpherePhase
,
3
.
0
))
*
texture2D
(
tex
,
texCoord
).
a
/
cos
(
alpha
)));
outerSphereColor
.
a
*=
antialiasingCoef
;
outerSphereColor
.
a
*=
1
.
0
-
pow
(
outerSpherePhase
,
5
.
0
);
}
float
coreTransperency
=
pow
(
1
.
0
-
outerSpherePhase
,
2
.
0
);
...
...
@@ -126,103 +123,11 @@ void main(void)
vec2
debrisTexPos
=
(
clamp
(
radius
+
vec2
(
0
.
5
,
0
.
5
),
0
.
01
,
0
.
99
))
*
vec2
(
0
.
5
,
0
.
5
)
+
vec2
(
0
.
0
,
0
.
5
);
vec4
debrisColor
=
texture2D
(
tex
,
debrisTexPos
);
debrisColor
.
rgb
*=
color
;
float
debrisIntensity
=
(
1
.
0
-
pow
(
debrisPhase
,
2
.
0
))
*
0
.
5
;
float
debrisSubtraction
=
debrisPhase
;
float
debrisIntensity
=
(
1
.
0
-
pow
(
debrisPhase
,
1
.
0
))
*
0
.
5
*
(
1
.
0
-
pow
(
1
.
0
-
debrisPhase
,
12
.
0
))
;
float
debrisSubtraction
=
pow
(
debrisPhase
,
5
.
0
)
;
debrisColor
.
a
=
clamp
((
debrisColor
.
a
-
debrisSubtraction
)
/
(
1
.
0
-
debrisSubtraction
)
*
debrisIntensity
*
5
.
0
,
0
.
0
,
1
.
0
);
explosionColor
=
Uberblend
(
debrisColor
,
explosionColor
);
}
gl_FragColor
=
explosionColor
;
}
vec4
permute
(
vec4
x
)
{
return
mod
(
(
(
x
*
34
.
0
)
+
1
.
0
)
*
x
,
289
.
0
);
}
vec4
taylorInvSqrt
(
vec4
r
)
{
return
1
.
79284291400159
-
0
.
85373472095314
*
r
;
}
float
snoise
(
vec3
v
)
{
const
vec2
C
=
vec2
(
1
.
0
/
6
.
0
,
1
.
0
/
3
.
0
);
const
vec4
D
=
vec4
(
0
.
0
,
0
.
5
,
1
.
0
,
2
.
0
);
// First corner
vec3
i
=
floor
(
v
+
dot
(
v
,
C
.
yyy
)
);
vec3
x0
=
v
-
i
+
dot
(
i
,
C
.
xxx
);
// Other corners
vec3
g
=
step
(
x0
.
yzx
,
x0
.
xyz
);
vec3
l
=
1
.
0
-
g
;
vec3
i1
=
min
(
g
.
xyz
,
l
.
zxy
);
vec3
i2
=
max
(
g
.
xyz
,
l
.
zxy
);
vec3
x1
=
x0
-
i1
+
1
.
0
*
C
.
xxx
;
vec3
x2
=
x0
-
i2
+
2
.
0
*
C
.
xxx
;
vec3
x3
=
x0
-
1
.
+
3
.
0
*
C
.
xxx
;
// Permutations
i
=
mod
(
i
,
289
.
0
);
vec4
p
=
permute
(
permute
(
permute
(
i
.
z
+
vec4
(
0
.
0
,
i1
.
z
,
i2
.
z
,
1
.
0
)
)
+
i
.
y
+
vec4
(
0
.
0
,
i1
.
y
,
i2
.
y
,
1
.
0
)
)
+
i
.
x
+
vec4
(
0
.
0
,
i1
.
x
,
i2
.
x
,
1
.
0
)
);
// Gradients
// ( N*N points uniformly over a square, mapped onto an octahedron.)
float
n_
=
1
.
0
/
7
.
0
;
// N=7
vec3
ns
=
n_
*
D
.
wyz
-
D
.
xzx
;
vec4
j
=
p
-
49
.
0
*
floor
(
p
*
ns
.
z
*
ns
.
z
);
// mod(p,N*N)
vec4
x_
=
floor
(
j
*
ns
.
z
);
vec4
y_
=
floor
(
j
-
7
.
0
*
x_
);
// mod(j,N)
vec4
x
=
x_
*
ns
.
x
+
ns
.
yyyy
;
vec4
y
=
y_
*
ns
.
x
+
ns
.
yyyy
;
vec4
h
=
1
.
0
-
abs
(
x
)
-
abs
(
y
);
vec4
b0
=
vec4
(
x
.
xy
,
y
.
xy
);
vec4
b1
=
vec4
(
x
.
zw
,
y
.
zw
);
vec4
s0
=
floor
(
b0
)
*
2
.
0
+
1
.
0
;
vec4
s1
=
floor
(
b1
)
*
2
.
0
+
1
.
0
;
vec4
sh
=
-
step
(
h
,
vec4
(
0
.
0
)
);
vec4
a0
=
b0
.
xzyw
+
s0
.
xzyw
*
sh
.
xxyy
;
vec4
a1
=
b1
.
xzyw
+
s1
.
xzyw
*
sh
.
zzww
;
vec3
p0
=
vec3
(
a0
.
xy
,
h
.
x
);
vec3
p1
=
vec3
(
a0
.
zw
,
h
.
y
);
vec3
p2
=
vec3
(
a1
.
xy
,
h
.
z
);
vec3
p3
=
vec3
(
a1
.
zw
,
h
.
w
);
// Normalise gradients
vec4
norm
=
taylorInvSqrt
(
vec4
(
dot
(
p0
,
p0
),
dot
(
p1
,
p1
),
dot
(
p2
,
p2
),
dot
(
p3
,
p3
)
)
);
p0
*=
norm
.
x
;
p1
*=
norm
.
y
;
p2
*=
norm
.
z
;
p3
*=
norm
.
w
;
// Mix final noise value
vec4
m
=
max
(
0
.
6
-
vec4
(
dot
(
x0
,
x0
),
dot
(
x1
,
x1
),
dot
(
x2
,
x2
),
dot
(
x3
,
x3
)
),
0
.
0
);
m
=
m
*
m
;
return
42
.
0
*
dot
(
m
*
m
,
vec4
(
dot
(
p0
,
x0
),
dot
(
p1
,
x1
),
dot
(
p2
,
x2
),
dot
(
p3
,
x3
)
)
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment