Anda di halaman 1dari 24

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Table of Contents
Description.......................................................................................................................................................... 3 Description.................................................................................................................................................... 3 Getting Started.................................................................................................................................................. 3 Loading the CgFX plug-in.......................................................................................................................3 Creating a CgFX Shader surface node................................................................................................3 Linking the lights......................................................................................................................................... 4 Shader Techinques...................................................................................................................................... !ara"eter Descriptions..................................................................................................................................# Ga""a Correction..................................................................................................................................... # Diffuse Te$ture............................................................................................................................................. # %or"al Te$ture............................................................................................................................................ & %or"al 'ultiplier........................................................................................................................................& (se DXT n" st)le %or"al Te$ture......................................................................................................* Specular Te$ture.......................................................................................................................................... + Specular 'ultiplier..................................................................................................................................... + Gloss Factor................................................................................................................................................ ,(se Specular Te$ture .lpha as Gloss................................................................................................,(se /ard Specularit)..............................................................................................................................,, /ard Spec Gloss (01..............................................................................................................................,, Fresnel Fore2ord...................................................................................................................................... ,3 Fresnel Falloff ."ount............................................................................................................................,3 Fresnel 4$ponent...................................................................................................................................... ,3 Fresnel 5ias................................................................................................................................................. ,3 4n6iron"ent Cu7e 'ap.........................................................................................................................,3 ."7ient Light 'ultiplier.......................................................................................................................,4
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

."7ient 'ip Le6el..................................................................................................................................., ."7ient 8cclusion Te$ture..................................................................................................................., 9eflecti6it) 'ultiplier..............................................................................................................................,# 9eflection 'ip Le6el 'in 0 9eflection 'ip Le6el 'a$................................................................,# 9eflecti6it) Te$ture................................................................................................................................... ,& 4"issi6e Te$ture........................................................................................................................................ ,& 4"issi6e 'ultiplier................................................................................................................................... ,* Skin: (se 5lended %or"als..................................................................................................................,* Skin: 5lend /eights.................................................................................................................................,* Skin: 5lend C)an Suppress....................................................................................................................,+ Skin: Tint 9ed.............................................................................................................................................. ,+ Skin: Ter"inator !ush.............................................................................................................................3Specular and 9eflections on Transp Surf.........................................................................................3Light 4na7led............................................................................................................................................. 3, Light Color................................................................................................................................................... 3, Light ;ntensit)............................................................................................................................................ 3, !oint Light Distance Falloff 4$p...........................................................................................................33 !oint Light Distance Scale.....................................................................................................................33 F.< = Trou7leshooting...............................................................................................................................33 ') shader is all green02hite and nothing see"s to 2ork.......................................................33 The lights see" 6er) >7lo2n out?......................................................................................................33 /hen using transparenc) o7@ects see" to disappear or ha6e shading errors................33 ; get pink error "essages 2hen loading the shader..................................................................33 ;s there no support for shado2sA......................................................................................................33 ; donBt ha6e an) CgFX shader "aterial node.................................................................................34 Credits = Contact ;nfo.................................................................................................................................34

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Description
Description The ?CoddeShader 63.-? is a real-ti"e CgFX shader for .utodesk 'a)a. ;t 2as authored using 'ental 'ill ,.- and %otepadDD. ; created this shader to learn "ore a7out real ti"e shaders and to pro6ide the ga"e art oriented 'a)a co""unit) 2ith a Ega"e likeE 6ie2port shader. This shader has 6er) little focus to2ards 7eing opti"iFed. This guide assu"es that the user has so"e prior 7asic kno2ledge of using .utodesk 'a)a and 3D graphics in general. General ter"s such as a ?%or"al Te$ture? are not e$plained in detail 2hile "ore e$otic ones such as ?5lended (he author on a summer day. %or"als? are.

Getting Started
Loading the CgFX plug-in To use a CgFX shader in 'a)a )ou need to load the ?cgf$Shader."ll? plug-in 2hich co"es 2ith 'a)a. ;t is not loaded 7) default. To load plug-ins go to the /indo2 G Settings0!references G !lug-in 'anager. (he )lug-in Manager. Creating a CgFX Shader surface node Gi6en that the ?cgf$Shader."ll? shader plug-in is loaded )ou should ha6e a ?Cgf$ Shader? surface node in )our H)pershader 4ditor under )our ?Create 'a)a %odes?. Create a ne2 ?Cgf$ Shader? surface node and open it in A *Cgf+ Shader* node. )our attri7ute editor Idou7le click the shaderJ. To the right of the e"pt) ?CgFX File? field click the folder icon to 7ro2se for the e$ternal .cgf$ file. .s )ou open a CgFX file in 'a)a it "ight take a fe2 seconds to full) load depending on the co"ple$it) of the shader. .ppl) the shader to )our o7@ect as (he *CgFX File* field. )ou 2ould 2ith an) other shader in 'a)a. 9e"e"7er to ena7le ?Hard2are Te$turing? I?#? ke)J to see the results in )our 6ie2port.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Linking the lights /ith a CgFX shader )ou ha6e lights contained 2ithin the shader itself. This "eans )ou cannot @ust create a light in 'a)a as usual and e$pect it to 2ork. The t)pe and a"ount of lights possi7le to use 2ith )our CgFX shader is predefined 7) the author of the shader. The ?CoddeShader 63.-? lets )ou use up to 3 directional lights and 3 point lights. .dding "an) light slots to a CgFX shader can increase the loading ti"e and perfor"ance of the shader as 2ell as cluttering the long list of para"eters in the attri7ute editor. Hopefull) the lighting options in the shader 2ill 7e enough for "ost users needs. 9e"e"7er if )ou are lighting a 7ig o7@ect or se6eral o7@ects 2ith the sa"e shader )ou can al2a)s create "ore shader nodes to link e6en "ore lights. The li"it 7eing a "a$i"u" or 3 directional lights and 3 point lights lighting the sa"pled surface point a the sa"e ti"e. This is not counting the ."7ient Light feature. .ll para"eters for the light contained 2ithin the shader. So an) ti"e )ou 2ant to change intensit)K 6ar) the colorK t2eak the falloffK etc. )ou ha6e to go through the shader. The e$ception 7eing the lights direction0position. /hat )ou do 2hen it co"es to a lights direction or position is link this para"eter to an o7@ect in )our scene. Then @ust rotate or position the linked o7@ect to define the lights direction or position.

,in#ing a Maya dire&tional light to the -ire&ational

-ire&tion .arameter.

. tip is to actuall) use the regular 'a)a directional light or point light in 'a)a as the o7@ects to define the shader lights direction0position. The reason for this 7eing that 2hen right-clicking the e"pt) light slots in the shader )ou get a conte$t "enu 2hich lists the lights in )our scene "aking it an quick and eas) 2a). .lso the representations for the directional0point light in the 6ie2port "akes good sense. HereBs a quick step 7) step on ho2 to link a directional light in the shader. ,. Create a regular directional light in 'a)a. %a"e it to so"ething appropriate as )ou 2ill ha6e to select it in a list. 3. 8pen the shader )ou 2ant to link it to in the attri7ute editor. Scroll to the lo2er part 2here the light para"eters are and find the ?Directional , Direction? slot. 3. 9ight-click the e"pt) slot and select Lights G LMourLights%a"eN. 4. 1oilaO That should 7e it. %o2 as )ou rotate the ne2l) created directional light in the scene )ou should see the light on )our shaded o7@ect update.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Warning! Mour linked o7@ectBs scale affects the shaders light. Therefor itBs a good thing not to scale )our linked o7@ect. For an) pol)gonal o7@ect the FreeFe Transfor"ations co""and 2ill sol6e this issueK ho2e6er not for 'a)a lights. ;f )ou are using the regular 'a)a directional or spot light to link )our lights and )ou 2ant the" to appear 7igger tr) this: 8pen )our light in the .ttri7ute editor. 'ake sure )ou are on the lightBs shape ta7. Go to the ?87@ect Displa)? section and increase the ?Locator Scale? attri7ute. This 2ill "ake the lights representation 7igger 2ithout changing the scale 6alues. /hen it co"es to point lights ; donBt kno2 if there is an) 2a) at all to "ake the" ha6e a 7igger representationK not e6en the regular scale see"s to 2ork.

Shader Techinques The ?CoddeShader 63.-? has t2o techniques to choose fro". The) are located at the 6er) top of the shader in the attri7ute editor in the ?CgFX Shader? section. ?%oPTransparenc)? (he (e&hni0ue &hoi&es. This is the regular shading technique. .s the na"e suggests this technique has no for" of transparenc).

S.e&ularity and refle&tions on a semi trans.arent orange surfa&e. (rans.aren&y/using/diffuse/al.ha This technique uses t2o passes per fra"e to achie6e itBs results. The first pass 2ill 7e the regular shading solution 2ith transparenc) according to the diffuse te$tureBs alpha channel. /hite is 6isi7leK 7lack is transparent. The second pass 2ill add specularit) and reflections on transparent surfaces if the option ?Specular and 9eflections on Transp Surf? is checked. This is good for i"itating transparent surfaces such as glassK plasticK etc. Ceep in "ind that 'a)aBs 6ie2port can 7e quite pick) 2ith transparenc) in general.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Para eter Descriptions


Ga a Correction This para"eter 2ill s2itch 7et2een using ga""a correction or not. Ga""a correction gi6es "ore 7elie6a7le lighting results. 'ore to2ards ho2 light 2orks in realit). Technicall) speaking 2hat this "eans is the diffuseK specular Iincluding glossJK en6iron"ent cu7e "apK reflecti6it) and e"issi6e "ap gets con6erted to linear space Ipo2 3.3J as the) are loaded. Then all the shader "agic takes placeK and 7efore displa)ing the shaders results on screen the shader con6erts 7ack to ga""a space Ipo2 ,03.3J.

Left: "amma &orre&ted. 1oti&e the shar. light terminator line. Right: 1on gamma &orre&ted.

Diffuse Te!ture This is 2here )ou load )our diffuse te$ture. ;f )ou 2ant to use transparenc) using the ?Transparenc)PusingPdiffusePalpha? technique then store )our transparenc) data in the diffuse te$tures alpha channel. 'ore on transparenc) in the Getting Started G Shader Techniques.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Left: 2sing a diffuse te+ture. Right: 2sing no diffuse te+ture.

"or al Te!ture This is 2here )ou load )our nor"al te$ture.

Left! 2sing a normal ma.. Right: 2sing no normal ma..

"or al #ultiplier This para"eter lets )ou 6ar) the nor"al te$tureBs effect. (sing a high 6alue 2ill gi6e "ore of the effect. . 6alue of ,.- represents the co""on strength at 2hich a nor"al te$ture 2ould 7e used 2ith. ;f )ou are using the 5lended %or"als feature then tr) pushing this "ultiplier a 7it further. ;B6e found that )ou can generall) push the effect of the nor"al te$ture a 7it further 2hen using 5lended %or"als than )ou 2ould usuall) do.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Left: 2sing 1ormal Multi.lier at .0. Right: 2sing 1ormal Multi.lier at 2.0.

$se DXT%n

st&le "or al Te!ture

This option 2as one ; considered not including at allK 7ut in the end ; kept it. ;f )ou are not using co"pressed te$ture or ha6e no interest in using co"pressed te$tures then thereBs no point in reading on. /hat this feature does is s2itch to using a nor"al te$ture 2hich stores itBs XM data in the 9 and . channels of a te$ture instead of the usual XMQ data in the 9G5 channels. This is purel) an opti"iFation technique used in ga"e de6elop"ent to push the qualit) le6el of a co"pressed nor"al te$ture 2hile still keeping "e"or) siFe do2n. This does cost a 7it "ore perfor"ance as this option 2ill recreate the Q co"ponent in real-ti"e. ; decide to keep this option as it "ight 7e nice for people 2ho 2ant to see the difference of using a DXT, DDS nor"al te$ture co"pared to a DXT n" DDS nor"al te$ture.

An image from a .revious normal te+ture &om.ression study of mine. ,eft! 2sing -X(3nm &om.ression. 4ight! 2sing -X( &om.ression.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Specular Te!ture This is 2here )ou load )our specular te$ture.

1oti&e how the s.e&ular ma. in this shot ma#es the s.e&ularity on different areas vary. For e+am.le the 5rows hardly have any s.e&ularity while the ti. of the nose has lots of s.e&ularity.

Specular #ultiplier This para"eter lets )ou "odulate the specularit)Bs strength. The higher the 6alue the stronger the specularit).

Left: S.e&ular Multi.lier of 0.6. Right: S.e&ular Multi.lier of .6.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Gloss Factor This para"eter controls ho2 gloss)0rough )our specular highlights 2ill 7e. . lo2 6alue 2ill result in a 7road highlight 2hile a high 6alue 2ill result in a narro2 highlight. This 6alue also deter"ines the "ip le6el to 7e used for reflections if )ou are using a proper cu7e "ap te$ture. /ith a good Cu7e 'ap and the ?(se Specular Te$ture .lpha as Gloss? feature ena7led )ou can get reflections to 6ar) fro" 7eing sharp to 7lurred across a surface. 'ore on cu7e "ap "ip le6els in the !ara"eter Descriptions G 9eflection 'ip Le6el 'in0'a$.

Left: A gloss fa&tor value of 7. Right: A gloss fa&tor value of 80.

$se Specular Te!ture 'lpha as Gloss This para"eter ena7les using )our specular te$tures alpha channel as the source for the gloss factor descri7ed a7o6e. ; highl) reco""end )ou use this feature as it is a 6er) i"portant aspect of "i"icking a "aterials real life properties.

Left: 2sing s.e&ular te+tures al.ha &hannel as sour&e for gloss. 1ote the varying glossiness a&ross the model. Right: 1ot using s.e&ular te+tures al.ha as sour&e for gloss.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

$se Ward Specularit& This para"eter ena7les using /ard specularit) as opposed to using the regular !hong 7ased specularit). The /ard 7ased specularit) lets the user change the shape of the specular highlight. This is co""onl) referred to as a anisotropic t)pe of specularit). This is useful for "i"icking specularit) of hairK 6el6etK etc. Since ; found the effect of the nor"al te$ture 6aried a lot fro" using /ard0!hong specularit) the /ard specularit) "ethod has an internal "ultiplier of itBs nor"al te$ture effect 7) $,-.

Left: 2sing 9ard s.e&ularity. Right: 2sing the default )hong s.e&ularity.

Ward Spec Gloss $() These t2o para"eters control the shape of the /ard specular highlight. Lo2 6alues produce a 7road highlight and high 6alues a narro2 highlight. The further apart the ( and 1 6alues are fro" each other the "ore ?stretched? the highlight 2ill 7e. The closer the ( and 1 6alues are to each other the "ore unifor" the highlight 2ill 7e.

Left: An 2': value of 3';0. Right: An 2': value of 3' 3.


20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Fresnel Fore*ord The Fresnel features in this shader are 7ased around a surfaceBs nor"al 6ector to2ards the ca"era. The illustrations for the Fresnel para"eters 7elo2 are perfectl) round pol)gonal spheres. The Fresnel effect "odulates the specularit) and reflecti6it) of this shader. . 2hite color represents 2here specularit)0reflections 2ill 7e applied and a 7lack color represents 2here the) 2ill not 7e applied.

Fresnel Falloff ' ount This para"eter controls ho2 "uch of the Fresnel falloff effect 2ill 7e applied. . high 6alue "eans that the 2hite area 2ill start creeping 7ack to2ards surfaces 2hich are at "ore glancing angles Ifacing a2a) fro" ca"eraJ. This is the 7ase para"eter for the other t2o Fresnel para"eters. ;f this is left at -.- the other t2o Fresnel para"eters 2ill ha6e no effect.

Left: Fresnel falloff amount of 0.0. Right: Fresnel falloff amount of .0.

Fresnel +!ponent This para"eter controls the e$ponential t)pe of cur6ature to the Fresnel falloff. . 6alue of ,.- 2ill lea6e the falloff effect 7eing linear. . 6alue higher than ,.- 2ill gi6e an e$ponential ?do2n? t)pe effectK the 2hite 2ill "ostl) 7e apparent at 6er) glancing angles. . 6alue lo2er than ,.- 2ill gi6e an e$ponential ?up? t)pe effectK the 2hite 2ill 7e apparent on "ost angles e$cept the ones 2hich are facing directl) to2ards the ca"era Ior close to directl)J. Technicall) speaking this is a !o2er 8f "athe"atical function.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Left: Fresnel <+.onent of .0. Right: Fresnel <+.onent of ;.0.

Fresnel ,ias This para"eter 2ill shift the darkest color fro" 7lack to 2hite the higher the supplied 6alue is. This para"eter is intended to 7e used 2ithin the -.--,.- range. This is useful if )ou donBt 2ant the specularit) or reflections to co"pletel) 7e re"o6ed fro" surfaces facing the ca"era 7ut still 2ant to "odulate the" 7) a Fresnel effect.

Left: Fresnel 5ias of 0.0. Right: Fresnel 5ias of 0.8.

+n-iron ent Cu.e #ap This is 2here )ou load )our cu7e "ap 2hich 2ill 7e used as the reflections and a"7ient light source. This te$ture needs to 7e in the DDS for"at and sa6ed as a %6idia HoriFontal Strip t)pe cu7e "ap. /hen processing cu7e "aps ; can personall) reco""end the .T; Cu7e'apGen soft2are. ;t has so"e great tools including proper 7lurring of cu7e "aps.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

To get the "ost of the ?."7ient 'ip Le6el?K ?9eflection 'ip Le6el 'in? and ?9eflection 'ip Le6el 'a$? features descri7ed further on )ou 2ant to consider 7lurring0sharpening )our cu7e "ap "ip le6els according to the effect )ou 2ant to achie6e. For e$a"pleK if )ou pre7lur )our "ip le6els )ou can use the "ip le6el para"eters to 6ar) )our a"7ient light or reflections fro" 7eing sharp to 7eing 7lurr).

Cu5e ma. refle&tions using .re-5lurred mi. levels. (he three &o.ies of the model use different mi. levels to show the a&hieved effe&t.

' .ient Light #ultiplier This para"eter controls ho2 "uch a"7ient light )ou 2ant to add to )our shader. The higher the a"7ient light "ultiplier 6alue the "ore a"7ient light. This feature requires that )ou ha6e loaded a cu7e "ap as this 2ill 7e used as )our a"7ient light source.

Left: 2sing am5ient light multi.lier of 0.0. Right: 2sing am5ient light multi.lier of 0.07.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

' .ient #ip Le-el This para"eter directl) controls 2hich cu7e "ap "ip le6el 2ill 7e used as the a"7ient light source.

Left: 2sing a higher =low value> mi. level resulting in more shar. am5ient light? you &an ma#e out sha.es. Right: 2sing a lower =high value> mi. level resulting in a more 5lurred am5ient light.

' .ient /cclusion Te!ture This is 2here )ou load )our a"7ient occlusion te$ture. . te$ture 2hich 7asicall) "asks 2here a"7ient light 2ill 7e applied and 2here it 2onBt 7e.

Left: 2sing an am5ient o&&lusion te+ture. 1ote the dar# areas where the li.s meet? in the nostrils? around the eyes? et&. Right: 2sing no am5ient o&&lusion te+ture. For illustrative reasons this shot only uses + .0 am5ient light as its only light sour&e.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

0eflecti-it& #ultiplier This para"eter controls strength of the reflections 7eing applied to )our shader. The higher the 6alue the stronger the reflections. This feature requires that )ou ha6e loaded a cu7e "ap as this 2ill 7e used as )our reflections source.

Left: 2sing a refle&tivity multi.lier of 0.8. Right: 2sing a refle&tivitiy multi.lier of .8.

0eflection #ip Le-el #in ( 0eflection #ip Le-el #a! These para"eters are used to control 2hich "ip le6elIsJ the reflections 2ill use. ;f )ou are not using the ?(se Specular Te$ture .lpha as Gloss? feature the ?9eflection 'ip Le6el 'a$? para"eter 2ill control 2hich "ip le6el 2ill 7e unifor"l) used on )our surface. ;f )ou are using the ?(se Specular Te$ture .lpha as Gloss? feature then )our gloss te$ture data 2ill 7e used in the equation. The ?9eflection 'ip Le6el 'in? 2ill represent the "ip le6el that 7lack te$ture areas 2ill 7e using and the ?9eflection 'ip Le6el 'a$? 2ill represent the "ip le6el that 2hite te$ture areas 2ill 7e using. .ll 6alues in 7et2een 2ill interpolate accordingl).

Left: 2sing varying refle&tion mi. levels to a&hieve a more *smudged* a..earan&e on the glass near the frame. Right: 2sing a uniform mi. level a&ross all of the glass surfa&e.

An e+aggerated e+am.le of varying mi. levels for a 5lurred effe&t a&ross a model.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

0eflecti-it& Te!ture This is 2here )ou load )our reflecti6it) te$ture 2hich 2ill essentiall) "ask 2hich areas 2ill 7e reflecti6e and 2hich 2ill not. . 2hite color reflects full) 2hile a 7lack color 2onBt reflect at all.

A highly refle&tive nose a&hieved 5y a refle&tivity te+ture with white &oloring on the nose te+ture area.

+ issi-e Te!ture This is 2here )ou load )our e"issi6e te$ture. 4"issi6e in the sense that it 2ill see" ?full 7right?. This does not e"it an) light or add an) glo2. This feature adds the colors )ou place in )our te$ture to )our current shading solution.

<missive te+ture 5eing used to simulate some form of red glow around the models eyes.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

+ issi-e #ultiplier This para"eter controls the strength of the e"issi6e addition. . 6alue of ,.- 2ill add the e$act a"ount of colors in the te$ture. 9aising or lo2ering the 6alue 7e)ond ,.- 2ill strengthen or 2eaken the effect.

Left: An emissive multi.lier value of 0.3. Right: An emissive multi.lier value of 2.0.

Skin1 $se ,lended "or als The para"eter ena7les the use of ?7lended nor"als?. . quite si"ple trick 2hich produces a quite soothing red skin tone in fine detail areas 2hich 2ould nor"all) 7e 7lack. This feature 2orks in con@unction 2ith the details in )our nor"al te$ture to "odif) the diffuse light 7ase. For instance a s"all skin 7u"p present in )our nor"al te$ture 2ould ha6e a dark side on the "odel 2hen 7eing lit fro" the sideK 2hen using 7lended nor"als )ou can "ake it see" red rather than 7lack on this dark side. This illustration sa)s it all:

Left: 2sing 5lended normals. Right: 1ot using 5lended normals.

Skin1 ,lend Weights This para"eter contains three 6alues 2hich control ho2 the actual 7lending of nor"als 2ork. Technicall) speaking setting a 6alue in the lo2 end 2ill "ake that color channel lean "ore to2ards using the geo"etr) nor"als. Setting a 6alue in the high end 2ill "ake that color channel lean "ore to2ards using the nor"al te$ture "odified nor"als. These 6alues 2ork 2ithin the -.--,.- range. To "i"ic a skin look )ou 2ant to set the first 6alue I9edJ to a
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

rather lo2 6alue and the other t2o 6alues IGreen = 5lueJ to rather high 6alues. The default 6alues are set to -.3K -.*K -.+ as these 2ork quite 2ell for skin.

Left: 2sing 5lend weights of 0.;? 0.6? 0.@. Right: 2sing 5lend weights of 0.0? .0? .0.

Skin1 ,lend C&an Suppress This para"eter can 7e used to suppress the c)an color 2hich is a 7i-product of ena7ling 7lended nor"als and setting the 7lend 2eights to "i"ic skin. The higher this para"eter 6alue is set the "ore c)an 2ill 7e suppressed.

Left: 2sing a 5lend &yan su..ress value of 0.@3. Right: 2sing no 5lend &yan su..ress at all.

Skin1 Tint 0ed This para"eter 2ill add so"e red coloring to the darker areas of the diffuse lighting. 'eaning that full) lit areas 2ill 7e unchanged 2hile darker areas 2ill recei6e this red tint. The higher this para"eter 6alue the "ore red tint. This is supposed to "i"ic a 7it of the scattering of light in the skin.

Left: A tint red value of .0. Right: A tint red value of 0.0.
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Skin1 Ter inator Push This para"eter 2ill essentiall) push 7ack the light ter"inator line the higher the para"eter 6alue is set. This is intended for "i"icking ho2 light 2ould scatter inside the skin and ?reach? a 7it 7e)ond 2here the light 2ould end if the o7@ect 2as co"pletel) opaque.

Left: 2sing a terminator .ush value of 0.23. Right: 2sing a terminator .ush value of 0.0.

Specular and 0eflections on Transp Surf This para"eter ena7les specular highlight and reflections to appear on transparent areas of a "odel. For "ore infor"ation on transparenc) in this shader please refer to the Getting Started G Shader Techniques.

A s.heriAed .olygon .lane with trans.arent areas whi&h re&eive s.e&ularity and refle&tions. (he .lane in the 5a&#ground is there to a&&entuate the trans.aren&y. Bes there is a .i&#et fen&e in the &u5e ma..

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Light +na.led This para"eter e$ists on all lights and 7asicall) ena7les0disa7les the current light. This is useful if )ou @ust te"poraril) 2ant to disa7le a light 2ithout ha6ing to change itBs intensit) para"eter 7ack and forth.

(he *,ight <na5led* .arameter.

Light Color This para"eter e$ists on all lights and is used to set the light color.

Left: )ur.le &olored light. Right: ,ime green &olored light.

Light 2ntensit& This para"eter e$ists on all lights and controls the lights intensit). . high para"eter 6alue 2ill result in a intense light and 6ice 6ersa.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Left: ,ight intensity of 8.0. Right: ,ight intensity of .0.

Point Light Distance Falloff +!p This para"eter 2ill appl) and e$ponential t)pe of cur6ature to )our point lightBs falloff distance. . higher para"eter 6alue 2ill gi6e "ore of this effect.

Left: A distan&e falloff e+.onent of .;? light intensity in&reased to a&hieve similar intensity at light &enter .oint. Right: A distan&e falloff e+.onent of 0.0.

Point Light Distance Scale This para"eter 2orks in con@unction 2ith the Distance Falloff 4$ponent and 2ill scale the distance of the lights reach.

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

Left: A 0uite low distan&e s&ale value. Right: A rather high distan&e s&ale value.

F'3 4 Trou.leshooting
#& shader is all green(*hite and nothing see s to *ork5 Mou pro7a7l) forgot to ena7le >Hard2are Te$turing? in )our specific 'a)a 6ie2port. Mou can ena7le this in the 6ie2ports >Shading? "enu or 7) pressing >#? on )our ke)7oard. The lights see -er& 6.lo*n out75

Check and "ake sure that )ou did not scale )our o7@ect 2hich )ou ha6e linked to a shader lights direction0position slot. 'ore a7out this issue in the Getting Started G Linking the lightsK at the end in the 2arning note. When using transparenc& o.8ects see to disappear or ha-e shading errors5

This is due to 'a)a ha6ing trou7le handling transparenc) properl). .s far as ; ha6e 7een a7le to tell this issue see"s "ostl) related to using se6eral la)ers of transparenc) and ha6ing se"i-transparent transparenc) Inot ,-7itJ. (nfortunatel) thereBs not "uch ; ha6e 7een a7le to find out or 7een a7le to do to re"ed) this issue. 2 get pink error essages *hen loading the shader5

So do ;. To ") kno2ledge this is an error 2hich co"es along 2ith e$porting 'ental 'ill CgFX shaders. ;t does not see" to ha6e an) actual effect on the shading results 7ut ; also find it anno)ing. ;f so"eone kno2s ho2 to get rid of these then please do send "e an e"ail and ; shall fore6er 7e grateful. 2s there no support for shado*s9 This is an issue 2here 'a)a li"its authoring real-ti"e shaders as far as ; kno2. 'a)a does ha6e so"e for" of real ti"e shaders 2ith itBs nati6e directional light and correct 6ie2port settings. 5ut 7e)ond this ; ha6e )et to seen an e$ternal real-ti"e shader produce an)
20 0-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader

A guide on how to use the real-time CgFX shader KoddeShader v2.0 for Maya .

shado2s in 'a)a nor ha6e ; found an) infor"ation pointing to2ards this 7eing possi7le. 2 don:t ha-e an& CgFX shader aterial node5

Then )ou pro7a7l) forgot to load the >cgf$Shader."ll? plug-in or 'a)a doesnBt like )ou and didnBt load the plug-in this ti"e around 2hen starting 'a)a. 'ore info a7out this in the Getting Started G Loading the CgFX Shader plug-in.

Credits 4 Contact 2nfo


.uthor: Costas Gialitakis kostas.gialitakisRg"ail.co" http:00222.kostas.se0shader http:00222.linkedin.co"0in0kostasg The head "odelK the head "odelBs diffuse te$ture and the head "odelBs nor"al "ap are those of Lee !err)-S"ith. . 7ig thanks for sharing these 2ith the 3D co""unit). For so"e of the e$a"ple i"ages using a Cu7e 'ap ;B6e used a fe2 HD9 pro7es fro" Ceith 5urns site. Thanks Ceith. /hen "aking this guide ; searched for a screenshot application 2hich 2ould include the "ouse cursor. ; found a free application called ?!rt Scr? 2hich did the @o7 2ell. ; didnBt e$pect to find such a potent application for free so it gets a "ention in this docu"ent. Shout out to e6er)one on the pol)count 7oardsO

20 0-

-02 Author! Kostas "ialita#is $ #ostas.gialita#is%gmail.&om $ www.#ostas.se'shader