Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 31-10-2009 , 02:14 PM
Registered User
Join Date: Feb 2009
Posts: 11

Strobe light

I'm guessing the best way to go about making a strobe would be by using an expression. Problem is, i cant come up with what the "if" statement should be.:headbang:

I need to be a really fast strobe, like every other frame, or there abouts. I do hope I wont need to rwrite an if statement for each frame in the animation.user added image

Or maybe an SDK would be a better way to go? I havent even begun how to do it that way, so if anyone has a clue, one way or the other, I would much appreciate it.:bow:

# 2 31-10-2009 , 06:22 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
don't know the syntax, but something like:

if frame is even, on, frame odd, off

so if frame/2 == int(frame/2), then on, else off

# 3 01-11-2009 , 01:08 AM
Chirone's Avatar
Subscriber
Join Date: Dec 2007
Location: NZ
Posts: 3,125

Re: Strobe light

the psuedocode you'd be looking for is something like

Code:
if ( frame is even ) 
then light.intensity = 1;
else light.intensity = 0;
to tell if the frame is even or not you could use the modulus operator (that's the %)

alternatively you can keyframe the light intensity and make the animation cycle in the graph editor

Originally posted by Jeremy2112
Or maybe an SDK would be a better way to go? I havent even begun how to do it that way, so if anyone has a clue, one way or the other, I would much appreciate it.:bow:

what? doesn't the SDK come with maya? that's why you can use it in Maya...




that's a "Ch" pronounced as a "K"

Computer skills I should have:
Objective C, C#, Java, MEL. Python, C++, XML, JavaScript, XSLT, HTML, SQL, CSS, FXScript, Clips, SOAR, ActionScript, OpenGL, DirectX
Maya, XSI, Photoshop, AfterEffects, Motion, Illustrator, Flash, Swift3D
# 4 01-11-2009 , 06:57 AM
Registered User
Join Date: Feb 2009
Posts: 11
Oh, my bad, by SDK I was referring to a Set Driven Key. I could have been more clear about that.

As for the bit of code there, it all makes sense, but I can't quite get the syntax right. also if you could explain the modulus operator a little.

I might go ahead and explain that this is basically the first time I am trying to use expressions, outside of copy/pasting snippets of code from various tutorials.

Edit:

I got it working with this little bit here :
pointLightShape1.intensity=time%2; :attn:

Which brings me to the next step:

I need this to drive the visibility if an object. The issue now is, I already have the visibility of the geometry being controlled by an expression, so in this case I will be need it to be a set driven key. Problem is, I cant figure out how to get the pointLightShape to load as the driver. I can only get the pointLight itself, which does not have an intensity attribute.

Supposing I could alter the expression to be on the pointLight visibility, rather than the pointLightShape?

I suppose this would be a good time to explain exactly what I am trying to do here, which is the muzzle-flash of a Gatling Gun. I have a group of Nurbs that serves as the actual glow/flame of the muzzle-flash. I have the expression for visibility on that set, so that it is only visible when the barrels are rotating. I now need for it to flash on and off it time with the pointLight.


Last edited by Jeremy2112; 01-11-2009 at 07:28 AM.
# 5 01-11-2009 , 05:57 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Try using the connection editor instead of a driven key... might work for you.

I think you could connect the intensity of the light to the visibility of the object.

# 6 01-11-2009 , 08:21 PM
Registered User
Join Date: Feb 2009
Posts: 11
That is a feature I have never used... I'll have to look into it. Thanks.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads