h16 mantra user guide absorption and nested ... - houdini · h16 mantra user guide absorption and...

14
H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such as glass, the material absorbs a certain amount of light. This effect becomes more obvious when the transparent media has been tinted or colored in some way, like stained-glass or fruit-juice. When rendering with Mantra, this effect can be simulated in variety of ways – using a volume to attenuate light as it travels through an object, for instance. However, for simplicity, a set of parameters which allow an artist to quickly achieve the desired look without the need for complex setups have been provided. These parameters can be found on the Principled Shader (As well as the Classic Shader). Transmission Color The color which will be used to tint a ray as it passes through a transparent object. It is important to remember that the amount of tinting is dependant on both the distance the ray has travelled through the object and the At Distance parameter. At Distance This parameter determines how the transmission color affects a ray as it travels through a transparent object. When the distance travelled through an object matches the At Distance parameter, one hundred percent of the Transmission Color will be blended with the result. In cases where the ray does not travel far enough inside the object to reach the At Distance limit, a smaller percentage of the Transmission Color is used. Conversely, if the At Distance limit is reached before the ray has travelled all the way through the object, a darker and more saturated version of the Transmission Color is used.

Upload: dinhminh

Post on 20-Aug-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

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.

Page 2: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

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

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

Page 3: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

Itshouldbenotedthataraydoesnothavetoexitatransparentobjectforabsorptiontotakeplace.Considerthecaseofanopaqueobjectembeddedinatransparentone.Uponenteringthetransparentsurface,therayisstilltaggedwiththerelevantdatatocalculatetheabsorptioncolor.Theonlydifferenceisthatthedistancetravellediscalculatedatthepointtheraycollideswiththeopaqueobjectratherthanuponexitingthetransparentone.

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

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

ABSORPTIONWORKFLOWCONSIDERATIONS

AtDistanceandScaleWhenapplyingashaderwithAbsorption,itisalwaysimportanttorememberthanthatamountofabsorptionwhichoccursisbasedonthedistancetravelledthroughtheobject.Boththetraveldistance

Page 4: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

andtheAtDistanceparameteraremeasuredinWorldSpace.Thismeansthatthescaleofyourobjectcanhavealargeinfluenceonthefinalrenderedresults.Considerthefollowingobjectswiththesameshadersettings:

TheexampleaboveillustrateshowimportantitistodoyourlookdevelopmentonanobjectatthescaleitwillberenderedwhenusingAbsorption.Ifyouweretodoyourshadersetupatonescale,butthentheobjectwasplacedinthefinalsceneatadrasticallydifferentscale,youwillnotgetthesamelook.

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

Page 5: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

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:

Page 6: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

Thesimplestapproachwouldbetomodeleachoftheobjectsseparatelyandsimplyhavethemoverlap.However,ifyouconsiderhowaraywilltravelthrougheachofthetransparentobjects,itquicklybecomesclearthatyouwillgenerateacascadingseriesofincorrectrefractions.

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

Page 7: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

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.

Page 8: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

SurfacePriorityAnumericalvaluewhichestablishesanorderofprecedencefortransparentmaterialsinascene.Avalueof0indicatesthatthesurfacepriorityshouldbeignored.Increasingvaluesindicatelowerpriority.Considerthissimple2dexample.

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

In3d,onrefractivesurfaceswithabsorption,theeffectofsettingcorrectsurfaceprioritycanbedramatic.

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

Page 9: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

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

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

DISPERSION

Inoptics,dispersioncanrefertotheseparationoflightintoitscomponentwavelengthsasittravelsthrougharefractivematerial.Aclassicexampleofthiseffectisthespectrumproducedbylighttravellingthroughadispersiveprism.

Page 10: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

WhenrenderingwithMantra,itispossibletosimulatethiseffectusingtheDispersionparameterincludedonthePrincipledShader(AswellastheClassicShader).

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

Becauseeachrayistaggedwithasinglewavelength,itisimportanttohaveenoughsamplestorepresenttheentirespectrum.Eachrayisrandomlyassignedawavelength;however,someattemptismadetoensurethatthevisiblespectrumisuniformlysampledperPixelSample.

Inthefollowingdiagram,youcanseehowasinglePixelsample,with3secondaryrays,willnotbeabletoadequatelycoverthevisiblespectrum.Thiswillalmostcertainlyresultinnoiseinthefinalrenderas

Page 11: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

eachpixelsamplereturnsarandomdistributionofwavelengths.

However,asthenumberofsecondaryraysareincreased,weseethatmoreofthevisiblespectrumisrepresentedinasinglePixelSample.Thiswillresultinmoreconsistencypixeltopixelandthereforlessnoiseintherender.

Page 12: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

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

Page 13: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

DISPERSIONWORKFLOWCONSIDERATIONS

RemovingNoiseMostoften,noiseinarenderhastheappearanceofsmallchangesinbrightnessfromonepixeltoitsneighbours.Inthecaseofdispersion,thisgrainylookcanbeamplifiedbytheintroductionofcolornoisealongsidethechangesinluminance.

Intheaboveexample,botharesimilarlyunder-sampledbuttheimageontherightappearstoexhibitmuchmorenoise.Thisisbecausesmallchangesinbrightnessarefarlessobviousthandramaticchangeincolorcausedbyinsufficientlysamplingthecolorspectrum.

Ifyoulookcloselyatthewhiteareasofthesphere,you’llseeverysimilarnoisepatterns.However,theimageontherightappearsdramaticallynoisierduetothechromaticnatureofthenoise.Itcanoftenbenecessarytoincreasetheamountofsamplingonobjectswithdispersioncomparedtosimilarobjects

Page 14: H16 Mantra User Guide ABSORPTION AND NESTED ... - Houdini · H16 Mantra User Guide ABSORPTION AND NESTED DIELECTRICS ABSORPTION When light travels through a transparent medium such

H16MantraUserGuide

withoutdispersion.Inthefollowingexample,youcanseethatsignificantlymoresamplingwasrequiredtoachievesimilaramountsofnoisebetweenbothobjects.

Inthiscroppedversion,youcanseethatthewhiteareasofthespheresnowhaveverysimilarnoiselevelsandpatterns.Thisisbecauseenoughofthevisiblespectrumhasbeensampledtoconvergebacktothecolorwhite.But,itrequiredalmosttwicethenumberofsamplestoachievethisresult.

Becauseofthisdifferenceinsampling,itmaybeusefultooverrideRefractionQualityparametersonanytransparentobjectwithdispersionenabled.Thiswayyoucanbesurethatyouaresendingextrarefractionsamplesonlytotheobjectswhichrequirethem.