Blend Material & Two-Sided Material

I have implemented two new materials. The first one is blend material, which adds a lot of power to the material system since you can arbitrarily use different materials on parts of the same mesh. The second material is two-sided material, which is useful for thin translucent materials like paper, lights, and leaves since it allows the back-face to receive light.

Below are three examples. The first one shows the blend material in action, the left sphere is a reflective sphere and the right is the blended material with a rough refractive material and the mask is the world map. The white parts receive 100% of material A and the black parts will receive 100% of material B, anything in-between receives a proportion of both.

For the two sided material the front facing parts relative to the camera receive material A while the back facing parts receive material B, and a flag for translucency to allow light to go through the back is optional and set as off by default. The second image shows a open cylinder with a two sided material. The third image shows an render with a spherical light place inside a tube, the interesting thing is that most of the light illuminating the scene is from indirect lighting.

blend-material2.jpg
Blend material with reflective and rough refractive materials
twosided.png
The front face is shaded with the red material and the back is shaded with the blue material
two-sided1.png
Two-sided material with “Translucency” enabled

References

http://blog.turbosquid.com/2014/06/09/turbotips-v-ray-blend-material-part-1/

http://docs.chaosgroup.com/display/VRAY3MAX/Translucent+Two-Sided+Material+%7C+VRay2SidedMtl

http://www.ramyhanna.com/2008/06/translucent-leaves.html

http://www.josefbsharah.net/v-rayforc4d-basic-startup-part2-basix/

Advertisements

Rendering Fun: Part I

Having some fun with the rendering engine, I created some 3D programmer “art” models in 3ds max, uv mapped them and exported them out as OBJs. I tried my best to model and texture them properly.

These are some of the books i am using for my bachelors project, I wasn not bothered making the rest of them.

I was surprised just how wavy and cellular the reflections are with these books in real life. I chose these specific books because they have different degrees of glosiness to their reflections. Click for full size.

books1.jpg

books2.jpg

Materials

I tried to implement some BRDFs, but kind of failed.

I tried really hard to implement the Ashikmin-Shirley anistropic brdf model, but it was producing all sorts of strange result I can only conclude that there are probably some nasty bugs in the rendering engine… I spent a week trying to make it work.

feels

I also tried to implement refraction through rough surfaces a paper by Walter et al. with mixed success. My implementation doesnt seem to play well with the GGX or Beckmann distribution so theres definitely a bug somewhere.

I rendered a similar image to the one in the paper; a glass sphere with the world map etched in.

glossy16.jpg

References

http://dl.acm.org/citation.cfm?id=2383874

Indirect Illumination

I started working on adding indirect lighting to the renders using path tracing since this is the most straight forward one to implement. Iam almost certain there are some problems with the implementation at the moment since its giving some strange results in some areas.

Below are some images for comparing with and without indirect lighting; The cornell box scene was converted from Mitsuba.

Comparison with other rendering engines:

cornellbox.png

Area Lights

I have implemented a few more lights; These types of lights belong to a class called area lights.

They have a finite area and are visible to the renderer so we must be able to intersect with them, but also calculate its light contribution. We must be able to sample uniformly over the surface, retrieve the normal, and also the pdf at the sample point with respect to the solid angle as seen from a point.

It is possible that there is a bug in the implementation bacuase the back wall appears too bright; it may be possible that there is a problem with the normals.

Area Lights

Planerender-plane-area-light.png

Sphere

render-sphere-area-light1.png

Mesh

render-mesh-area-light.pngDisc

render-disc-area-light.png

IES Lights

I have implemented IES lights, these are lights based off measured data that are stored in the IES file format. These files store the photometric-web which represents the 3D distribution of candelas of a particular luminaire.

Technical-Description-Final

Sites to download IES profiles

Unfortunely there is a bug I cannot seem to resolve, the problem is the light does not appear to cast any light down on the floor even though the shape appears correctly.

Another problem is for data that has sparse angle increments which causes banding. I probably need to implement a better interpolation algorithm to fix this.

Below are some bugged images:

ies_bug ies_light1

Update: 10/02/2016

Managed to find the bug and fix it. The problem had to do with not using the shading frame to calculate the cosine.

// Wrong
float costheta = Dot(wi, LocalToWorld * intersection.GetNormal());
// Correct
float costheta = OrthonormalBasis::CosTheta(WorldToLocal * wi);

Corrected Images:

A render that uses both IES lights and a dome light in conjunction:

render-ies-envmap.png

 

Importance Sampling – Environment map

I have implemented importance sampling for the enviroment map which really helps in reducing the variance which manifest itself as noise is the rendered image.

importance-sampling-envmap.png
Samples are drawn according the radiance of the pixels
render-provwash-envmap-importance-sampling.png
A comparison between two images rendered with the same amount of samples

References:

http://www.cs.virginia.edu/~gfx/courses/2007/ImageSynthesis/assignments/sampling.html

Physically Based Rendering, Second Edition: From Theory To Implementation