Added automatic procedural level of detail to planets
This commit is contained in:
18
godot/Shaders/Planet/PlanetShading.gdshader
Normal file
18
godot/Shaders/Planet/PlanetShading.gdshader
Normal file
@ -0,0 +1,18 @@
|
||||
shader_type spatial;
|
||||
|
||||
uniform float min_elevation;
|
||||
uniform float max_elevation;
|
||||
uniform sampler2D elevation_color;
|
||||
|
||||
varying float height;
|
||||
|
||||
void vertex() {
|
||||
height = length(VERTEX);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
float t = height/(max_elevation-min_elevation)- (min_elevation / (max_elevation-min_elevation));
|
||||
vec3 color = texture(elevation_color, vec2(t, 0.0)).rgb;
|
||||
ALBEDO = color;
|
||||
}
|
||||
|
Reference in New Issue
Block a user