-
Notifications
You must be signed in to change notification settings - Fork 27
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
Nemrav
committed
Dec 16, 2024
1 parent
8e911c8
commit 0d96d42
Showing
4 changed files
with
130 additions
and
1 deletion.
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
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
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
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,41 @@ | ||
shader_type spatial; | ||
render_mode unshaded; | ||
|
||
uniform uint type = 0; | ||
uniform float start_time = 0; | ||
//uniform float end_time = 10.0; | ||
|
||
uniform sampler2D projections[3] : source_color; | ||
uniform float sizes[3]; | ||
uniform bool additative[3]; //if true, black becomes a transparency colour | ||
uniform float spin[3]; | ||
uniform float expanding[3]; | ||
|
||
void vertex() { | ||
// Called for every vertex the material is visible on. | ||
float rot = TIME*spin[type]; | ||
mat3 rotation_matrix = mat3( | ||
vec3(cos(-rot), 0.0, sin(-rot)), | ||
vec3(0.0, 1.0, 0.0), | ||
vec3(-sin(-rot), 0.0, cos(-rot)) | ||
); | ||
//TIME loops after 3600s = 1hr, so we use modulus to make sure we can | ||
// expand through the hour mark | ||
VERTEX.xyz *= rotation_matrix * | ||
clamp( | ||
expanding[type] * mod(TIME-start_time,3600.0), | ||
0.0, | ||
sizes[type] | ||
); | ||
} | ||
|
||
void fragment() { | ||
// Called for every pixel the material is visible on. | ||
vec4 sample = texture(projections[type],UV); | ||
ALBEDO.rgb = sample.rgb; | ||
|
||
//if additative, then black = transparent, otherwise use alpha | ||
float add_tr = float(additative[type]); | ||
float not_add_tr = float(!additative[type]); | ||
ALPHA = not_add_tr*sample.a + add_tr*(sample.r+sample.g+sample.b); | ||
} |