mcj Glow Kit For Nerds DS 2,3,4



Creating this animation requires familiarity with Daz Scripts
and maybe MsDos batch files.



Installation


There's 2 zip files in the attachments at the bottom of the page you are presently reading.


The first zip file named mcjGlowScripts.zip contains some daz scripts for Daz Studio 2 and 3

it should be unzipped into your Daz Studio Content folder, typically on a PC that means

c:\Program Files\Daz\Studio\Content


The second zip file named mcjGlowWorkarea.zip contains a folder named mcjGlowWorkarea

which contains

- 3 empty folders named pass1 pass2 and pass3

- 2 executable files that were part of a freeware package named imagemagick

- the license for the imagemagick components

if you don't trust those two executable files, then you can download the whole package from the creators
of imagemagick at http://www.imagemagick.org

- 1 batch file named doOne.bat

- a copy of the web page you are currently reading ( i.e. the manual ) under the name mcjGlow_Manual.html

- a folder containing the images of the manual

You can unzip this file wherever you please, in my case i placed it in c:\

so my workarea folder is c:\mcjGlowWorkarea





Use


1. Marking the glow surfaces


First we need to mark all surfaces in our scene that will be glowing.

This is done by setting the "Index of Refraction" property of those surface materials to 1.00

(  by default the "Index of Refraction" is 0.00, so non-glowing materials don't require modifications )



in this example, i selected the 3 balls and the pole and set the index of refraction to 1.00


2. Rendering the first pass

Render the animation as a series of images. The images must be written to your workarea's "pass1" folder


in this example, the images are written to my
c:\mcjGlowWorkarea\pass1 folder

i'm rendering frames 30 to 89, with the filename pattern "pic.png"

not shown here is the fact that my animation timeline goes from frame 0 to 1500
This means
my c:\mcjGlowWorkarea\pass1 folder will be filled with images named

pic0030.png, pic0031.png ... pic0089.png

numbers like "0030" means the frame number was padded with 4 zeros

if my timeline ranged from frame 0 to 999, the the numbers would be padded with 3 zeros

pic030.png, pic031.png ... pic089.png


3 - Preparing for the second pass


For the second pass we must turn off light emission and light reflection for all non-glowing materials in the scene.

This means we must set the diffuse, specular and ambient strength of all non-glowing materials to zero!

an enormous task. But there's a script for that

If you correctly installed
mcjGlowScripts.zip, you should see a script named mcjGlowBlacken in your Studio/Scripts/mcasual folder


Launch mcjGlowBlacken.

mcjGlowBlacken will go through all the materials in the scene, and turn off light emission for all surfaces
that are not marked as glowing. Before it does this, it stores the current values for diffuse, specular and ambient strength
 in brand new channels named "Stored Diffuse Strength", Stored Specular Strength" and "Stored Ambient Strength".
So, later on we'll be able to use the mcjGlowUnblacken script to restore those values

the scene now looks like this :



4. Rendering the second pass

Render the animation as a series of images. This time the images must be written to your workarea's "pass2" folder
Use the same camera and same image size and same filename pattern
In my case this means my c:\mcjGlowWorkarea\pass1 folder will be filled with images named

pic0030.png, pic0031.png ... pic0089.png



5 - Restoring the scene

launch the
mcjGlowUnblacken  script also located in your Studio/Scripts/mcasual library folder.

The script will go through all the non-glowing materials in the scene and restore their original

ambient/diffuse/specular strengths .

the scene now looks like this :



6 - Building the Glow Images, theory

The images in the workarea's pass2 folder look like this



if we apply a strong blur filter , they look like this



The images in the workarea's pass1 folder look like this




if we ADD ( through compositing ) the blur image and the pass1 image, we get the glow/bloom effect



7 - Using scripts and batch files and imagemagick to build the Glow Images

If you have a video editor like Adobe After Effects or maybe WAX, you could do this without too much trouble

If you have a PC and are not scared of batch files you could do it this way ...

Make sure the two programs convert.exe and composite.exe and the batch file doOne.bat are in your workarea folder

launch the cript named mcjGlowMakebatch in your Studio/Scripts/mcasual folder




fill in the form

remember that i rendered frames 30 to 89,
so,
First frame = 30
Last Frame = 89

my images were named pic0030.png .....pic0089.png
so
Filename prefix = pic
image format = png

 we said the numbers like "0030" were using padding with four zeros
so
File number padding = 4

press the Make Batch File button

a popup will appear

browse up to your workarea folder ( in my case: c:\mcjGlowWorkarea\ )


and enter a filename like  processAllFrames.bat


if you open this new file using wordpad/notepad
it should look something like


call doOne pic0030.png
call doOne pic0031.png
call doOne pic0032.png
.
.
.
call doOne pic0086.png
call doOne pic0087.png
call doOne pic0088.png
call doOne pic0089.png



so the "doOne.bat" batch file will be called for each image.

lets have a look at doOne.bat


convert -blur 0x32 -alpha Off pass2\%1 temp.png
composite -compose plus temp.png temp.png temp.png
composite -compose plus temp.png temp.png temp.png
rem composite -compose plus temp.png temp.png temp.png
composite -compose plus  -alpha Off pass1\%1 temp.png pass3\%1



as you can see doOne.bat expects folders named pass1, pass2 and pass3
in the current folder. it also expects to find the two imagemagick programs
named composite.exe and convert.exe in the current folder

the documentation for convert is here:
http://www.imagemagick.org/script/convert.php

the documentation for composite is here
http://www.imagemagick.org/script/composite.php

here's the details of what happens

lets say doOne.bat  is called like this: call doOne pic0030.png

using imagemagick's convert utility, pass2\pic0030.png is blurred with a
blur range of 32 pixels ( strong blur )
the resulting image is stored in temp.png

using imagemagick's composite utility, temp.png is added to itself 2 times
this multiplies the brightness of the blurred image by a factor of 4

note that all lines beginning with rem are deemed to be comments and have no effect
so
if you remove the rem on line 4,  temp.png's brightness of the glow will be greater
or
if you add a rem at the beginning of line 3, the brightness of the glow will be lower

line 5 takes pass1\pic0030.png, and adds the bright-blurred temp.png image
the resulting image is placed in the pass3 folder pass3\pic0030.png


8 - Assembling the Glow Video

if all went well we now have 60 images in the pass3 folder named pic0030.png ... pic0089.png

many video editor programs can turn this into a video file

i personally use virtualdub from
www.virtualdub.org/



i start virtualdub, then i drag&drop the first image in the series onto virtualdub
or i open it via the File/Open Video File... menu. In our example, i open pass3\pic0030.png.

Virtualdub will immediately "see" and load 59 other images in the series.

by default the frame rate given by VirtualDub is 10 frames per second
so we go in Video/Frame Rate and change it to 30

then we go in Video/Compression and select a good codec like the divX codec

then we do a File / Save As ... glowtest.avi

and a few seconds later we have our glowing video!




ADDENDUM
in the attachments you will find a zip file named
DoOneBatForElectricBlue.zip
it contains an alternative version of the doOne.bat batch file discussed above.
it creates electric blue arc effects
It also contains a small image that acts as a palette to re-colorize the electric arcs

note that processing each image with this is much slower

you will want to safely stash away the original doOne.bat file before replacing it with this one

example of results obtained





ċ
DoOneBatForElectricBlue.zip
(1k)
mCasual Jacques,
Jul 4, 2011, 4:15 AM
ċ
mcjGlowScripts.zip
(56k)
mCasual Jacques,
Apr 29, 2010, 2:36 PM
ċ
mcjGlowWorkarea.zip
(1031k)
mCasual Jacques,
Apr 29, 2010, 3:10 PM
Comments