Houdini VOP raytracer part 6

 

Depth of field

depth In real camera, every photon, before it hits camera sensor/film, it flies through round shape aperture hole, creating round looking out of focus objects  (Bokeh).

When we sample depth of field  using default random() function,  will are getting random square point distribution. In order to get more natural, round look, we have to implement some kind of random, circular point distribution. This is very simple example:

t = 2*pi*random()
u = random()+random()
r = if u>1 then 2-u else u
[r*cos(t), r*sin(t)]

pic circularScatter01circularScatter02 Node view of circular random distribution randomNodes





<< [ 5 ] [ 6 ] [ 7 ] >>

 

Houdini VOP raytracer part 5

Specular Hilight

A specular highlight is a bright spot of light that appears on shiny objects when illuminated. The term specular means that light is perfectly reflected in a mirror-like way from the light source to the viewer. We are going to cover two specular reflection models.

Phong reflection model.

K{\tiny spec} = \big\|R\big\| \big\|V\big\| cos^n \beta =(\hat{R} \cdot \hat{V})^n

Continue Reading →

Houdini VOP raytracer part 4

moire02

Spatial Aliasing

So far, we have been sending single ray from centre of each pixel. You can notice that we have very chunky edges. You might think that increasing number of pixels should eliminate that problem but it won’t. We can make pixels smaller but jaggies on edges will persist. Additionally, if scene object is too small or too far away, it might be placed in-between rays and we will never register its existence. This problem is called spatial aliasing. There are few ways of fixing it but we will focus on one popular technique. Continue Reading →

Houdini VOP raytracer part 3

shadows

Shadow Ray and Illumination Ray

Now this is where fun starts. Following a photon in our backward raytracing next step would be to test where it came from. We already know last hit position before photon hit our Image Plane, we can check if there is direct path from hit point to light source simply by shooting another ray. When a our new ray is able to reach a light source without any interruption, we call it illumination ray, otherwise, when there is any obstruct on our ray path we call it shadow ray.

Continue Reading →

Houdini VOP raytracer part 2

render01

Critical issue of image synthesis is to determine of the correct color of each pixel. One way of finding that color is to average colors of the light rays that strike that pixel.

But how do we find that light rays and what color are they? Continue Reading →

Houdini VOP raytracer part 1

raytrace

Long time ago, I came up with this crazy idea of creating a ray tracer in Houdini just by using Houdini VOP nodes just for fun. I found that this may give you a very in-depth understanding on how raytracers works, and let you discover few tips and tricks in Houdini.So after a few requests, I have decided to create this tutorial. Starting from the very basic so everyone can understand. The final ray tracer we are going to create, renders picture on a given “Screen”, custom geometry for eg. simple plane object. Exactly same principles apply for shaders so everything what we will create here, you can do in shader contexts. But first, we are going to start from simple examples and basic math. Continue Reading →