You are browsing as a guest. Sign up (or log in) to start making projects!

Turning my 2d raytracing engine into 3d and more

  • 2 Devlogs
  • 4 Total hours
Open comments for this post

36m 40s logged

The transition of objects

So, I converted all the struct defs to 3d by adding the 3d coordinated.

The spherical implementation

So I had to figure out how I could draw a sphere to start off.

I had to consider that we now have 2 angles that we have to utilize.

I can get the three coordinates by doing:
x = r * cos(theta) * cos(phi)
y = r * cos(theta)
z = r * sin(phi) * cos(theta)

To do this we need to first calculate the two angles phi and theta:

theta = r( determined by loop) / rings * pi
phi = s(determined by loop) / sectors * 2 * pi

theta is the angle rotating in a motion containing the z axis
while phi is rotating around the z axis.

0

Loading discussion…

0
1

Followers

Loading…