Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://b1jwk81h16hlg"]

[sub_resource type="Gradient" id="1"]
offsets = PackedFloat32Array(0, 0.408269, 0.496, 0.5, 0.504, 0.569322, 0.687316, 0.778761, 0.867257)
offsets = PackedFloat32Array(0, 0.408269, 0.483438, 0.495076, 0.503133, 0.569322, 0.687316, 0.778761, 0.867257)
colors = PackedColorArray(0.160784, 0.180392, 0.192157, 1, 0.180392, 0.301961, 0.411765, 1, 0.203922, 0.388235, 0.45098, 1, 0.835938, 0.76165, 0.538788, 1, 0.625797, 0.756863, 0.392157, 1, 0.441538, 0.575195, 0.276363, 1, 0.317647, 0.388235, 0.25098, 1, 0.412109, 0.385611, 0.254349, 1, 0.887207, 0.878932, 0.835222, 1)

[sub_resource type="GradientTexture2D" id="2"]
Expand Down
6 changes: 4 additions & 2 deletions addons/hoimar.planetgen/resources/materials/water.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ void fragment() {
ALBEDO *= 1.0 - ref_amount;

// Proximity fade.
float depth_tex = textureLod(DEPTH_TEXTURE, SCREEN_UV, 0.0).r;
vec4 world_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0);
float nonlinear_depth = texture(DEPTH_TEXTURE, SCREEN_UV).x;
vec3 ndc = vec3(SCREEN_UV * 2.0 - 1.0, nonlinear_depth);
vec4 world_pos = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);

world_pos.xyz /= world_pos.w;
ALPHA *= clamp(1.0 - smoothstep(world_pos.z + proximity_fade_distance, world_pos.z, VERTEX.z), 0.0, 1.0);

Expand Down
5 changes: 4 additions & 1 deletion addons/hoimar.planetgen/resources/space_environment.tres
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ sky_material = SubResource("PanoramaSkyMaterial_2hwgy")

[resource]
background_mode = 2
background_energy_multiplier = 0.25
sky = SubResource("1")
ambient_light_color = Color(0.992157, 0.988235, 0.988235, 1)
ambient_light_source = 1
ambient_light_color = Color(1, 1, 1, 1)
reflected_light_source = 1
tonemap_mode = 2
glow_enabled = true
glow_intensity = 0.2
Expand Down
6 changes: 3 additions & 3 deletions addons/hoimar.planetgen/scripts/celestial_bodies/planet.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func generate():
_water_sphere.visible = settings.has_water
if settings.has_water:
var material :Material = _org_water_mesh.surface_get_material(0).duplicate()
var mesh : SphereMesh = _org_water_mesh.duplicate()
mesh.radius = settings.radius
mesh.height = settings.radius*2
var mesh = _org_water_mesh.duplicate()
mesh.radius = settings.radius * 1.006 #TODO: why do i need this arbitrary multiplier to make the water level right?
mesh.height = settings.radius*2 * 1.006
mesh.surface_set_material(0, material)
_water_sphere.mesh = mesh
material.set_shader_parameter("planet_radius", settings.radius)
Expand Down
2 changes: 1 addition & 1 deletion addons/hoimar.planetgen/scripts/spacecraft/ship.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func _integrate_forces(state: PhysicsDirectBodyState3D):
func apply_thrust(v: Vector3) -> bool:
if linear_velocity.length() > MAXVELOCITY:
return false
impulse += transform.origin * v * speed_scale
impulse += global_transform.basis * v * speed_scale
return true

func rotate(axis: Vector3, degrees: float):
Expand Down