Top Banner
Bokeh Lens Shader by Ash Aiad Autodesk Media and Entertainment Division Bokeh is a Japanese word for “blurred or fuzzy” (暈け) This is a real life phenomenon that occurs in photography where the light sources in an out of focus area of an image. Different lens Bokeh produces different aesthetic qualities in out of focus backgrounds, which are often used to reduce distractions and emphasize the primary subject. For some real life examples, please visit the Bokeh page on the Wikipedia. We can simulate the same effect in Maya using the Bokeh Lens Shader in mental ray. This is the render without using Bokeh as our starting point. Before After Once mental ray Bokeh Lens Shader is being applied to Maya’s Camera, it will produce the following effect, and much more! Table of content Table of content ........................................................................................................................................... 1 How to simulate Bokeh Lens effect in Maya ............................................................................................... 2 Assign Lens shader to Camera ................................................................................................................. 2 Understanding Bokeh Lens shader .......................................................................................................... 3 Advanced Bokeh Effect ............................................................................................................................ 8
9

Maya Bokeh Lens Shader

Mar 07, 2015

Download

Documents

Kurt Sta Ines
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Maya Bokeh Lens Shader

BokehLensShaderbyAshAiadAutodeskMediaandEntertainmentDivision

BokehisaJapanesewordfor“blurredorfuzzy”(暈け)

Thisisareallifephenomenonthatoccursinphotographywherethelightsourcesinanoutoffocusareaofanimage.DifferentlensBokehproducesdifferentaestheticqualitiesinoutoffocusbackgrounds,whichareoftenusedtoreducedistractionsandemphasizetheprimarysubject.Forsomereallifeexamples,pleasevisittheBokehpageontheWikipedia.

WecansimulatethesameeffectinMayausingtheBokehLensShaderinmentalray.ThisistherenderwithoutusingBokehasourstartingpoint.

Before

After

OncementalrayBokehLensShaderisbeingappliedtoMaya’sCamera,itwillproducethefollowingeffect,andmuchmore!

TableofcontentTableofcontent........................................................................................................................................... 1

HowtosimulateBokehLenseffectinMaya ............................................................................................... 2

AssignLensshadertoCamera ................................................................................................................. 2

UnderstandingBokehLensshader .......................................................................................................... 3

AdvancedBokehEffect ............................................................................................................................ 8

Page 2: Maya Bokeh Lens Shader

HowtosimulateBokehLenseffectinMaya

AssignLensshadertoCameraWestartbyselectingthecameraofchoice,andundertheattributeeditorofthatcamera,clickon“LensShader” toassignamentalrayLensShader.

Under“CreateRenderNode”dialog,openthe“Lenses”verticaltabandlocatethemia_lens_bokehShader.

BydefaulttheBokeheffectwilllooksomethinglikethis

Page 3: Maya Bokeh Lens Shader

Note:TheShaderparametersrelyonthescenesize,thereforeresultswillvaryfromonefiletotheother.

UnderstandingBokehLensshader

On:Thisisatoggleon/offswitchtodisabletheShaderifneeded.Defaultison.Youcanapplyanrenderlayeroverridetodisabletheshaderforspecificrenderlayers,forinstance.

Page 4: Maya Bokeh Lens Shader

Plane:Isthedistancetothefocalplanefromthecamera,i.e.thepointofinterest.Thispointwillbeinfocusandtherestwillbeoutoffocus.

TogettheproperPlanevalue,wewillusethemeasuringtooltogiveusthatdistancefromthecameratothepointofinterest.

YoucanalsousethecameraNear/FarClippingplaneasamethodtodeterminethedistancerequired.

Withaplanevalueat18.8

Page 5: Maya Bokeh Lens Shader

Withaplanevalueat8.7

Radius:Thisistheradiusofconfusion.Thisisanactualmeasurementinsceneunits.Avalueof0willresultwithNoBokeh.Thehigherthevalue,thefurtherawaytheBlurwillaccrue.

Fromlefttoright,Radiusat1.0,0.5and0.0

Samples:Themoresampleswehavethebetterthequalityofthe“blur”,howeverthatcomeswiththeexpenseofrendertime.

Page 6: Maya Bokeh Lens Shader

Fromlefttoright:Sampleat0,24and48

Bias:Lowervaluespushthesampleprobabilitytowardsthecenter,creatinga"softer"lookingDOFeffectwithamore"misty"look.Highervaluespushthesampleprobabilitytowardstheedge,creatinga"harder"lookingDOFwherebrightspotsactuallyresolveassmallcircles.

BladeCount:Thisdefineshowmany"edges"the"circle"ofconfusionhas.Azerovaluemakesitaperfectcircle.Noticetheshapeofthehighlightintheblurredareaoftherenderedimage.

Page 7: Maya Bokeh Lens Shader

Withbiasat0,noticehowtheblurredhighlightsareperfectcircle.

Withbiasat4,noticethe4cornersintheblurredhighlights.

BladeAngle:Onecanalsosettheanglewiththeblade_angleparameter,whichisexpressedfrom0.0to1.0where0.0iszerodegreesand1.0is360degrees.Theeffectwillbemorenoticeablewhenyouhavehardcornerhighlight(forexample,avalue4orgreater).

Page 8: Maya Bokeh Lens Shader

WithBladeAngleat0(0degree)

WithBladeAngleat0.25(90degrees).

AdvancedBokehEffect“UseBokeh”and“Bokehmap”

ThisoptionallowsusinganimageasBokehmap.Whenthisoptionisused,theparameters“bias”,“bladecount”and“bladeangle”havenoeffect.ThemapdefinestheshapeoftheDOFfilterkernel,soafilledwhitecircleonablackbackgroundisequivalenttothestandardblur.Generally,oneneedmoresamplestoaccurately"resolve"acustomBokehmap.

Note:Thesizeofthisimagemapdoesnotcontributetothequalityoftherender.

ThefollowingrenderedimagesdemonstratedifferentcustomBokehmaps.

Page 9: Maya Bokeh Lens Shader