I have converted some old C
code into JS
and it works 99% as the original. The original code generates good looking space scenes where the perspective is from the surface of one planet looking up at another planet. The problem I am having is that the shading algorithm in some parts seem to get outside the set range, and I don’t know where to look. I’ve tried fiddling with the initial values to no avail.
The palette in Colors[]
is derived from the Atari Falcon’s default palette.
On one picture (Seed: 100
) you’ll notice the rocks have these light pixels in the dark, and on another picture (Seed: gen
) the dark side of the planet (left) gets these light pixels. There are other moments where the light side of the rocks turn bright green, as does the dark side of the planet.
Now as said, I have no idea where to look in all this code. I just “copied” with little understanding of what is actually happening. So I cannot provide an MRE but instead both JS
and C
code gets attached here in a ZIP. I know it is a lot of code to go through, but I really don’t know where the fault actually lies.
https://edwardleuf.org/misc/imagery/PLANET.zip