Skip to content

Commit

Permalink
NEW, IMPROVEMENTS: Big and decent looking universe, stars, nebulas. R…
Browse files Browse the repository at this point in the history
…eworked origin rebase to be adaptive (no more jumping). Camera effects for high-velocity flight.
  • Loading branch information
roalyr committed Feb 23, 2022
1 parent 04da4d3 commit da6cfc2
Show file tree
Hide file tree
Showing 15 changed files with 272 additions and 157 deletions.
Binary file modified Assets/Images/Progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Assets/Shaders/Cloud.gdshader
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_disabled, unshaded;
render_mode depth_draw_opaque, blend_add, cull_disabled, unshaded;

uniform vec4 albedo : hint_color;
uniform float rim_strength = 0.05;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Shaders/Cloud_halo.gdshader
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_disabled, unshaded;
render_mode depth_draw_opaque, blend_add, cull_disabled, unshaded;

uniform vec4 albedo : hint_color;
uniform float rim_strength = 1.5;
Expand Down
27 changes: 27 additions & 0 deletions Assets/Shaders/Cloud_halo_inner.gdshader
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
shader_type spatial;
render_mode depth_draw_opaque, blend_mix, cull_disabled, unshaded;

uniform vec4 albedo : hint_color;
uniform float rim_strength = 1.5;
uniform float rim_power = 9.0;
uniform float alpha_global = 0.5;

// For logarithmic depth buffer.
//const float c = 0.001;
//varying vec4 gl_Position;

//void vertex()
//{
// For logarithmic depth buffer.
//gl_Position = MODELVIEW_MATRIX*vec4(VERTEX, 1.0);
//}

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);
ALBEDO = albedo.rgb;
ALPHA = clamp(1.0-rim, 0.0, 1.0)*alpha_global;
}
2 changes: 1 addition & 1 deletion Assets/Shaders/Solid.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void vertex()
void fragment()
{
// Logarithmic depth buffer.
// DEPTH = log2(max(1e-6, 1.0 -gl_Position.z)) * c;
//DEPTH = log2(max(1e-6, 1.0 -gl_Position.z)) * c;


ALBEDO = albedo.rgb*COLOR.rgb;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Shaders/Star_halo.gdshader
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_front, unshaded;
render_mode depth_draw_opaque, blend_add, cull_front, unshaded;

uniform vec4 albedo : hint_color;
uniform float rim_strength = 0.05;
Expand Down
12 changes: 6 additions & 6 deletions Assets/Shaders/Star_surface.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ uniform float small_detail_flow = 0.2;
const float pi = 3.1415926535;

// For logarithmic depth buffer.
const float c = 0.001;
varying vec4 gl_Position;
//const float c = 0.001;
//varying vec4 gl_Position;

void vertex()
{
//void vertex()
//{
// For logarithmic depth buffer.
gl_Position = MODELVIEW_MATRIX*vec4(VERTEX, 1.0);
}
//gl_Position = MODELVIEW_MATRIX*vec4(VERTEX, 1.0);
//}

void fragment()
{
Expand Down
10 changes: 1 addition & 9 deletions Assets/Shaders/Starsphere_background.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ shader_type spatial;
render_mode depth_draw_never, unshaded, blend_add;

uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_normal;
uniform vec3 uv1_scale = vec3(1.0, 1.0, 1.0);
uniform vec3 uv1_offset;

void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
}

void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo, base_uv);
ALBEDO = albedo.rgb*COLOR.rgb*albedo_tex.rgb;
ALBEDO = albedo.rgb;
DEPTH = 1.0;
}
1 change: 0 additions & 1 deletion Default_env.tres
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ background_sky = SubResource( 1 )
background_sky_orientation = Basis( 0.513608, -0.748734, -0.419051, -0.00874038, 0.483799, -0.875135, 0.85798, 0.453139, 0.241939 )
background_sky_rotation = Vector3( 1.06572, -1.0472, -0.0180642 )
background_sky_rotation_degrees = Vector3( 61.061, -60, -1.035 )
background_color = Color( 0.709804, 0.709804, 0.709804, 1 )
background_energy = 0.0
tonemap_mode = 4
glow_bicubic_upscale = true
2 changes: 1 addition & 1 deletion Scenes/FX/Engine_exhaust_blue.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ shader_param/proximity_fade_distance = 0.1
light_color = Color( 0, 0.976471, 1, 1 )
light_energy = 0.1
omni_range = 50.0
omni_attenuation = 200.0
omni_attenuation = 25.0
__meta__ = {
"_edit_lock_": true
}
Expand Down
331 changes: 220 additions & 111 deletions Scenes/Main.tscn

Large diffs are not rendered by default.

20 changes: 5 additions & 15 deletions Scenes/Ships/Phoenix.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -193,38 +193,28 @@ physics_material_override = SubResource( 24 )
custom_integrator = true
continuous_cd = true
script = ExtResource( 2 )
__meta__ = {
"_edit_lock_": true
}

[node name="Model" type="MeshInstance" parent="."]
transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 )
mesh = SubResource( 18 )
material/0 = SubResource( 10 )
material/1 = SubResource( 19 )
material/2 = SubResource( 20 )
material/3 = SubResource( 21 )
material/4 = SubResource( 22 )
material/5 = SubResource( 23 )
__meta__ = {
"_edit_lock_": true
}

[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 )
shape = SubResource( 25 )
__meta__ = {
"_edit_lock_": true
}

[node name="Engines" type="Spatial" parent="."]
__meta__ = {
"_edit_lock_": true
}

[node name="Engine_exhaust" parent="Engines" instance=ExtResource( 3 )]
transform = Transform( 0.03, 0, 0, 0, 0.03, 0, 0, 0, 0.03, -0.2, 0, 0.38 )
transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, -2, 0, 3.8 )

[node name="Engine_exhaust2" parent="Engines" instance=ExtResource( 3 )]
transform = Transform( 0.03, 0, 0, 0, 0.03, 0, 0, 0, 0.03, 0.2, 0, 0.38 )
transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 2, 0, 3.8 )

[node name="Engine_exhaust3" parent="Engines" instance=ExtResource( 3 )]
transform = Transform( 0.03, 0, 0, 0, 0.03, 0, 0, 0, 0.03, 0, 0, 0.20735 )
transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 2.0548 )
11 changes: 4 additions & 7 deletions Scripts/Ship.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ var rebase_lag = 1.1

# TODO check materials and shaders for FX
# Params.
var ship_mass = 2000
var accel_factor = 60 # Propulsion force.
var ship_mass = 20000
var accel_factor = 600 # Propulsion force.
var accel_ticks_max = 5000 # Engine propulsion increments.
# Turning sensitivity LEFT-RIGHT | UP-DOWN | ROLL
var torque_factor = Vector3(1500,700,700)
var torque_factor = Vector3(1500000,700000,700000)
var camera_vert_offset = 0.2
var camera_horiz_offset = 1
# Higher damp value - more restricted camera motion in given direction.
Expand Down Expand Up @@ -92,14 +92,11 @@ func _integrate_forces(state):
# TODO: arrange for proper signs for accel and torque.
var vel = state.linear_velocity.length()
p.ship_state.ship_linear_velocity = vel
# Since everything is scaled down 10 times, then:
p.ship_state.apparent_velocity = vel*10
p.ship_state.apparent_velocity = vel

if vel > rebase_limit_margin*rebase_lag:
rebase_limit = round(vel*rebase_lag)

print("V: ", vel, " | L: ", rebase_limit)


state.add_central_force(-global_transform.basis.z* p.ship_state.acceleration* p.ship_state.acceleration)

Expand Down
6 changes: 3 additions & 3 deletions addons/lod/lod_spatial.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class_name LODSpatial, "lod_spatial.svg"
export var enable_lod := true

# The maximum LOD 0 (high quality) distance in units.
export(float, 0.0, 1e10, 0.1) var lod_0_max_distance := 1000000
export(float, 0.0, 1e15, 0.1) var lod_0_max_distance := 1e9

# The maximum LOD 1 (medium quality) distance in units.
export(float, 0.0, 1e10, 0.1) var lod_1_max_distance := 10000000
export(float, 0.0, 1e15, 0.1) var lod_1_max_distance := 1e10

# The maximum LOD 2 (low quality) distance in units.
# Past this distance, all LOD variants are hidden.
export(float, 0.0, 1e10, 0.1) var lod_2_max_distance := 1e10
export(float, 0.0, 1e15, 0.1) var lod_2_max_distance := 1e15

# The rate at which LODs will be updated (in seconds). Lower values are more reactive
# but use more CPU, which is especially noticeable with large amounts of LOD-enabled nodes.
Expand Down
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ quality/reflections/high_quality_ggx=false
quality/reflections/irradiance_max_size=64
quality/shading/force_vertex_shading.mobile=false
quality/shading/force_lambert_over_burley.mobile=false
gles3/shaders/shader_compilation_mode=1
cpu_lightmapper/quality/low_quality_ray_count=32
cpu_lightmapper/quality/medium_quality_ray_count=64
cpu_lightmapper/quality/high_quality_ray_count=128
Expand Down

0 comments on commit da6cfc2

Please sign in to comment.