Skip to content

Commit

Permalink
IMPROVEMENT: Better star shader, lesser star polycount
Browse files Browse the repository at this point in the history
  • Loading branch information
roalyr committed Apr 26, 2022
1 parent e295f22 commit 39f2c2f
Show file tree
Hide file tree
Showing 55 changed files with 731 additions and 137 deletions.
53 changes: 35 additions & 18 deletions Assets/Shaders/Star.gdshader
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_front, unshaded;

uniform vec4 halo_color : hint_color;
uniform vec4 corona_color : hint_color;
uniform vec4 core_color : hint_color;
uniform float rim_strength = 0.05;
uniform float rim_power = 9.0;
uniform float core_strength = 0.05;
uniform float core_power = 9.0;
uniform float core_amount = 0.05;

uniform float halo_strength = 0.2;
uniform float halo_power = 1.0;
uniform float halo_amount = 1.0;

// For logarithmic depth buffer.
const float c = 0.001;
varying vec4 gl_Position;
uniform float corona_strength = 10.0;
uniform float corona_power = 10.0;
uniform float corona_amount = 1.0;

void vertex()
{
// For logarithmic depth buffer.
gl_Position = MODELVIEW_MATRIX*vec4(VERTEX, 1.0);
uniform float core_strength = 50.0;
uniform float core_power = 50.0;
uniform float core_amount = 50.0;

uniform sampler2D displacement_texture;
uniform float displacement_scale = 0.02;
uniform float displacement_velocity = 0.01;


void vertex() {
vec2 tex_position_x = VERTEX.yz / 1.0 - TIME*displacement_velocity;
vec2 tex_position_y = VERTEX.xz / 1.0 + TIME*displacement_velocity;
vec2 tex_position_z = VERTEX.xy / 1.0 - TIME*displacement_velocity;

float displacement_x = 2.0*texture(displacement_texture, tex_position_x).r-1.0;
float displacement_y = 2.0*texture(displacement_texture, tex_position_y).r-1.0;
float displacement_z = 2.0*texture(displacement_texture, tex_position_z).r-1.0;

VERTEX.z += displacement_z * displacement_scale;
VERTEX.x += displacement_x * displacement_scale;
VERTEX.y += displacement_y * displacement_scale;
}

void fragment()
{
// Logarithmic depth buffer.
// DEPTH = log2(max(1e-6, 1.0 -gl_Position.z)) * c;

float rim = clamp(pow( dot( NORMAL, VIEW ), rim_power)*rim_strength, 0.0, 1.0);
float halo = clamp(pow( dot( NORMAL, VIEW ), halo_power)*halo_strength, 0.0, 1.0);
float corona = clamp(pow( dot( NORMAL, VIEW ), corona_power)*corona_strength, 0.0, 1.0);
float core = clamp(pow( dot( NORMAL, VIEW ), core_power)*core_strength, 0.0, 1.0);
ALBEDO = corona_color.rgb + core*core_amount*core_color.rgb;
ALPHA = rim;
ALBEDO =
halo*halo_amount*halo_color.rgb
+ corona*corona_amount*corona_color.rgb
+ core*core_amount*core_color.rgb;
ALPHA = halo;
}
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/accel.png-cf6ab6c82b65643b72a25f8d36af48e0.stex"
path="res://.import/accel.png-4b3242445610598646306840d494575e.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/accel.png"
dest_files=[ "res://.import/accel.png-cf6ab6c82b65643b72a25f8d36af48e0.stex" ]
source_file="res://Assets/UI_images/png/buttons/accel.png"
dest_files=[ "res://.import/accel.png-4b3242445610598646306840d494575e.stex" ]

[params]

Expand Down
File renamed without changes
35 changes: 35 additions & 0 deletions Assets/UI_images/png/buttons/deccel.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/deccel.png-b6d5396ca46f31de70e8cda45673d78c.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/png/buttons/deccel.png"
dest_files=[ "res://.import/deccel.png-b6d5396ca46f31de70e8cda45673d78c.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/ekill.png-e7c5212d77ed0647c7f08df143a0f9a9.stex"
path="res://.import/ekill.png-93c7a2a533dc26faa97bc7f71ddb39fb.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/ekill.png"
dest_files=[ "res://.import/ekill.png-e7c5212d77ed0647c7f08df143a0f9a9.stex" ]
source_file="res://Assets/UI_images/png/buttons/ekill.png"
dest_files=[ "res://.import/ekill.png-93c7a2a533dc26faa97bc7f71ddb39fb.stex" ]

[params]

Expand Down
File renamed without changes
35 changes: 35 additions & 0 deletions Assets/UI_images/png/buttons/options.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/options.png-789ca28e3b2456756f3f62f3b8f9d7e1.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/png/buttons/options.png"
dest_files=[ "res://.import/options.png-789ca28e3b2456756f3f62f3b8f9d7e1.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/stick.png-4571900ebdd1f5aca2de2c9971ec7b69.stex"
path="res://.import/stick.png-7f2eaaa1577e63c951e92e367f88c5a1.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/stick.png"
dest_files=[ "res://.import/stick.png-4571900ebdd1f5aca2de2c9971ec7b69.stex" ]
source_file="res://Assets/UI_images/png/buttons/stick.png"
dest_files=[ "res://.import/stick.png-7f2eaaa1577e63c951e92e367f88c5a1.stex" ]

[params]

Expand Down
File renamed without changes
35 changes: 35 additions & 0 deletions Assets/UI_images/png/buttons/turret.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/turret.png-f112c7511134b36ec611a76cf878fe2e.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/png/buttons/turret.png"
dest_files=[ "res://.import/turret.png-f112c7511134b36ec611a76cf878fe2e.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/ui_opacity.png-5ab9c77aecd3b1dbb4ed901a96a715ca.stex"
path="res://.import/ui_opacity.png-b8c52256ba84afa982cb23d07268c174.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/ui_opacity.png"
dest_files=[ "res://.import/ui_opacity.png-5ab9c77aecd3b1dbb4ed901a96a715ca.stex" ]
source_file="res://Assets/UI_images/png/buttons/ui_opacity.png"
dest_files=[ "res://.import/ui_opacity.png-b8c52256ba84afa982cb23d07268c174.stex" ]

[params]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file added Assets/UI_images/source files/odg/galaxy.odg
Binary file not shown.
Binary file not shown.
Binary file added Assets/UI_images/source files/odg/star.odg
Binary file not shown.
Binary file added Assets/UI_images/source files/odg/system.odg
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
118 changes: 118 additions & 0 deletions Assets/UI_images/svg/icons/galaxy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/turret.png-24a22203a1f645c150230772768eb3b5.stex"
path="res://.import/galaxy.svg-d5390d451e67260a01468a33847bddc2.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/UI_images/turret.png"
dest_files=[ "res://.import/turret.png-24a22203a1f645c150230772768eb3b5.stex" ]
source_file="res://Assets/UI_images/svg/icons/galaxy.svg"
dest_files=[ "res://.import/galaxy.svg-d5390d451e67260a01468a33847bddc2.stex" ]

[params]

Expand Down
Loading

0 comments on commit 39f2c2f

Please sign in to comment.