ScratchData LogoScratchData
Back to gtoal's profile

Sphere shading Mk III - pen over stamp (WIP)

GTgtoal•Created June 25, 2016
Sphere shading Mk III - pen over stamp (WIP)
14
7
138 views
View on Scratch

Instructions

I'm trying to generate a realistic night-time shadow and terminator using the pen, drawing on top of a stamped spherical Earth. (I don't mind for now that the day side of the Earth is evenly illuminated)

Description

The code had some rendering artifacts which were fixed by @Istrali2 (Also thanks to @chooper100 for pointing us in the right direction) It works by using pythagoras to determine the longitude of the terminator for each latitude, plus the longitude of +2, +4, +6 etc degrees trailing the terminator. Those pixels are drawn in lighter shades (taken from a lookup table to manually compensate for non-linearity of shading values) If the X positions of successive longitudes reverse direction then we assume we have gone past the edge to the far side of the planet and we stop drawing them. There appear to be some drawing artifacts because I can see a dark edge to each of the terminator bands. I'm afraid I always find pixel-perfect drawing with the pen on Scratch to be rather difficult.

Project Details

Project ID114830002
CreatedJune 25, 2016
Last ModifiedJune 30, 2016
SharedJune 25, 2016
Visibilityvisible
CommentsAllowed