karansher / computer-graphics-ray-casting

Computer Graphics Assignment about Ray Casting
1 stars 0 forks source link

Normals confusion #36

Open MurraySmith27 opened 1 year ago

MurraySmith27 commented 1 year ago

image

So with this picture provided (from the examples), why are the normals the colour that they are?

Our camera is on the z axis facing the origin, and our sphere is centered at the origin. This would mean that the sphere normal that points in the direction of the camera (right in the center of this image) would be <0, 0, 1> right (i.e. perfectly blue)? Why is it that the blue component is stronger on the bottom left half of the sphere in this image than in the center?

panuelosj commented 1 year ago

Normals vector components can go from -1 to 1, but colour values go from 0 to 255. This means that to get the full range of possible values, we have to offset the colours such that 0 corresponds to a normal pointing in the -1 direction and 255 points in the +1 direction. Notice that if you use the colour picker at the exact middle of the sphere, you get an rgb value roughly corresponding to [128,128,255].