SHADERLAMP

  • #1, by yoyanWednesday, 03. June 2015, 12:36 5 years ago
    Hi, i put a shaderlamp in a scene.. and all rest of scene is black. ¿why?...and if i move for the scena with the character and scroll the scene, the shaderlamp also Move!.Can I block shaderlamp? I want the shaderlamp fixed. It Is posible? Thanks a lot wink.

    Newbie

    32 Posts


  • #2, by afrlmeWednesday, 03. June 2015, 12:59 5 years ago
    If you activate lighting then it requires you to create lights with the shader, otherwise the scene will be in darkness. When you create lights (spot or point lights) it will light up the areas that the lights are attached to based on the parameters you use.

    I'm still not very savvy with the lighting, so I'll just let Simon answer this thread, if he sees it.

    P.S: could you please post the code you used for the lighting.

    Imperator

    6842 Posts

  • #3, by yoyanWednesday, 03. June 2015, 13:17 5 years ago
    i only put this code at the begining of the scene:

    shaderActivateLighting(1)
    shaderLamp(0, 0,{1000,900,1}, {900,0,0}, {0.001,0.000001,0},{0.0003,0,0.001},{1,1,1},0.5,30, 0).

    I want simulate a for example a street light. But if i move and scroll and shader lamp Move..It is meaningless. Thanks.

    Newbie

    32 Posts

  • #4, by afrlmeWednesday, 03. June 2015, 13:38 5 years ago
    The lighting should be fixed to the specified coordinates unless you bind it to a character or the position of an animation.

    To disable it in scenes that you don't want it in, you could create an execute a script action part, at the beginning of each scene that you don't want to add lighting to. Or you could add it inside of an at end of scene action part for the scene or inside the actions that trigger the scene change.
    shaderActivateLighting(0)
    1
    2

    Imperator

    6842 Posts

  • #5, by yoyanWednesday, 03. June 2015, 13:51 5 years ago
    the problem arises when I put a shaderlamp on a big scene. If I put the lamp in a scene from normal size (no scrolling scene). I have no problem. But if the scene is big and there scroll, the lamp moves. This is the problem. I cant solve this. This is my main handicap. Thanks a lots wink.

    Newbie

    32 Posts

  • #6, by afrlmeWednesday, 03. June 2015, 14:09 5 years ago
    I'm not sure if the position is based on current viewport or the entire scene. If it's the viewport then it might require creating a function which can calculate the correct position & adding it to a bind or inside of a loop.

    Simon? grin

    Imperator

    6842 Posts

  • #7, by SimonSWednesday, 03. June 2015, 16:48 5 years ago
    Hi guys,

    problem is the lights work on screen coordinates, but if we scroll the coordinates on the screen are static.

    So to fix that you need to do something like that:

    bind("light1", "lights[0].position", point(inverty(scrollfix(field("{x=1000,y=900}"))), 1))
    1
    2


    I've put your numbers in the code. This overwrites what you set with shaderLamp.
    If you don't need it anymore, you can unbind it with

    unbind("light1", "lights[0].position")
    1
    2

    Thread Captain

    1368 Posts

  • #8, by yoyanWednesday, 03. June 2015, 21:51 5 years ago
    Hi simon! Ok, firstly , thanks. now the shaderlamp it fixed where i would want and the lamp dont move, but now the problem is that the lamp turns when the character move. Like a light surveillance. Know what I mean?..

    Newbie

    32 Posts

  • #9, by afrlmeWednesday, 03. June 2015, 23:20 5 years ago
    It's rotating? I had that issue a little while ago. It turns out it wasn't displaying correctly for me because I hadn't updated my gpu drivers in quite some time (about a year & a half).

    If it's not that, then you're on your own! grin

    Imperator

    6842 Posts

  • #10, by SimonSWednesday, 03. June 2015, 23:22 5 years ago
    If you are using a spotlight, you need to set the targetpos as well.

    "lights[0].targetpos"

    Thread Captain

    1368 Posts

  • #11, by yoyanWednesday, 03. June 2015, 23:36 5 years ago
    the target pos is defined in shaderlamp...no?.
    shaderLamp(index, type, position, "targetpos", falloff, ambient, diffuse, diffusefactor, exponent, cutoff).
    I do not get it working. The lamp turn .. :-(.

    Newbie

    32 Posts

Write post