Hello everyone, I'm not good with expressions actually i barely use it in Maya but I was wondering if there is a way to create an expression to control an attribute depending on the light intensity received by an object.
This is more like an experimentation, hopefully you could help me figure this out.
Actually the practical exemple I was thincking of is an eye iris changing automaticly depending on the light received on it, in the scene:
So basicly in the exemple I have, there's an attribute named
irisCtrl on a curve type of object named
C_irisCtrl_1 and that attribute has a driven key controlling the vertex for the iris. The iris is named
C_pupil_1 and is currently under a group named
C_eye_1.
The tricky part is that I dunno if there's a way to know the overall value of the lights received by an object. Do you think it is possible to find out ?
Replies
so broadly:
iris control value = (saturate(dot(lightVector, eyeForwardVector)) - 0.5) * 2;
This would pretty much translate to fully "closed" when the light is pointed directly at the eye, and fully dilated when the light is anywhere from 90 degrees to behind.
TO be honest this thing is something you would most probably just keyframe manually. But it's a cool exercise.
You'd want it to be lit/in shadow and over a half-second or so to close/open as it adjusts to the light.