Showing posts with label ray trace. Show all posts
Showing posts with label ray trace. Show all posts

Sunday, September 30, 2012

Reflection & Refraction

Images of Reflection:







Refraction: Working to correct black dots in the image.






Area Light and soft shadows

Point lights: In order to check the light intersection with object, we need to fire only one ray in the direction of the point light from the currently intersected point.

Area Light: Area light work differently from the point light. As in area light we need to generate more rays towards the geometry representing area light. Hence, a lot more rays are required for the calculation of light.

While implementing area light, I randomly sampled over 9 points on the area light. However, the result is not good. Following image is generated using area light with 9 sample points:






In order to correct it, more samples are required. However, every time I increase the number of samples from 9 to any number greater than that, my CUDA crashes giving error.

Still trying to resolve the issue.


Thursday, September 27, 2012

Diffuse lambertian surfaces


Lambert's Cosine Law: It states that the intensity of light on a diffuse surface is directly proportional to the cosine angle θ between the incoming light ray and the unit normal to the surface.
In layman's language, if the angle is low light intensity is low and if angle is high intensity is high.

Hence, applying lambert's law in ray tracer code will give diffuse lambertian surfaces.

Pseudocode:

float lambert = (lightRay.direction * normal) * coef;
colors += currentMat.color * light.color * lambert ;


Images generated after its application: (although shadows seem wrong)