Documente Academic
Documente Profesional
Documente Cultură
AutodeskMediaandEntertainmentDivision
BokehisaJapanesewordforblurredorfuzzy()
Thisisareallifephenomenonthatoccursinphotographywherethelightsourcesin
anoutoffocusareaofanimage.DifferentlensBokehproducesdifferentaesthetic
qualitiesinoutoffocusbackgrounds,whichareoftenusedtoreducedistractions
andemphasizetheprimarysubject.Forsomereallifeexamples,pleasevisitthe
BokehpageontheWikipedia.
WecansimulatethesameeffectinMayausingtheBokehLensShaderinmentalray.
ThisistherenderwithoutusingBokehasourstartingpoint.
Before
After
OncementalrayBokehLensShaderis
beingappliedtoMayasCamera,itwill
producethefollowingeffect,andmuch
more!
Tableofcontent
Tableofcontent........................................................................................................................................... 1
HowtosimulateBokehLenseffectinMaya ............................................................................................... 2
AssignLensshadertoCamera ................................................................................................................. 2
UnderstandingBokehLensshader .......................................................................................................... 3
AdvancedBokehEffect ............................................................................................................................ 8
HowtosimulateBokehLenseffectinMaya
AssignLensshadertoCamera
Westartbyselectingthecameraofchoice,andundertheattributeeditorof
thatcamera,clickonLensShader
toassignamentalrayLensShader.
UnderCreateRenderNodedialog,opentheLensesverticaltabandlocate
themia_lens_bokehShader.
BydefaulttheBokeheffectwilllooksomethinglikethis
Note:TheShaderparametersrelyonthescenesize,thereforeresultswill
varyfromonefiletotheother.
UnderstandingBokehLensshader
On:
Thisisatoggleon/offswitchtodisabletheShaderifneeded.Defaultison.
Youcanapplyanrenderlayeroverridetodisabletheshaderforspecific
renderlayers,forinstance.
Plane:
Isthedistancetothefocalplanefromthecamera,i.e.thepointofinterest.
Thispointwillbeinfocusandtherestwillbeoutoffocus.
TogettheproperPlanevalue,wewillusethemeasuringtooltogiveusthat
distancefromthecameratothepointofinterest.
YoucanalsousethecameraNear/FarClippingplaneasamethodto
determinethedistancerequired.
Withaplanevalueat18.8
Withaplanevalueat8.7
Radius:
Thisistheradiusofconfusion.Thisisanactualmeasurementinsceneunits.
Avalueof0willresultwithNoBokeh.Thehigherthevalue,thefurtheraway
theBlurwillaccrue.
Fromlefttoright,Radiusat1.0,0.5and0.0
Samples:
Themoresampleswehavethebetterthequalityoftheblur,howeverthat
comeswiththeexpenseofrendertime.
Fromlefttoright:Sampleat0,24and48
Bias:
Lowervaluespushthesampleprobabilitytowardsthecenter,creatinga
"softer"lookingDOFeffectwithamore"misty"look.Highervaluespushthe
sampleprobabilitytowardstheedge,creatinga"harder"lookingDOFwhere
brightspotsactuallyresolveassmallcircles.
BladeCount:
Thisdefineshowmany"edges"the"circle"ofconfusionhas.Azerovalue
makesitaperfectcircle.Noticetheshapeofthehighlightintheblurredarea
oftherenderedimage.
Withbiasat0,noticehowtheblurredhighlightsareperfectcircle.
Withbiasat4,noticethe4cornersintheblurredhighlights.
BladeAngle:
Onecanalsosettheanglewiththeblade_angleparameter,whichis
expressedfrom0.0to1.0where0.0iszerodegreesand1.0is360degrees.
Theeffectwillbemorenoticeablewhenyouhavehardcornerhighlight(for
example,avalue4orgreater).
WithBladeAngleat0(0degree)
WithBladeAngleat0.25(90degrees).
AdvancedBokehEffect
UseBokehandBokehmap
ThisoptionallowsusinganimageasBokehmap.Whenthisoptionisused,
theparametersbias,bladecountandbladeanglehavenoeffect.The
mapdefinestheshapeoftheDOFfilterkernel,soafilledwhitecircleona
blackbackgroundisequivalenttothestandardblur.Generally,oneneed
moresamplestoaccurately"resolve"acustomBokehmap.
Note:Thesizeofthisimagemapdoesnotcontributetothequalityofthe
render.
ThefollowingrenderedimagesdemonstratedifferentcustomBokehmaps.