Home Technical Talk

3ds Max fixed lights?

polycounter lvl 16
Offline / Send Message
Japhir polycounter lvl 16
Hey guys,
Recently i've managed to set up my own lighting system, and i think it'd be nice if it would move with the camera, so the lighting on your object changes along with the camera. (just like the default 1 light, only with 3 lights). Is this possible?

and is it possible to press a hotkey and drag the mouse button to turn the lights? (like in xnormal). that would really help me :D.

hmm maybe we should make a .maxstart thread ;).

Replies

  • Xenobond
    Options
    Offline / Send Message
    Xenobond polycounter lvl 18
    CTRL+L switches between using Scene Lights and the Default Lighting.

    Err... read 'turn the lights' as 'turn off the lights' instead of 'move the lights'.
  • SHEPEIRO
    Options
    Offline / Send Message
    SHEPEIRO polycounter lvl 17
    parent the lights to the camera, or make an expression that rotates them around the obj when athe camera is moved, but they stay the same distance from the obj, each wont be unbreakable though
  • Rob Galanakis
    Options
    Offline / Send Message
    haha, funny you mention it- I did exactly this last week for someone at work.

    It is a bit of a pain, not as simple as you'd think, since Max doesn't treat the viewports as cameras- instead of doing a constraint or script or expression, you need to create a redraw views callback.

    Here is the latest version. Currently animations don't work (not a problem with the script, I just need to find a way around it, if you do it by hand the same thing would happen), but you can rotate the lights to change them.

    http://tech-artists.org/hg/robgalanakis/rob_galanakis_scripts/raw-file/3dd26417d368/rg_constrainLightsToView.ms
  • Slum
    Options
    Offline / Send Message
    Slum polycounter lvl 18
    Rob: That seems like a really long winded way of doing things.. Just make some lights, create a camera, and use link constraints on the lights.

    If you're using spotlights, make sure you use a LookAt constraint (z axis) so they will point at your object if the camera pans away from it.
  • Rob Galanakis
    Options
    Offline / Send Message
    Slum wrote: »
    Rob: That seems like a really long winded way of doing things.. Just make some lights, create a camera, and use link constraints on the lights.

    If you're using spotlights, make sure you use a LookAt constraint (z axis) so they will point at your object if the camera pans away from it.

    I wasn't sure if this was for working or rendering... if you want to use this while you model, for example (like a customized Default Lighting), there is no other way to do it, AFAIK. You can't control a camera like a viewport and you can't apply a controller to be affected by the viewport (they only update when objects or time changes). But yeah, if you want to use it while rendering to a certain camera it is real simple.

    Actually I doubt my script would even work with rendering, since it is dependent upon Redraw Views, which I don't think happens during rendering.
  • Bryan Cavett
    Options
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    You could possibly do it with a custom viewport shader.
  • Mark Dygert
    Options
    Offline / Send Message
    Well, technically he could use it while modeling, if he uses walk thru mode to control the camera instead of the standard viewport controls. I use walk thru mode so much I bound it to Shift-C. Considering Walk Thru mode works like a FPS viewport, its not that hard to get the hang of. But using it as the only method would be limiting. I use orbit rotate just as much if not more.

    There might be a way to constrain the camera to look at the selection when a key is pressed giving you a faux orbit rotate?
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    Thanks guys!

    and Rob, that was exactly what i was talking about, having good lighting for modeling that changes along with the viewport.
    I tried using your script, but how does it work? I created a simple scene with 3 lights, added some primitives to see how it'd work, then selected the lights and ran your script. (which i saved to ../scripts/startup, but i'm not sure that's necessary).
    thanks again!
  • Rob Galanakis
    Options
    Offline / Send Message
    You need to create a Macro button- when it is on, your lights become constrained to your camera and move to the bottom right of your viewport (so you can rotate them if needed), when you turn it off they go back to initial positions.
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    eh.. i hate to ask, but how do i do that :). I googled a bit, but couldn't find anything :(.
  • Rob Galanakis
    Options
    Offline / Send Message
    http://tech-artists.org/wiki/Macro_installation_(maxScript)

    Tell me if you have any questions after reading that.
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    yay thanks! I got it.
    but here's the next problem :(.
    before i hit the L2V button
    after i hit the L2V button

    edit: i could move them into the correct positions while in L2V mode, but, when i uncheck it and then turn it back on i'm screwed all over.
  • Rob Galanakis
    Options
    Offline / Send Message
    The script can really only work correctly using Free directional lights, because they are position insensitive. Omni's, targets, and spots are all sensitive to position... if your light rig follows with your camera, it is going to be very inconsistent- as you get closer and further your object will become darker and lighter. I would seriously advise against this, and if you want to do this workflow, only use Free Directional lights.

    If you are sure you want to use Omni's, I can look into modifying the script.

    EDIT: I should add in support to convert target lights to free lights, though.
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    thanks so much, i made some directional lights and it's all good now. looks a lot like the zbrush shaders :D. thanks so much!
Sign In or Register to comment.