ScratchData LogoScratchData
Back to Wes64's profile

Globe

WEWes64•Created January 24, 2015
Globe
1277
1021
13267 views
View on Scratch

Instructions

Use mouse and follow instructions printed on screen. Initially it will use low resolution/low color versions so that you can plan the final image. First, rotate the globe. Then, change the lighting. It will be rendered completely after these settings are made.

Description

Another project I made: http://scratch.mit.edu/projects/44786142/ Experimenting with photorealistic rendering. Uses math (vector analysis mostly) and internal arrays of colors to transform the flat map of Earth to a globe. Array is loaded from a 12-color GIF image in "maps" sprite. Sphere shading only: http://scratch.mit.edu/projects/44151632/ The globe is a parametrized sphere of radius rho, projected onto the XZ plane. That is, (x, y) = T(theta, phi) = (rho*sin(phi)cos(theta), rho*cos(phi)). Phi and theta are the standard spherical parameters. The shading is calculated by comparing the normal vector of the sphere to the lighting vector placed by the user. The formula is shading = cos(theta) = (normal . lighting) / (||normal|| * ||lighting||). The shading ranges from -1 to 1, but values less than 0 are seen as black. The normal is calculated by taking cross product of partial derivatives dP/dphi and dP/dtheta, where P is the sphere parametrized in spherical coordinates. Rendering is optimized for least pen strokes (at higher resolutions).

Project Details

Project ID44711858
CreatedJanuary 24, 2015
Last ModifiedJanuary 29, 2015
SharedJanuary 24, 2015
Visibilityvisible
CommentsAllowed