Figure 8.10

The ObjectIDAssigner MAXScript window

7. To verify that objects have unique ObjectlDs, choose an object at random and check its properties: Click the roof object in the viewport. Right-click and choose Properties. Verify that the object has a nonzero Object Channel number. Click Cancel.

8. Now use the second MAXScript to render the special image channels discussed earlier: Click the Open Script button in the MAXScript rollout and select the file Channe1Renderer0.3.ms from the companion CD. Figure 8.11 shows the MAXScript window. Even if you don't understand the language, scan the code to get a sense of what this script is doing; you will probably understand more than you might suppose. Choose File > Evaluate All from the MAXScript window. Then close the window.

ChannelRenderer saves the ObjectID, Normal, and Zdepth image channels as Portable Network Graphics files (called ping, or .png, files) when it is applied as a render effect.

9. Choose Rendering > Effects. Click the Add button, select ChannelRenderer from the list, and click OK.

10. Click the Get Path button (see Figure 8.12) in the Channel Renderer rollout at the bottom of the Environment And Effects dialog box. Select the project folder on your hard drive where you'd like to save the three .png images.

11. Click the Render button in the Render Scene dialog box and wait until the rendering is complete. Close all the open dialog boxes. Close VIZ without saving the file.

Figure 8.11

The ChannelRenderer MAXScript window

^ChanndRendererO.3.1115 - MAXScript

Fte Edit Search plutfin RenderEfCect ChannelRenderer naae: "ChannelRenderer'' el63 sID:#(Ox 6 347C 5ae, 0x6Ida £ d3E)

rollout- sc coil "Channel RentfeEec"

group "Bender inage channels as PNG files"

button get_out_path "Get Path" aligns#le£t access:2 width;60 height.;] edictexc ouc_path text:|gecDlr linage) align:#rlght Clelduldth: 232

on get_out_path pressed do t new_poth = getSavePath 0

if new_pach != undeEined then out_path, text = new_patb

]--end rollout on channelsPequired do $ (#nornal,jfzdepchrj$ob]ectid> on apply inatre_Eile do (

— tender TJiicaial taage channel as pug out_patii = sc_roll.out_pat&*cext+"\\"+ "Horn-al" + ".png"

portable_necuork graphlcs. ipnglo. setType (#grayS)

out_bmp - getchannelasrcask iaiage_flle ^nornal filenaae:out_path save out_bnp close out_bap

— tender Zdepth t&age channel as png out_pat& = sc_roll. out_path* cext+-"\\"+ "Zdeptci" + "4png"

portafile_netffor£_gr aphl cs. ipngio. s etType (# gr ay8)

out_bmp - getchannelasiiask 3.ssage_f ile Hz depth filensne: ouc_path save out_bnp close out_bup

— tender QbjectlD taage channel as png out_path = sc_roll.out_path.cext+"\\,r+ "Ob}actio" ■+ "..png" por table^ne a?or£_gt: aphl cs. ipnglo. s etType (#gr ay8) out_baip - getchanneiasaiask iaiage_f ile #objectid filenane: out_path save out_bnp close out_bup ] —end do )--end script

Figure 8.12

Choosing where to save the rendered images

Now you have rendered the special channels and elements needed for masking in preparation for painting. Just as with house painting, most of the effort goes into the prep work. You'll integrate these files into Photoshop and use them to mask off areas that you'll eventually paint.

Figure 8.13 shows all the rendered files you have made for this project in VIZ. Once you've completed these steps, you should have the following files:

Filename

Normal.png

ObjectlD.png Zdepth.png

Farmhouse.tga

FarmhouseandTree.tga

Shadow.tga

Tree.tga

Description

Represents all the surfaces in the model in different gray tones regardless of material or object membership

Reveals each object in rendering as a distinct grayscale value

Represents 3D space in grayscale, with objects in the foreground fading from white to black as they recede from the picture plane

Four-channel (RGB plus alpha) render of all buildings (without tree)

Four-channel (RGB plus alpha) render of all buildings plus tree

Render of shadows only

Render of tree matted against all other objects

Figure 8.13

Rendered files

Itevr? output

■Jdl.X.I

Fie Edit View Fararites Tocts Help HQS

| Bo k - -f - ft} | ^Search -^Folders

-j x ^: <m-

Ad^rss |

1 Name ^^^^^^^^^^^^^^^^ 1 5He f Type ■

■^jNonnal.png

■46 KB PUG File

^GbjectSD.png

12 KB PNG File

'^izdepth.eng

33 KB PNG File

"^Farfi^ouse.tga

1,091 KB TGflFife

3JFan#xiuseandTVMS .tgo

1,243 KB TGA File

4) Shadow.tga

378 KB TGA File

"^jTrec.tga

194 KB TGfl File

Ml [ ±J

j? objects)

2.92 MB

My Ccrrputer

—i

0 0

Post a comment