Home Technical Talk

Maya - Amount of light hitting an object/set of faces

polycounter lvl 10
Offline / Send Message
gilesruscoe polycounter lvl 10
I'm writing a set of tools for use in cinematics and i'm trying to find out if maya has a certain attribute to help with one of the tools.

I was wondering if objects have a way of reading how much light they are receiving.

For example,

a spot light is lighting an object with a brightness of 3,
the object it is lighting reads a value of 3 and is scripted to turn orange.

The spot light is changed to brightness 1,
The object it is lighting reads a value of 1 and is scripted to turn green.

So basically, what i'm after in an ideal world is an attribute i can simply reference as the lighting value of that object, but if not, is there any other work arounds?

Replies

  • BARDLER
    Options
    Offline / Send Message
    BARDLER polycounter lvl 12
    I know Maya has light linking, where you can tell each light what object you want to effect. Could that be a solution?
  • gilesruscoe
    Options
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    Light linking would be a very basic way to do it. Just directly referencing the value of the lights intensity... But it doesn't really work well - what if the light is pointing away from the object, or there is something occluding it?
  • pinkbox
    Options
    Offline / Send Message
    have a look at the surface luminance node in hypershade Utilities. might be what your after? not sure as ive never used it
  • BARDLER
    Options
    Offline / Send Message
    BARDLER polycounter lvl 12
    I was think about this today a little more and was wondering if you could use vertex color? Bake the lighting in the scene to the vertices of the mesh, and then just simply read the values.
  • gilesruscoe
    Options
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    Pinkbox - perfect! Just what i'm looking for. Needs a bit of tweaking but definately the right input i need.

    @bardler - Not a bad idea, but sadly this needs to all work dynamically.
  • gilesruscoe
    Options
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    Balls...
    It seems that Surface Luminance only outputs a value at render time, so its not giving any feedback in the viewport. This is no good for me as this is eventually being used to drive a set of bones. I found that the lightInfo node gives you a value based on the distance of a light from a surface - but then occlusion is an issue :s
  • BARDLER
    Options
    Offline / Send Message
    BARDLER polycounter lvl 12
    Balls...
    It seems that Surface Luminance only outputs a value at render time, so its not giving any feedback in the viewport. This is no good for me as this is eventually being used to drive a set of bones. I found that the lightInfo node gives you a value based on the distance of a light from a surface - but then occlusion is an issue :s

    What about a custom viewport shader then?
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Is this just for like a couple of lights or a lot. You might be able to get the world space position of the light and do a dot product with face normals though again this might start getting really slow especially if its updating in realtime. Bardler's suggestion sounds like a better option.
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    Is this just for like a couple of lights or a lot. You might be able to get the world space position of the light and do a dot product with face normals though again this might start getting really slow especially if its updating in realtime. Bardler's suggestion sounds like a better option.

    That would still produce issues with shadows and/or occlusion not being computed.

    I think the way to go would be a coloured ramp with luminance plugged into it as UVs. Like the TF2 shader or Unity's toon shader (ramp).
  • gilesruscoe
    Options
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    What kind of features would i need in a custom viewport shader then? I'm not sure what it would require.
    @Brendan - I'm not sure what you are suggesting or how it would achieve what i'm after - care to elaborate?

    I managed to get a hacky work around going with the light info node. It doesn't actually calc the light on the eye but just uses light distances. Doesn't work with occulusion obviously... But this is what i'm trying to achieve - An eye rig that changes the wideness of the eye and dilates the pupils based on how much light is hitting the eye.
    eyerig.gif
  • gilesruscoe
    Options
    Offline / Send Message
    gilesruscoe polycounter lvl 10
    Still trumped on this - any suggestions fellas?
Sign In or Register to comment.