Skip to content

Instantly share code, notes, and snippets.

@ell-shad
Created August 26, 2023 10:56
Show Gist options
  • Save ell-shad/d0ed8f8a2ba08da05e721d9a1b8d9243 to your computer and use it in GitHub Desktop.
Save ell-shad/d0ed8f8a2ba08da05e721d9a1b8d9243 to your computer and use it in GitHub Desktop.
3D Earth LIve Wallpaper
float angle = 0;
float sphereRadius = 350;
PVector lightDirection;
PImage earth;
PShape globe;
void setup() {
fullScreen(P3D);
noStroke();
earth=loadImage("2k_earth_daymap.jpg");
globe = createShape(SPHERE, sphereRadius);
globe.setTexture(earth);
lightDirection = new PVector(1, 0.5, 0);
lightDirection.normalize();
lightFalloff(1.0, 0.0, 0.0);
}
void draw() {
background(0);
translate(width/2, height/2);
rotateY(radians(angle));
lights();
directionalLight(255, 255, 255, lightDirection.x, lightDirection.y, lightDirection.z);
shape(globe);
angle+=0.5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment