Revised Roman Candle scene with lighting

Posted by Duncan Brinsmead, 12 November 2012 10:34 pm

Download Scenefile:

This scene is a version of the one in my previous post, but is modified so that the light emission from the particles is no longer faked using heat emission and diffusion on the fluid, but instead uses point lights positioned at the particle locations.  This helps make the lighting of the smoke by the fireworks more natural. As well the scene has be refined somewhat and motionblur added. Mental ray was used, as the Maya sw render does not support motion blur on particles. Also an additional fluid was created for the flames and smoke coming out of the tube and ground geometry was added.

One interesting observation I had while doing this is that the brightness of illumination of the balls on the smoke is so great that the smoke might look as if it is white, even though the actual color is a very dark grey. The smoke is so close to the light source that even though it is near black it will look white... in part because of it being night a longer exposure being simulated. As well the brightness is such that even very transparent fog will show up, but will disappear completely when not illuminated. If the smoke were white like steam then the transparency would need to be very high to avoid completely washing out. (this is assuming it is already thin enough that there is no significant self-shadowing)

Ten point lights were created and an expression written that positions them at the locations of the first 10 particles in the simulation. The color of the lights is set to the color of the particles, and the decay set to quadratic, which is the natural decay for a point light source.  If there were less than 10 particles at any given time, the expression sets the intensity on the unused lights to zero. The expression initially was written using a for loop and set the lights using a setAttr call, building the name string from the for loop increment variable. This keeps the expression relatively compact. Unfortunately in Mental Ray this evaluation did not trigger updates of the values on the lights, so I rewrote it to set the values of the lights explicitly, which makes the expression longer. Inside an expression the following syntax will create an actual node connection from the expression node to the attribute:

lightShape1.colorR = 10

while a setAttr call will not:

setAttr lightShape1.colorR 10

Unfortunately one cannot use a variable in the former syntax, thus one must explicitly do all the calls which makes this method somewhat impractical for a large number of particles. However it wasn't an issue for this simulation. Instead another workflow might be to use the original expression (see commented out section of expression2 in that uses setAttr then bake out the expression to keyframes before rendering.

I enabled raytrace shadows on the lights so that the box at the bottom would cast shadows on the ground, but other than that the shadows are not required. The smoke is thin enough it does not self-shadow.  One can turn off shadows on the lights to speed up the rendering significantly. The rendering would only differ on the first few frames, where one can see the ground. The problem with all the lights having cast shadows on is that the fluid nodes fire shadow feelers for every sample in depth and this can be inefficient, especially if one has no need to see shadowing in the fluid volume. In particular there is a problem where in Mental Ray that both fluids and particles will self-shadow and cast shadows when raytraced shadows on a light are enabled, regardless of the cast/receive shadow settings on the shapes. As a result this scene renders much faster with the MayaSw renderer, but then there will be no motion blur on the particles.

I wanted the flame and smoke fluid to be affected by the emitting particles, so I created a speed only emitter into the fluid from the particles.  To prevent it from auto resizing to the full height of the particles resizeToEmitter was turned off on the fluid.

Note that in order to properly render this scene with motion blur all the dynamic entities should be first cached. (motion blur computation does extra time evaluations  that can create problems for non-cached dynamic simulations)


Maya Guru

Posted 20 November 2012 4:05 pm

Hi Dear Sir I was trying this effect but i found emitting fluids form emitter rather than polygonal object or any geometry is a way different the fluids doesn't comes out of the surface mesh properly it seems like some intersection or penetration is happening and becomes noticeable regardless of any field used and push towards +ve Y axis.
I also noticed fluids behavior changes and i found little uncomfortable in emitting from object.

Any cool Tips and tricks sir......


Posted 29 December 2013 7:17 am

Hello Duncan Sir,
You have been a great teacher to me, I was very confused with how particle emit fluids and searched many places until i saw in Vikas Chandel's youtube post referring to your roman candle. Since then I have been constantly reading your post. They are simply the best.

Thank you so much.


Posted 10 March 2014 5:21 pm

hi duncan i love all your projects - except now that maya 14 on a mac doesnt support object instances with particles - i cant use i the particles any more fro my projects - or have to go back to 13 and cant use 14 is this going to get fixed

Add Your Comment

You must be logged in to post a comment.

Please only report comments that are spam or abusive.