Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

SHADERLAMP

  • #1, by yoyan 11 years ago Zitieren
    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.
  • #2, by afrlme 11 years ago Zitieren
    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.
  • #3, by yoyan 11 years ago Zitieren
    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.
  • #4, by afrlme 11 years ago Zitieren
    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)
    
  • #5, by yoyan 11 years ago Zitieren
    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.
  • #6, by afrlme 11 years ago Zitieren
    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
  • #7, by SimonS 11 years ago Zitieren
    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))
    


    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")
    
  • #8, by yoyan 11 years ago Zitieren
    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?..
  • #9, by afrlme 11 years ago Zitieren
    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
  • #10, by SimonS 11 years ago Zitieren
    If you are using a spotlight, you need to set the targetpos as well.

    "lights[0].targetpos"
  • #11, by yoyan 11 years ago Zitieren
    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 .. :-(.