Thanks to Proton for the great model.Versions: 7-8 Network Rendering 1174 Kevin Phillips | Network Rendering | Intermediate Only One Machine Needs LightWave Installed One misconception t
Trang 1FPrime can do up to 20 radiosity bounces where LightWave is limited to 8bounces.
Versions: 7-8
1173 Nicholas Boughen | FPrime | Intermediate
Fun with Radiosity Bounces
If you want to have a lot of fun with radiosity bounces — and believe me it
is fun when it works this fast — make a zigzag hallway, set a light at one end,and then observe how the light goes one more zig every time you increment thebounces by one
FPrime
Monte Carlo radiosity, 0 bounces
Monte Carlo radiosity, 2 bounces
Trang 2If you’re going to use any displacements on your objects with FPrime, don’tforget to add the FPrime displacement plug-in.
Rendering | 493FPrime
Monte Carlo radiosity, 10 bounces
Head with morph targets but no FPrime displacement plug-in
Trang 3Thanks to Proton for the great model.
Versions: 7-8
Network Rendering
1174 Kevin Phillips | Network Rendering | Intermediate
Only One Machine Needs LightWave Installed
One misconception that many people make when they first consider ing to set up ScreamerNet is that they need to copy LightWave across all theircomputers for it to work
attempt-In reality, you only need to copy LightWave files to the one computer on the
network that is going to act as a file server for the rest of the computers (i.e., thecomputer where the render nodes will write their image files to) I create ascreamernet folder on this computer, in which I copy all the plug-ins, LScripts,and program files from my LightWave installation I also copy the
LWEXT3.CFG configuration file here, and then simply edit it so that all
plug-ins and LScripts can be found from the right place in the screamernetfolder
Once I’m done, I simply map the screamernet folder on the server to the
same drive letter on all my computers, make sure that the LWEXT3.CFG file
contains this drive letter (so all computers find the plug-ins), and run theLWSN.EXE file directly from the screamernet folder on the file server itself
Trang 41175 Kevin Phillips | Network Rendering | Beginner
Content Folders
Content folders are the preferred way of setting up your 3D projects when
working in LightWave They are simply folders on disk that contain all the
com-ponents of your 3D project inside subfolders Commonly, you will find objects (for the objects in your project), images (for all the texture maps and images used in your project), and scenes (for all your scene files) in your subfolders.
The names of these subfolders must be spelled correctly for LightWave to findthem within the Content folder
Content folders are of extreme importance when setting up scenes and
pro-jects to render on a render farm You would be amazed at just how many users
do not use content folders correctly at all, mainly due to the fact that they bly don’t work in a studio environment However, it’s always good practice touse them, even if you are working on a single computer at home or in youroffice
proba-If you ever get that killer job doing 3D animation in a studio, it’s easier tohave good habits already set in place than try and unlearn a pile of bad ones!
Versions: All
1176 Kevin Phillips | Network Rendering | Intermediate
Preparing Projects with Content Manager
If you’ve just finished a large project and now decide that you need to place
it onto a render farm to get it finished on time, but you didn’t set up a propercontent folder at the start, don’t fret Layout has a tool that can help
Go to File>Content Manager This tool will let you consolidate all the files
in your scene into one place Alternatively, I prefer to export the scene into awhole new content folder Exporting is not only good for creating content fold-ers, it’s especially good for making a clean content folder, especially if you’vebeen saving iterations of files and have a ton of backups, etc., in your currentcontent folder
Once you have selected the option to export or consolidate, Content ager shows you a list of your scene-related files These can be selected and youcan set a subfolder to move them into Once done, clicking the OK button will
Man-do its magic and start to recompile all the files into place, making them renderfarm-approved and ready to go!
There are a few issues with this tool that are useful to note, however:
n If you have multilayered object files and are using only a few layers fromthem, you may run across an “Object Conversion Failure.” This is nothing toworry about; the content folder will have been created and the files moved,but the scene file will not have been saved with the new content paths set.You can manually do this yourself, but you’ll have to reload the objects
n Content Manager doesn’t always fix image paths inside object files That is,while it will move everything and resave everything for you, some objectswith externally linked image files won’t be properly updated and will stillrequest these files from their original location A render farm will show
Rendering | 495Network Rendering
Trang 5these when the surfaces do not render correctly Personally, I just rename theold content directory where the image files are known to reside so that thepath name is changed This will bring up “Cannot find image” warningswhen I load my scene from my new content directory, giving me the chance
to select the correct images from the content folder itself
Versions: 5-7.5c
1177 Kevin Phillips | Network Rendering | Beginner
Set Up Those Scene Saving Options
Before sending any scene to a render farm, you need to first make sure thatyou have loaded it, selected the rendering options, set up the save options to ren-der to RGB (and alpha if applicable), and saved the scene file again You need toalso ensure that the save path for the rendered images (and alpha) is pointing to
a network drive that all the render nodes can see
This is essential if you plan on using Layout’s own ScreamerNet controllertools to run your render farm Most third-party control software allows you todynamically set up the saving options without opening the file first
Versions: 5-7.5c
1178 Kevin Phillips | Network Rendering | Beginner
Rendering a QuickTime or AVI
Render farms can only render to still image sequences — plain and simple.Movie files, such as AVI and QuickTime, require that each frame of the anima-
tion be rendered in sequence so that the video file can be written correctly to
disk, and compressed as well if required Because a render farm cannot controlthe order of frames that are rendering, nor can each computer be expected to
track where or when it needs to write a frame into a video file, it’s impossible to
create a movie file this way
You can, however, recompile the image sequences rendered by the renderfarm back into a movie file, either with a third-party video editing tool or withLightWave itself
Rendering to image sequences is also a good habit to get into If anything
happens in the middle of a render to a video file, or you need to abort your der because the boss wants his laptop back so he can go home, you cannotcontinue the render later You have to restart the video file again, which couldmean extra hours of re-rendering what you’d already done
ren-With an image sequence, you simply set the start frame number in the der Options panel to the next frame after the last file rendered and keep
Ren-rendering from where you stopped
Versions: All
Network Rendering
Trang 61179 Kevin Phillips | Network Rendering | Intermediate
Fixing Jittering Particle Effects
When rendering scenes containing HyperVoxels or particles on a network,you should first save the motion of the particle emitter out to a pfx file Failing
to do so means that render nodes will attempt to determine the particle emittermotion themselves, sometimes leading to a semi-jittered and random-lookingeffect in the render itself
Make sure that the pfx file is saved into the project’s content folder and that
you save the scene directly after adding the pfx file to ensure it gets mapped to the emitter A pfx file will ensure that the motion is pre-saved and identical on
all nodes
Versions: All
1180 Kevin Phillips | Network Rendering | Intermediate
Missing Texture Maps
Render farms really do work better with scenes that have been set up with agood content folder structure in the first place In most cases, many weird prob-lems stem from users with bad habits of grabbing files from outside their contentfolders and using them in a scene or on a model
Content folders require all components of the scene to be in the folder ture Any other file is known as external and is bad news, especially for a renderfarm! In the case of a render that contains missing texture maps, this can mean afew things:
struc-n The import plug-istruc-ns for loadistruc-ng certaistruc-n image types could struc-not be loaded orused This is related to the nodes not being able to read the ScreamerNetconfiguration files or the configuration files not pointing to the right files ondisk (or even the right drive for that matter!)
n The images were not in the content folder and the render nodes could notlocate them Therefore, they don’t exist, but ScreamerNet will still renderwhat it can
n An object uses the image map from an external location These are harder toidentify, as the image may exist in the content folder but the location in theobject does not point to it
Versions: All
1181 Kevin Phillips | Network Rendering | Intermediate
Popping Texture Maps
In cases of renders that contain the weird effect of popping texture maps
(images that appear to pop on and off throughout a render), this issue seems to
be more prevalent on Windows-based networks, and in most cases relates tobadly maintained objects or content folders
This occurs when an object or scene contains external images that aremapped by a network name in LightWave (i.e., \\kevs_computer\images\dumb.png) If these can be located by a render node if it is connected to thesame network, it will be loaded The problem happens when a network
Rendering | 497Network Rendering
Trang 7connection cannot be made and the file cannot be loaded on a render node Thenode will still render the frame, but the final image will be missing a fewtextures.
Versions: 5-7.5c
1182 Kevin Phillips | Network Rendering | Intermediate
Windows Workstation Network Connection Limit
Workstation installations of Windows allow a maximum of 10 network
con-nections If there are more than 10 machines on the network, any machine afterthe tenth will not be able to connect and therefore will be missing from the ren-der farm
In this case you should consider:
n Purchasing a Windows Server license and enough CAL (Client AccessLicenses) for your entire network (this will be a very costly exercise, espe-cially for a small studio)
n Building a server using the widely available and (mostly) free Linux ing system (which has no limitations on the number of connections) and usethe program Samba that allows Windows computers to treat the Linux filesystem as though it were a Windows one A version of Samba is usuallyincluded in most installations of Linux
operat-Versions: All
1183 Kevin Phillips | Network Rendering | Intermediate
Only Rendering to FLX Files
One common issue most new ScreamerNet setups have is all output havingthe file extension flx instead of the correct file extension that was specified.This is almost always related to the render nodes not being able to load theirplug-ins To save in all the different image formats, LightWave uses a series ofimage save-load plug-ins
Double-check that all the file paths to the plug-ins in your ScreamerNet sion of the LWEXT.CFG file are correctly set up
ver-Versions: 5-7.5c
1184 Kevin Phillips | Network Rendering | Intermediate
No Files Were Rendered to Disk
If your ScreamerNet render farm appears to be operating reliably but is ducing no image files, there are two possible things that may be wrong:
pro-n ScreamerNet couldpro-n’t load apro-ny of the image saver plug-ipro-ns Ipro-n later editiopro-ns
of LightWave (6.x upward), this problem is usually more noticeable by FLXfiles being created instead
Network Rendering
Trang 8n The scene file was not set up properly prior to placing it onto the renderfarm You need to ensure that the scene file has had its rendering options setfor saving to RGB files, and that the pathname for those RGB files points tothe network drive! Setting it to Save Animation or saving RGB to the localhard drive and not the network drive usually results in no files being created.
Versions: 5-7.5c
1185 Kevin Phillips | Network Rendering | Intermediate
Cannot Find an LScript
If you are using any LScript or LScript/RT plug-ins in your scene to loadLScripts, you should ensure that you move the LScript files into your contentfolder before loading them Like all other files in a project, any LScripts added
to your scene from outside the content directory will be linked as external files,and the render nodes may not be able to find them
Versions: 5-7.5
ÜNote: Since LightWave 7.5c, LScript allows programmers to add the ability for scripts to embed selves inside scene files directly
them-1186 Kevin Phillips | Network Rendering | Intermediate
Batch Those Nodes with DOS
Typing that long ScreamerNet command line into each workstation on a work can be hard work! That’s where good old DOS batch file programming can
net-be a time-saver I tend to set up my ScreamerNet command line into a batch file,and set it to use a parameter that I can pass to the batch file using the %1 sym-bol In this example, I have my ScreamerNet folder mapped to the L drive:L:\shared\programs\LWSN.EXE -2 -cL:\config -dL:\content L:\command\job%1 L:\command\ack%1
I place this batch file into the ScreamerNet folder on the server computer,and each render node simply has a shortcut on the desktop that calls the batchfile with a node number as a parameter For example, if I saved the batch file in
my L drive and called it startnode.bat, the shortcut for node 1 would call thecommand L:\startnode.bat 1
When ScreamerNet aborts a node, usually this just terminates the batch fileand exits back to Windows This can be a nuisance if you then need to restart allthe nodes, so instead add a label and goto command to make the batch filerestart itself when it’s aborted:
Trang 91187 Kevin Phillips | Network Rendering | Beginner
The Importance of Sequence
When setting up your render farm, it’s important to use a sequential ing order for each node This number is used by ScreamerNet for generatingmessage files (job and ack) that make ScreamerNet work
number-If you are using Layout to control your render farm, you must specify thenumber of CPUs This number should be the highest node CPU ID you haveallocated If you have decided to call one of your nodes 132, just to be unique,then you must tell Layout that there are 132 possible nodes in your render farm.When you initialize the render farm, searching and waiting for 132 nodes cantake some time!
Versions: 5-7.5c
1188 Kevin Phillips | Network Rendering | Beginner
Better Ways to Work with ScreamerNet
Are there alternatives to ScreamerNet? Sure, there are some around, but inmost cases it’s not ScreamerNet that is the alternate solution, but an alternatepiece of software for talking to the ScreamerNet nodes Here are a handful offree and commercial controller products that you can look into if Layout’s ownScreamerNet control is too limited:
n LightNet (Joe Justice build) http://www.joejustice.org/LightWave/lightnet/index.html
n StationX Spider (Station X) http://www.stationx.com
n Tequila Scream (DigitalToons) http://www.digitaltoons.tv/shop
n ButterflyNetRender (Liquid Dream Solutions) http://metanerd.bizland.com
n Screamernet Controller for OSX (Catalyst Productions)
Versions: 7-8
Network Rendering
Trang 101190 Timothy “Amadhi” Albee | Network Rendering | Beginner
Cache Shadow Map
Don’t use Cache Shadow Map with shadow-mapped spotlights when youknow you’ll be rendering via ScreamerNet If you start a node rendering mid-way through the completion of the scene, its cached shadow map data will lookdifferent than the nodes started earlier The difference may be slight, but often itresults in “pops” that make the render unusable for professional production
Versions: 7-8
1191 Timothy “Amadhi” Albee | Network Rendering | Beginner
Bake Before Sending to ScreamerNet
If you use Motion Mixer in a scene, you must bake the motion before ing the scene to be rendered via ScreamerNet
send-Motion Mixer is a powerful and complex tool for blending bits of animation
to create a performance — the 3D version of the limited animation seen in urday morning cartoons Because of all it can do, and the deceptive simplicity of
Sat-its interface, if you plan on playing around with it, read Sat-its documentation!
Versions: 7-8
1192 Lee Stranahan | Network Rendering | Beginner
ScreamerNet Isn’t Enough
One of LightWave’s big appeals to many people in Hollywood is that itincludes free, unlimited network render nodes with the included ScreamerNetsoftware The problem is that ScreamerNet is virtually unusable on its own.What you need is a front end for it There are free ones out there such as
LightNet and Spider — a Google search should find them — and there are alsocommercial ones that give you support and more bells and whistles Either way
— get one!
Versions: ???
Rendering | 501Network Rendering
Trang 11This page intentionally left blank.
Trang 12Chapter 11
Compositing
It is very rare to see final output on the big screen, or television for that matter,that hasn’t gone through some compositing or postprocessing Typically, 3Dfootage is by its nature very crisp and clean To make 3D elements blend betterwith film or video, the footage is usually at least color corrected, blurred, andsome noise (or actual film grain) is applied Often, a slight halo is added to thehighlights These steps try to reproduce the artifacts of real-life cameras
So, why not do this all in LightWave? While it is possible to some extent,there are many more possibilities on dedicated applications Also, the settingscan be adjusted more or less interactively — with no need to re-render after eachtweak
It’s often more productive to do some, or even all, of the elements of a givenshot in 2D The best methods always depend on the job at hand If you createimages with LightWave, you will miss a lot in speed and control if you ignorethe possibilities of compositing tools
of the background image, blur the snot out of it, apply as a projection to a light, and aim in the general direction of the object The intensity of the imageprojecting spotlight must be adjusted to what looks best on each particularscene, but it should be very low and not a major source of illumination Withjudicious mixing of one or several of these projection lights you can get a mockradiosity/global illumination type effect
spot-Versions: All
503
Trang 131194 Patrik Beck | General Tips | Intermediate
Invisible Reflection Box
A reflective metallic object can be rendered to look like it is in the ground image by using an invisible reflection box Create a box in Modeler andflip the polygons so that they are all facing inward Take a single frame of thebackground plate and use a cylindrical map so that the image is mapped oncearound the inside of the box like a label on a soda can In Layout, position thebox so that it is completely surrounding the object Under Object Properties, inthe Render tab, select Unseen by Camera With Ray Trace Reflections turned on,the reflection box will give the original object something to reflect that is related
to the environment of the background plate If there is a lot of action in the ground plate, the image can be replaced by a sequence The reason for using areflection box instead of using spherical reflection mapping is that it gives youmore control over how the environment is seen in the reflection You can posi-tion and scale the box so that it roughly aligns with what would be seen in thebackground You may decide to use a sphere with a spherical map instead of abox to cage your reflection surfaces, which is fine if it gives you the look youwant, but boxes seem to give a realistic reflection surface
back-Versions: All
1195 Patrik Beck | General Tips | Intermediate
Jitter, Grain, and Defocus
To help “marry” the LightWave rendered element to the background image,combine the elements as well as you can, then add a little jitter, grain, defocus,
or film float to the full image This helps sell the image as a complete picture tothe eye
Versions: All
1196 Lee Stranahan | General Tips | All Levels
Consider Rendering at a Smaller Size
If you’re going to take LightWave-created images and composite them withreal-world images that you’ve shot on video or film, you might want to do sometests and see if you’d benefit from rendering your LightWave images at asmaller size than normal — about 80% of the final intended size Then scalethem up during the compositing phase
Wait — did you read that right? Render them smaller and then scale themup? Huh? I mean, everyone knows that when you scale images up, you lose res-olution That’s true, so that’s exactly what’s going to happen Your perfect,pristine LightWave image will lose resolution That’s just the point, too
Part of why computer-generated images sometimes stick out like a digitalsore thumb is that they are too perfect, especially around the edges If you look
at a frame of film or video, edges in the real world — as least the real world ascaptured by a camera — aren’t all that clear The edges, in fact, tend to mushinto one another a little bit That is just what this technique is attempting to do to
General Tips
Trang 14your computer-generated images — mush them up a bit so they fit in better.This won’t always be a good idea, but try it out.
Versions: All
1198 Eki Halkka | General Tips | All Levels
Using LightWave as a Video Effects Application
You can use LightWave as a video effects application simply by mappingimage sequences on polygons Then just animate the polygons for cool pageturns, wipes, and so forth Use surface transparency to mask parts of the images.You can have an infinite amount of these video layers You can also create 2Dwarps and morphs by applying an image to a subdivided flat box and creatingmorph targets for it
Versions: 6-8
1199 Larry Shultz | General Tips | Intermediate
Speeding Up Animation and Setup
Sometimes I’ve had to use large background images as reference to animateover If the background plates are sufficiently large this can really bog down theupdates when you try to scrub through the animation What I do is to render alow-res movie file (AVI or MOV) with the same aspect ratio as the original Iload this as a background to animate over because I can scrub through it muchfaster Once I’m satisfied with the animation I simply swap out the low-res back-ground sequence with the full-res version
Versions: 5-8
1200 Larry Shultz | General Tips | Advanced
Matching Geometry and Images
Here’s a little trick I use to easily match up background image and geometry
I create a polygon in Modeler that has the same aspect ratio as the image Ineed to match my geometry to For example, if the image is 640 x 480 I create apolygon that is 6.4m x 4.8m and so on I then load the image into Modeler,apply it to the surface of my background polygon, and change my viewport ren-der mode to Texture
Next I use the Pen tool to trace a new polygon around the feature on theimage I need to match to I may create several of these mask polys I also makesure that I apply the texture in Layout as a front projection and turn on Fixed
Compositing | 505General Tips
Trang 15This will allow me to move the camera slightly and get a little parallax out of thebackground image.
I make sure I pull the mask polys far enough forward to allow other objects
to move behind them It’s also helpful to give each of the mask polys their ownlayer Once all of this is loaded into Layout it’s simple to match the camera view
to the polygons
Versions: 6-8
1201 Leigh van der Byl | General Tips | Beginner
Creating Shadows for Compositing
When working with animated elements that are to be composited withlive-action (shot) plates, you usually create a 3D environment that is based onthe environment filmed in the shot, so that you can properly position the 3Dcharacters or objects into the scene Another use for creating the environment in3D is so that the characters or objects can cast shadows onto the environmentthat can then be composited into the footage Of course, when doing this, youwon’t want to have the actual geometry of the environment visible in the render;you’ll only want the shadows
To do this, you need to set up the surface of the environment geometry sothat the only areas of it that are included in the render’s alpha channel are theareas where shadows fall
General Tips
Trang 16In LightWave, we do this by
using the Shadow Density Alpha
Channel option, found under the
Advanced tab in the Surface Editor
This causes the alpha channel of
the render to ignore all areas of the
object to which this surface is applied
except for areas where shadows fall,
making it the ideal solution for
ren-dering shadows needed for
compositing
Versions: 6-8
1202 Gerald Abraham | General Tips | Intermediate
Volumetric Clouds or Explosions
Volumetric clouds or explosions rendered on a black background can easily
be merged with other layers using screen mode in compositing software such asAfter Effects or Digital Fusion This mode cuts all the black from a layer, leav-ing everything beneath visible
1204 William “Proton” Vaughan | General Tips | All Levels
Compositing Saves Render Times
Final animations or images don’t have to be generated in LightWave Takeadvantage of compositing programs like Aura, Digital Fusion, or even
Photoshop Here’s an example:
If you have a character talking on a phone in a house, render the characterand phone in one pass and then render the background elements in another pass.Composite (merge) the two renders in a compositing package If you have to goback and make changes to the animation, you won’t always have to re-render allelements This is the way most shots are created for movies
Versions: All
ÜNote: This is also very helpful when lighting a scene Sometimes it’s easier to isolate elements and
light them without having the lights affect other elements in the shot
Compositing | 507General Tips
Trang 171205 Timothy “Amadhi” Albee | General Tips | All Levels
Depth Channels Are Not Antialiased
If you are going to be working with any Z-buffer-based effect in post(depth-based compositing, fogging, blurring, etc.), the best results come from
rendering your RGBA images without antialiasing as well I find that if I render
at twice the size of my target resolution, but without antialiasing, and thenreduce the result of the depth work in the compositer, I get output that is goodenough for “prime time” with most scenes (Some scenes, with minute surfacedetails, need to be rendered at 4x target resolution.)
Versions: All
Splitting Renders into Layered Elements
1206 Policarpo | Splitting Renders into Layered Elements | Intermediate
Lighting in Layers
Having access to multiple files that are comprised of key, fill, and backlights and compositing them separately in post allows you to change color, den-sity, and mood in real time without the need to re-render images Place your keylight as layer 1 in Photoshop, and apply Linear Dodge mode to your fill andback lights in the comp Now you can tweak the color of the lights in real timewithout any rendering penalties
After a few minutes of tweaking the Hue/Saturation levels of the three lightlayers, you can achieve dramatic results without having to render your sceneagain
Versions: 6-8
Exporting Channels (Depth/Spec/etc.)
1207 Geoffrey Kater | Exporting Channels (Depth/Spec/etc.) | Beginner
DOF Shot
Create a quick depth of field shot by using a blurred background image.Load your blurred background image into the Compositing tab of the Effectsdialog (press Ctrl+F7, or go to Window>Compositing Options, for 7.x go toScene>Effects>Compositing) When you render your scene it will look like theforeground object is in focus and the background is not — hence, quick depth offield
Versions: 5-8
Splitting Renders into Layered Elements
Trang 181208 Policarpo | Exporting Channels (Depth/Spec/etc.) | Intermediate
PSD Exporter/Render Buffer
Set up scenes with the PSD exporter or use the Render Buffer view plug-in
to gain access to the various buffers that make up a final render The PSDexporter is located in Windows>Image Processing>Add Image Filter Havingaccess to these channels allows you to make minor or major adjustments to yourfinal image in real time in a compositing package
Select the buffers you want to tweak in post By adjusting the Specular andShadow layers, a lot of color tweaking can be accomplished relatively quickly inpost Try copying and pasting different buffers as an alpha channel, and loadthem to create unique visual effects in your composite
Versions: 7.5-8
1209 Policarpo | Exporting Channels (Depth/Spec/etc.) | Intermediate
DOF in Real Time
Use the Depth Pass as an alpha channel in Photoshop to simulate a depth offield effect in real time
Place the Depth Pass in the Channel tab as an alpha channel
Load the Depth Pass channel and apply a Gaussian blur to simulate a DOFeffect to your final image
Compositing | 509Exporting Channels (Depth/Spec/etc.)
Trang 19Digital Fusion
Trang 20(You may find you need to limit the effect with a soft-edged mask because thisadds a pseudo-motion blur to the image somewhat.)
Versions: All
ÜNote: Pixel crawl is the “sizzle” you get when mismatched antialiasing makes the edges of objects andshadows wiggle around from frame to frame
After Effects
1213 Geoffrey Kater | After Effects | Advanced
Render Animation to Layers
Render your animation in layers to have more control over your final posite with this easy two-step process First turn off all objects in the
com-background (Scene Editor) and uncheck those objects Then render your mainobject (character, vehicle, etc.) as an image sequence or QuickTime with abuilt-in alpha channel Then go to the Scene Editor and recheck your back-ground objects and uncheck your main object Render your background as asequence or QuickTime Load both animations into After Effects with the back-ground layer on the bottom layer You’ll be able to affect each layer separatelywith a multitude of filters like motion blur, rack focus, noise, color shifts, etc
Versions: All
Compositing | 511After Effects
Trang 211216 Gerald Abraham | After Effects | Intermediate
Matching Enviroment
Using a simple choker and a small amount of Gaussian blur on the edges of
an object’s alpha channel often helps match an object to its environment
Versions: All
1218 Gerald Abraham |After Effects | Intermediate
Interpret Footage
When importing rendered footage in After Effects, it’s extremely important
to make sure the frame rate specified for LightWave output corresponds to thefootage Adjust these settings in the Interpret Footage dialog box
Versions: All
After Effects
Trang 22Chapter 12
Scripting
Ever find yourself doing the same task over and over again? Ever find yourselfrepeating the same keyframing over and over? Ever wish some motion wouldjust get on by itself and leave you to concentrate on the acting? Well, help is athand! Scripting — using LScripts and expressions — can help in many of thesesituations “Scripting, expressions — pah! That’s for coders and mathemati-cians.” Not so — the designers of both systems have done their best to makescripting as easy as possible to use There is also good LScript documentation tohelp non-programmers get started and the math for expressions isn’t anythingmore than what you learned at school
“So, what exactly can LScripts and expressions do for me?” Well, LScriptscan help with repetitive tasks If you repeatedly perform the same commands inLayout or Modeler, you can write a script to do it all in one step LScripting pro-vides access to the core of LightWave — use it to issue commands or addfeatures that don’t yet exist You can use LScripts for automating animations formotions that are very mechanical, such as rotating wheels, gears, projectilemotion, pistons, etc
“What about expressions?” Well, think of them as one-line LScripts — ple formulae that determine how channels should change with time or twodifferent channels should stay related to each other, e.g., force a character’s hips
sim-to remain centered or the pitch of two gears sim-to synchronize Expressions are veryuseful for character and mechanical rigs and for simple procedural animations.There are many more uses for LScripts and expressions — just have a lookthrough all the great tips in this book!
513
Trang 23If you’re not into reading manuals, you can start by examining existingLScripts that ship with LightWave The scripts that have an ls extension can beopened and modified in any text editor, while lsc scripts can’t be modified.
So, don’t be afraid to open one of the ls LScripts in the LScripts directoryand take a look You can also modify the scripts if you wish, but I suggest tryingthat on a copy, not the original
Versions: 6-8
1221 Eki Halkka | LScripts | Beginner
LScripts in Modeler and Layout
There’s only one LScript type for Modeler, but many for Layout, depending
on their purpose The most straightforward of the LScript types are Modeler andLayout generic LScripts Both will go through their tasks, and then be done with
it I suggest starting with them
in the script isinfo(), which will pop up a requester with the text “HelloWorld!” The script can be modified into a Layout generic script by altering thefirst line:
1222 Eki Halkka | LScripts | Beginner
Using LScript Commander
One great shortcut to creating scripts for Layout is LScript Commander It’skind of like a macro recorder but with more power If you don’t already have abutton for it, I suggest adding one now Press Alt+F10 to open the ConfigureMenus panel, locate LS Commander on the left side under plug-ins, and drag it
to Main menu — LScript — Utilities Done
Open LScript Commander From this point on, everything you do in Layoutwill be added to a list of commands in the bottom half of the interface — as long
as it’s something that can be coded into an LScript You can then drag thesecommands to the upper half of the interface to create a sequence of commands
LScripts
Trang 24After you have a few commands lined up, select Convert to LScript from thesession pop-up Ta-da! You now have a working Layout LScript If you wish,you can edit the script in the upper half of LS Commander interface Click theInstall button to save and add an interface button for it The button will appear inthe LScript tab under Macros.
ÜNote: There are occasions where some manual editing will be needed for the script to work
LScript Commander is also great for finding LScript commands, if you arelazy like me and don’t always want to search through the manuals Just open LSCommander and perform the desired action in Layout — you now have thecommands ready to copy to your script
Versions: 7.5-8
1223 Eki Halkka, Kevin Phillips | LScripts | Beginner
LScript Helper Applications
LightWave comes with helper applications for LScript that can be found inthe Programs directory
The more important of these is the LScript Editor (LSED) Even though youcan use any text editor to create your scripts, LScript Editor has some small butuseful features I couldn’t live without It color codes the script so that it’s easier
to follow what’s going on, includes a simple syntax checking tool, and showsthe number of the line of code your cursor is on As LightWave usually gives aline number in the error message, locating the troublesome part is much easierthan in a regular text editor Plus a lot more — check it out, I say!
There’s also LScript Interface Designer (LSID), which lets you design aninterface for your script in drag-and-drop style in a manner similar to tools such
as Delphi or Visual Basic After you have arranged all the needed buttons, ers, etc., interface elements to your liking, you can export your interfaces towork in either Layout or Modeler LScripts, as well as in the C programming lan-guage (Panels)
slid-Both of these tools are very good and extremely useful They can be found
in your LightWave \Programs folder
Scripting | 515LScripts
Trang 25You will find AddPlug-in+.ls on the companion CD It automates this dure; unfortunately, it’s for Layout only.
proce-Versions: 6-8
1225 Emanuele Salvucci | LScripts | Advanced
Writing BMPs
Unfortunately, LightWave 3D doesn’t have a function to write image data to
a file through LScript But since LScript has been created to let users improvethe system, we can actually create our own function!
Let’s divide the code in two functions, the “pixel data writer” and the
“header writer.” We do this so we can easily create new format writers by simplychanging the header writer — in some cases Generally it keeps the code clearand lets you track bugs easily Thewritebmp()function is the pixel data writerand expects a string parameter containing a full directory path, while
writeheader()is clearly our header writer:
Trang 26bmpimg.write("BM"); // signature
bmpimg.writeInt(((100*100*24)/8)+54); // file size in bytes
bmpimg.writeInt(0); // 4 bytes unused
bmpimg.writeInt(54); // File offset to raster
bmpimg.writeInt(40); // Info header size
bmpimg.writeInt(16777216); // Used colors
bmpimg.writeInt(0); // Important colors (set 0 = all)
}
The header part is quite self explanatory In this case a 100 x 100-pixel24-bit uncompressed BMP is saved to a file The file size in bytes can be calcu-lated this way:
((width*height*bit_depth)/8_bits)+54_bytes_header_size
The pixel data writer writes a bidimensional array containing pixels colorsfor every (x,y) pixel in the image The lastbmpimg.writeByte()instruction iscommented since some viewers may require a fourth zero byte for each pixel tocorrectly read the image This fourth byte is documented as “reserved” in theBMP24 format
Versions: 6-8
Scripting | 517LScripts
Trang 27ð Mac Note (Robin Wood): I’m afraid this doesn’t seem to be working on the Mac Go ahead andtry it if you like, but I can’t guarantee it for this platform.
1226 Emanuele Salvucci | LScripts | Intermediate
Break “for” Loops
If you’re using for loops to search data in arrays always remember to use thebreak instruction to stop the loop after you’ve found what you were looking for.Even though with for loops there’s almost no risk of an infinite loop like in awhile loop, you are going to waste processing time if you continue the loop afteryou found your data
Here’s a snippet of code with a for loop that “breaks” after data is found:
In this case this code was looking for mapped points within a VMap
If you have thousands of points and several VMaps, breaking the loop canmean saving hundreds of calculations for each VMap
Versions: 5-8
1227 Emanuele Salvucci | LScripts | Advanced
Reading Installed Shaders
Some information is not available to LScript directly from LightWave 3D
To get additional information, you can read configuration files and parse theinformation you need
As an example, here’s an LScript UDF code that parses the LWEXT8.CFGASCII file in order to create a list of installed shaders, which isn’t provided bythe system:
read_shaders
{
i = 0;
// LWEXT3.CFG for LightWave 6/7.5
filedir = getdir ("Settings")+"\\LWEXT8.CFG";
LScripts
Trang 28// opens file in read-ascii mode
conf = File (filedir, "r");
//defines regular expression to look for
expr = regexp ("ShaderHandler");
//till the end of the file…
// reads the next line and removes "Name", and spacesname = conf.read()-" Name ";
// calculates character size of shader namechars = (size (name)) – 2;
// removes inverted commas from shader namename = strsub (name, 2, chars);
// builds array with shader namesshaders += name;
ð Mac Note (Robin Wood): I’m afraid that this tip is PC-only We don’t have a file called
LWEXT8.CFG, so we obviously can’t ask a script to read it, and I wasn’t able to find the file where the list ofshaders is kept on a Mac Sorry
1228 Emanuele Salvucci | LScripts | Intermediate
Surface Baker Limited Region
A new feature has been introduced in version 8 regarding Surface Baker Ifyou look in the Command Sequence list of commands (Utilities>Save Cmd List,and save the text file on disk), one of the last entries is the following command:Surf_SetBakerRegion <umin> <vmin> <umax> <vmax>
Scripting | 519LScripts
Trang 29This command lets you set UV limits to bake for each applied Surface Bakershader It is possible to create a script around this command to set up and bake alimited region of an object’s UV map for preview purposes for instance.
All the parameters are intended to be floating-point UV values in the range0-1.0
Here’s an example with an object named “obj” and a surface named “surf”with Surface Baker applied:
Surf_SetSurf surf obj;
In Layout you can find the LScript Commander in Utilities>Master
Plug-ins>LScript Commander (In LightWave’s versions before 8 it can befound in the LScript tab.)
LS Commander is a command sequence interface and it also works as anevent monitor In LS Commander the Command Sequence tab lists all the com-mands that can be used in Layout directly through LS Commander or within ascript Using the SaveCommandList command you can save all the commands
to a text file This is mainly useful as a reference text file of commands currentlysupported by Layout
Command sequence instructions are used in LScript through the
CommandInput()function, such as:
CommandInput("SaveSceneCopy c:\\test.lws");
Command sequence instructions give easy access to built-in Layout tions inside LScript So it’s actually an extra set of commands in addition to allthe functions described in the LScript reference manual
func-Versions: 6-8
ÜNote: In LightWave 8, the SaveCommandList button can be found in Utilities>Commands>Save CmdList
1230 Emanuele Salvucci | LScripts | Intermediate
Activating a Group of Controls
If you have to activate/deactivate a group of controls on your script face, you can do so efficiently by creating a user-defined function (UDF)
Trang 301231 Kevin Phillips | LScripts | Intermediate
Start Coding Without Typing
In LSED, create a new script from the File menu From the Tools menu,select the Template option, and then select a template for the type of LScript thatyou wish to create LSED will then generate an empty template for that type ofLScript — you just have to go and fill in all the gaps!
Versions: 6.5-7.5c
1232 Kevin Phillips | LScripts | Intermediate
Creating Code for Requesters in a Flash
At some time in your script, you may want to pop up a requester box to askthe user for some kind of input You could type in the code, line by line, but youcan quickly create the code you need for your requester by simply opening LSID
(do not close or quit LSED), creating your interface quickly, then using the
File>Export feature to generate the code for the requester This will create thecode in a new document within LSED that you can cut, paste, and edit into yourscript
Versions: 6.5-7.5c
Scripting | 521LScripts
Trang 311233 Kevin Phillips | LScripts | Intermediate
Interface Tabs
In LSID, you can create complex interfaces that have lots of controls ever, with more controls comes the need for more space — or does it? You candesign your panels to work like LightWave’s own interface by using a set of tabsalong the top of the panel
How-1 Add a tab component to the panel
2 Add another component, for example, a button To add this button to a tab,expand the tab attributes in the Component tree so that you can see the threeitems for Tab1 to Tab3
3 To add the button to Tab1, simply drag the button in the Component tree upunder Tab1 and parent it in a similar fashion to the tools in LightWave
4 Add more components and parent them to the other tabs
5 Click through each tab item in the list window and make sure the controlsonly appear on the tab you parented them to
While parenting is great for generating tab controlled requesters, you can erally parent any component to another This lets you move components
lit-together, which is great for keeping components aligned and tidy
Versions: 6.5-7.5c
1234 Kevin Phillips | LScripts | Intermediate
Annoying Top-Left Components
One of the annoying things when adding components to a requester withLSID is that they always appear in the top-left corner of the Dialog window.When you select it, often you’ll select a component at the same location, which
is a little annoying
LScripts
Trang 32Instead, once you have added your component, select the Dialog windowand use the arrow keys on your keyboard to easily slide the selected componentaround the requester.
Versions: 6.5-7.5c
1235 Kevin Phillips | LScripts | Intermediate
Laying Out the Look of Your Interface
LSID allows you to lay out your components for the requester, but areaswhere there are differing lengths of descriptions, etc., don’t always look thesame when they are drawn within Layout or Modeler
What you can do if you are after complete pixel-level perfection of thedesign of your requesters in Layout or Modeler is to simply take a screen shot ofthe requester when it is being displayed by your script Paste this into yourfavorite graphics editing software where you can easily measure the positions.The pixel location on your requester starts at 0,0 in the top-left corner of yourpanel, just below the title bar By noting the distance in pixels that the controllayout is incorrect by, simply adjust the x and y values in thectlposition(com-ponent, x, y)command
Versions: 6.5-7.5c
1236 Kevin Phillips | LScripts | Intermediate
Name Your Scripts
Make it a habit of using the pragma directive@nameat the start of yourLScripts to ensure that your script can be identified easily within Layout andModeler Note that names can contain spaces, but you will need to make sureyou enclose the name in double quotes, e.g.,@name "Easy to find script"
Versions: 7.5-7.5c
ÜNote: If you do not name your scripts, adding them to Layout or Modeler as plug-ins will use the
file-name (without the ls or lsc extension) as the file-name of the tool
ÜNote: This is not the same name as the setdesc("name") command The
setdesc("name")command sets the description that is displayed in the plug-ins list box after the
plug-in has been added @name is more like an internal system name for LightWave to refer to
Scripting | 523LScripts