H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND...

Post on 20-Aug-2018

229 views 0 download

Transcript of H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND...

H16MantraUserGuide

ABSORPTIONANDNESTED

DIELECTRICS

ABSORPTION

Whenlighttravelsthroughatransparentmediumsuchasglass,thematerialabsorbsacertainamountoflight.Thiseffectbecomesmoreobviouswhenthetransparentmediahasbeentintedorcoloredinsomeway,likestained-glassorfruit-juice.

WhenrenderingwithMantra,thiseffectcanbesimulatedinvarietyofways–usingavolumetoattenuatelightasittravelsthroughanobject,forinstance.However,forsimplicity,asetofparameterswhichallowanartisttoquicklyachievethedesiredlookwithouttheneedforcomplexsetupshavebeenprovided.TheseparameterscanbefoundonthePrincipledShader(AswellastheClassicShader).

TransmissionColorThecolorwhichwillbeusedtotintarayasitpassesthroughatransparentobject.ItisimportanttorememberthattheamountoftintingisdependantonboththedistancetherayhastravelledthroughtheobjectandtheAtDistanceparameter.

AtDistanceThisparameterdetermineshowthetransmissioncoloraffectsarayasittravelsthroughatransparentobject.WhenthedistancetravelledthroughanobjectmatchestheAtDistanceparameter,onehundredpercentoftheTransmissionColorwillbeblendedwiththeresult.IncaseswheretheraydoesnottravelfarenoughinsidetheobjecttoreachtheAtDistancelimit,asmallerpercentageoftheTransmissionColorisused.Conversely,iftheAtDistancelimitisreachedbeforetherayhastravelledallthewaythroughtheobject,adarkerandmoresaturatedversionoftheTransmissionColorisused.

H16MantraUserGuide

Forsimplicity,imaginethateachraywhichencountersatransparentsurfaceis“tagged”withdatalikethehitlocation,TransmissionColor,andAtDistancevalue.Whenthisrayhitstheothersideofthetransparentobject,itcannowusethisdatatocalculatehowfarithastravelledandthereforehowtoapplytheTransmissionColor.Eventually,thisraymayhitanopaqueobjectwhereitevaluatesthesurfaceshaderandcombinestheresultwiththepreviouslycalculatedabsorptioncolor.

Usingthismethod,itispossibletoaccumulateabsorptioncolorsacrossmultiple,non-overlapping,transparentobjects.(Forasolutiontooverlappingtransparentobjects,seethesectiononNestedDielectrics)Essentially,theprocessoftaggingarayandcalculatingitscolorcanberepeatedforeverytransparentobjectencountered.Ratherthanreplacingtheabsorptioncolor,thevaluesaremultipliedtogetherbeforebeingcombinedwiththecolorreturneduponhittinganopaqueobject.

H16MantraUserGuide

Itshouldbenotedthataraydoesnothavetoexitatransparentobjectforabsorptiontotakeplace.Considerthecaseofanopaqueobjectembeddedinatransparentone.Uponenteringthetransparentsurface,therayisstilltaggedwiththerelevantdatatocalculatetheabsorptioncolor.Theonlydifferenceisthatthedistancetravellediscalculatedatthepointtheraycollideswiththeopaqueobjectratherthanuponexitingthetransparentone.

Additionally,thetransparentobjectdoesnothavetobeaclosedsurface-singlesidedsurfacescantakeadvantageofabsorptionaswell.Forplaceswherearaydoesnotcollidewithanotherobjectinthescene,theabsorptioninformationisdiscardedandthecolorblackisreturned.(Essentiallytreatingtheone-sidedsurfaceasaninfinitelyDeeptransparentobjectwhichabsorbsalllight)

NOTE:AlimitationofOne-SidedtransparentsurfacesisthattheabsorptioncolorwillnotbeappliedtoLightObjectsseenthroughtransparentsurfaces.Ifthiseffectisrequired,consideraddingdepthtoyourtransparentobject,orcreatingemissivegeometryasastand-inforyourlight.

ABSORPTIONWORKFLOWCONSIDERATIONS

AtDistanceandScaleWhenapplyingashaderwithAbsorption,itisalwaysimportanttorememberthanthatamountofabsorptionwhichoccursisbasedonthedistancetravelledthroughtheobject.Boththetraveldistance

H16MantraUserGuide

andtheAtDistanceparameteraremeasuredinWorldSpace.Thismeansthatthescaleofyourobjectcanhavealargeinfluenceonthefinalrenderedresults.Considerthefollowingobjectswiththesameshadersettings:

TheexampleaboveillustrateshowimportantitistodoyourlookdevelopmentonanobjectatthescaleitwillberenderedwhenusingAbsorption.Ifyouweretodoyourshadersetupatonescale,butthentheobjectwasplacedinthefinalsceneatadrasticallydifferentscale,youwillnotgetthesamelook.

AbsorptionandCameraPositionAsexplainedabove,absorptionworksbytaggingraysthathaveintersectedwithtransparentobjectswithusefulpiecesofdata.OnlywhenarayintersectsasurfacewhichisfacingthecamerawillthisinformationbeConsidered(Thisallowsmantratotrackwhenarayentersanobjectversuswhenitleavesanobject).However,thisalsomeansthatplacingacamerainsideatransparentobjectwillnotgeneratecorrectresults.

H16MantraUserGuide

NoticehowtheTransmissionColorhasbeenlostwhenthecameraisplacedinsidetheobject.Therayleavesthecameraandintersectswiththeinsideofthesphereasitleavesthetransparentobject-itneverreceivesinformationaboutwhenitenteredthesphere,soisunabletocalculatethedistancetravelled.

AbsorptionandVolumetricEffectsAbsorptionisaverysimplebuteffectivewayofrepresentingtheattenuationoflightthroughatransparentmedium.However,becauseitisnotatrulyvolumetriceffect,itisnotappropriateforrepresentingalltypesoflightingeffects.Insomeobjects,theattenuationoflightiscausedbyparticulatemattersuspendedinthemedium,theseparticlescanbothabsorbandscatterlight.Consideralargefluideffectlikeanocean:

Youcanseethatwhiletheoceansurfacehasarealisticfeelingofdepthusingabsorption,onlythetruevolumetricrenderingdisplaysthecharacteristiclightscatteringofarealocean.Unfortunately,volumesarecostlytorender,sosomeconsiderationmustbegiventothequalityofarenderversusthespeed.Inmanycases,likeaswimmingpoolorshallowriver,absorptionmaybesufficienttoachievethedesiredresultwithoutalossinquality.

NESTEDDIELECTRICS

Renderingmultipletransparentobjectswhichareembeddedinsideeachotherisacomplextask,bothfromthepointofviewoftherendererbutalsofromthepointoftheoftheartistbuildingthescene.Considerthefollowingexample:

H16MantraUserGuide

Thesimplestapproachwouldbetomodeleachoftheobjectsseparatelyandsimplyhavethemoverlap.However,ifyouconsiderhowaraywilltravelthrougheachofthetransparentobjects,itquicklybecomesclearthatyouwillgenerateacascadingseriesofincorrectrefractions.

Tomakemattersworse,notonlywillraysrefractincorrectly,buttherewillbesurfacesinplaceswherenoneshouldexist(Fluidintersectingtheicecubes,glassIntersectingthefluid).Eachoneoftheseerrorscompoundsthenextcreatingapoorrender.Inthediagramabove,everyreddotisanincorrectlyevaluatedsurface.Thismethodisgoodintermsofworkflow,butpoorintermsoftheresult.

H16MantraUserGuide

Analternativemethodwouldbetomodeleachobjectwithoutoverlaps.Thismeansfittingthefluidtotheglassandcarvingholesinthefluidtomakeroomfortheicecubes.

Unfortunately,thisisnotenoughtocorrectlyrenderthisscene.Inthediagramabove,theBlueDotsindicatewherearaywillneedtotravelthroughcoincidentsurfaces.Torenderthisscenecorrectly,thosesurfaceswouldneedtohaveaspecialsetofIORvaluestocorrectlytransitionfromonematerialtoanother(Glass,water,andiceallhavedifferentIOvalues).Whilethissetupwouldresultinabetterfinalrender,theworkrequiredisbothtediousanderrorprone.Additionally,precisionerrorsmayarisefromcompletelycoincidentsurfaces.Tocorrectforthis,youmayrequireasmallgapbetweeneachmaterial,butthiswillnotgivephysicallycorrectresults.

Thebestsolutionwouldtobesimplyoverlaptheobjects,butsomehowlettherendererknowwhichobjectsshouldhaveprecedenceoverothers.Insomesense,itwouldbelikeaskingMantratoremovetheoverlapsatrendertime.

ThisistheconceptbehindNestedDielectrics.Byprovidinganumberwhichrepresentsthepriorityofamaterial,Mantracantrackwhichobjectarayhasenteredandsimplyignoresurfaceswhichhavealowerpriority.Toachievethis,thePrincipledShader(aswellastheClassicShader)hasaparametercalledSurfacePriority.

Simplybysettingthissurfacepriority,Mantrawouldknowbothwhereandhowarayshouldtransitionfromonetransparentmaterialtotheother,correctlycalculatingtheIORvaluesasitgoes.Intheaboveexample,theglasswouldhavethehighestpriority,followedbytheice,andfinallythewater.

H16MantraUserGuide

SurfacePriorityAnumericalvaluewhichestablishesanorderofprecedencefortransparentmaterialsinascene.Avalueof0indicatesthatthesurfacepriorityshouldbeignored.Increasingvaluesindicatelowerpriority.Considerthissimple2dexample.

Noticethatwhenallcircleshaveequalpriority,theysimplyoverlap,creatingmultipleintersectingsurfaces.However,asthepriorityvalueisincreasedforthegreenandbluecircle,theinteriorsurfacesareremoved.

In3d,onrefractivesurfaceswithabsorption,theeffectofsettingcorrectsurfaceprioritycanbedramatic.

Intheaboverender,boththeredsphereandtheblueboxhavethesamesurfacepriority.Youcanimmediatelyseetheproblemsinboththerefractionandabsorption.TheseproblemsarisebecauseitisuncleartoMantrawhichsurfaceis“inside”anothersurfaceandthereforeitcannotcorrectlycalculatetheresult.

H16MantraUserGuide

Inthiscase,theredspherehasahigherprioritythanthebluebox(Remember,lowernumbersmeanhigherpriority.RedSphere=1,BlueBox=2).Theabsorptionandrefractiononthepartsofthesphereinsidetheboxisnowcorrectanditappearsasifthereisnooverlapbetweenthetwoobjects.MantrasimplyignoreswhicheverpartsoftheBlueBoxhaveoverlappedtheRedSphere.ThissetupwouldworkwellforsomethinglikeIceCubesfloatinginWater.

Intheaboveexample,theSurfacePriorityvalueshavebeenswitched(BlueBox=1,RedSphere=2).Thishastheeffectofremovinganypartsoftheredspherewhichoverlappedthebluebox.Thiswouldbeanidealsetupforhavingwaterdropletsrestingonthesurfaceofaglass.

DISPERSION

Inoptics,dispersioncanrefertotheseparationoflightintoitscomponentwavelengthsasittravelsthrougharefractivematerial.Aclassicexampleofthiseffectisthespectrumproducedbylighttravellingthroughadispersiveprism.

H16MantraUserGuide

WhenrenderingwithMantra,itispossibletosimulatethiseffectusingtheDispersionparameterincludedonthePrincipledShader(AswellastheClassicShader).

DispersionWhenthisparameterissettoanon-zerovalue,refractedraysaretaggedwithasinglewavelengthinthevisiblespectrum.EachofthesewavelengthsmodifytheunderlyingIORcausingtheraystoseparateastheytravelthroughtherefractivematerial.Thelargerthisvalue,thelargertheseparation.

Becauseeachrayistaggedwithasinglewavelength,itisimportanttohaveenoughsamplestorepresenttheentirespectrum.Eachrayisrandomlyassignedawavelength;however,someattemptismadetoensurethatthevisiblespectrumisuniformlysampledperPixelSample.

Inthefollowingdiagram,youcanseehowasinglePixelsample,with3secondaryrays,willnotbeabletoadequatelycoverthevisiblespectrum.Thiswillalmostcertainlyresultinnoiseinthefinalrenderas

H16MantraUserGuide

eachpixelsamplereturnsarandomdistributionofwavelengths.

However,asthenumberofsecondaryraysareincreased,weseethatmoreofthevisiblespectrumisrepresentedinasinglePixelSample.Thiswillresultinmoreconsistencypixeltopixelandthereforlessnoiseintherender.

H16MantraUserGuide

ThefollowingsequenceofrendersdemonstratehownoisefromDispersionchangeswiththenumberofsecondaryrays.Ontheleft,withonly1PixelSampleand1SecondaryRay,eachpixelessentiallyreceivesarandomcolorfromthevisiblespectrum.Asthenumberofsecondaryraysisincreasedto5,25and100,thenoisecausedbydispersioniscompletelyresolved.

H16MantraUserGuide

DISPERSIONWORKFLOWCONSIDERATIONS

RemovingNoiseMostoften,noiseinarenderhastheappearanceofsmallchangesinbrightnessfromonepixeltoitsneighbours.Inthecaseofdispersion,thisgrainylookcanbeamplifiedbytheintroductionofcolornoisealongsidethechangesinluminance.

Intheaboveexample,botharesimilarlyunder-sampledbuttheimageontherightappearstoexhibitmuchmorenoise.Thisisbecausesmallchangesinbrightnessarefarlessobviousthandramaticchangeincolorcausedbyinsufficientlysamplingthecolorspectrum.

Ifyoulookcloselyatthewhiteareasofthesphere,you’llseeverysimilarnoisepatterns.However,theimageontherightappearsdramaticallynoisierduetothechromaticnatureofthenoise.Itcanoftenbenecessarytoincreasetheamountofsamplingonobjectswithdispersioncomparedtosimilarobjects

H16MantraUserGuide

withoutdispersion.Inthefollowingexample,youcanseethatsignificantlymoresamplingwasrequiredtoachievesimilaramountsofnoisebetweenbothobjects.

Inthiscroppedversion,youcanseethatthewhiteareasofthespheresnowhaveverysimilarnoiselevelsandpatterns.Thisisbecauseenoughofthevisiblespectrumhasbeensampledtoconvergebacktothecolorwhite.But,itrequiredalmosttwicethenumberofsamplestoachievethisresult.

Becauseofthisdifferenceinsampling,itmaybeusefultooverrideRefractionQualityparametersonanytransparentobjectwithdispersionenabled.Thiswayyoucanbesurethatyouaresendingextrarefractionsamplesonlytotheobjectswhichrequirethem.