Loading:

Raytraced Surfaces of Revolution (with Refraction)

Use the mouse to click/drag the object

Presets
Configure spline [r^2 = A*y^2 + B*y + C]
A B C
Configure spline using target radii
R[0.0] R[0.5] R[1.0]
Configure V texcoords
V0 V1 V2 V3
Configure Refractive Index

Method

This time, I'm raytracing surfaces of revolution. I looked into Beziers, etc. but then I decided to invent a "new" spline format which fits into the intersection maths better. Since the radial ray equation is O.O + 2.O.D.t + D.D.t.t = r.r, I decided to define the spline in terms of r^2 rather than in terms of r. So the spline is r^2 = A.y^2 + B.y + C; I normalize y into [0,1] first. This has nice properties. A cylinder is r^2 = C. A cone or conic piece is r^2 = B.y^2. A hemisphere is r^2 = A - A.y^2. By rendering lots of little pieces we should be able to construct a wide variety of "lathed" pieces - ornate columns, table legs, spheroids, etc.

Then, the ray is refracted or reflected (not both) at the interface. This continues for up to 7 bounces, then a pixel is selected from the environment map.

Code

Hello