Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/components/textures/shaders/sphereBlocksVert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ void main() {
vec3 spherePosition = givePosition(lonlat);
float latitudeFactor = cos(lonlat.y); // Maps -1..1 to proper latitude
float widthFactor = abs(lonBounds.y-lonBounds.x)/(2.0*PI);
float vertFactor = (latBounds.y-latBounds.x)/PI;
float heightFactor = (dispStrength - displaceZero) * displacement;
vec3 scaledPosition = position;
scaledPosition.x *= latitudeFactor * widthFactor;
scaledPosition.z *= widthFactor;
scaledPosition.z *= vertFactor ;
scaledPosition.y += 0.025;
scaledPosition.y *= heightFactor;

Expand Down
7 changes: 5 additions & 2 deletions src/components/textures/shaders/sphereBlocksVertFlat.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ void main() {
} else {
vec2 centeredUV = (instanceUV - vec2(0.5, 0.5)) * vec2(2.0, 2.0);
vec3 spherePosition = givePosition(instanceUV);
float latitudeFactor = cos(centeredUV.y * 3.14159 * 0.5); // Maps -1..1 to proper latitude
float latitudeFactor = cos(lonlat.y); // Maps -1..1 to proper latitude
float widthFactor = abs(lonBounds.y-lonBounds.x)/(2.0*PI);
float vertFactor = (latBounds.y-latBounds.x)/PI;
float heightFactor = (dispStrength - displaceZero) * displacement;
vec3 scaledPosition = position;
scaledPosition.x *= latitudeFactor;
scaledPosition.x *= latitudeFactor * widthFactor;
scaledPosition.z *= vertFactor ;
scaledPosition.y += 0.025;
scaledPosition.y *= heightFactor;

Expand Down
Loading