FORUMS: list search recent posts

# Simple Expression for Beginner Question

VIEW ALL
 Simple Expression for Beginner Question on Nov 13, 2013 at 11:28:42 pm

Hello Everyone,

I'd like to animate the "Glow Intensity" attribute in my blinn shader. Just a nice and simple looping animation that goes from 0 intensity to 100 intensity over the span of 28 frames, then back down again for another 28 frames, etc. It has to match another looping animation of 56 frames, which I already have working. I'm basically layering the glow on top of another animation.

I realize this is simple and perhaps could find it in a tutorial but I'm in a big rush on this project and the tutorials I've found seem to start with particle movements etc.

Alex

 Re: Simple Expression for Beginner Questionon Nov 18, 2013 at 3:42:15 pm

Hi, Alex. Your subject line says 'expression,' but this could be easily accomplished with keyframes. Just set your three keys at 0, 0; 28, 100; 56, 0 and then set your curve's 'post-infinity' behaviour to 'Repeat.'

If for some reason you really need to use an expression, here are a couple of options. First, a linear change:

`[intensity] = 100/28.0 * (max(0, (frame % 56 - 28)) - min(0, (frame % 56 - 28)));`

(As you can see, it's not exactly 'simple'... although I'm not a math whiz, so there may be a much more elegant way to accomplish this.) Next, a (much simpler) sine wave:

`[intensity] = 50 * (1 - cos(frame/28*3.1416));`

Hope this helps. Keep in mind, though, that it's almost always better to produce glow effects at the compositing step rather than in the 3D render itself.

 Re: Simple Expression for Beginner Questionon Nov 18, 2013 at 8:31:48 pm

Hi Steve,

Wow, I didn't even think about the post-infinity setting. I still have lots to learn.

I appreciate your tip about post-production. I noticed that when I render with Mental Ray, the glow effect disappears. Do you know if that's a maya software-only attribute?

It does seem as though the glow doesn't emit any photons for itself. If this is the case, I can see why you'd advise post-production.

Thanks a lot for the tips!

Alex

 Re: Simple Expression for Beginner Questionon Nov 22, 2013 at 7:16:28 pmLast Edited By Steve Sayer on Nov 22, 2013 at 7:17:52 pm