3D ray tracing using raycast

You can make an ellipsoid by passing an axes parameter when defining the sphere. These aren’t normalised so if they are of different lengths they will distort the sphere into an ellipsoid. So something like:

m:addSphere({axes = {vec3(1,0,0), vec3(0,1,0), vec3(0,0,3)} })

This is better than simply scaling the mesh since it ensures that the normals are correctly computed.

I don’t understand what you mean about the sphere segment, can you clarify for me?