Original Post
Hi, Im trying to do something fairly 'simple' Using raytracing, I want to render a simple sphere. But the thing is, I don't have an polygonal data for it, but instead I want to render it based of some attributes (so it will be a perfect sphere). For example, I know it has a location and radius. So I cast my rays towards the location. I determine how far away the ray is from the spheres location Give that ray point a clamped gradient value (based on the radius). The result is a simple circle gradient:
What I want now is to render it with some lighting (and eventually with reflection and specular highlights), but to do this I need the normal of a point on the spheres 'surface' How would I calculate this? If I sent a ray directly to the center of the sphere, I know the normal at that point would be directly reflected towards the camera, but I cant work out how to do it for any part of the 'sphere'
What I want now is to render it with some lighting (and eventually with reflection and specular highlights), but to do this I need the normal of a point on the spheres 'surface' How would I calculate this? If I sent a ray directly to the center of the sphere, I know the normal at that point would be directly reflected towards the camera, but I cant work out how to do it for any part of the 'sphere'