flashlight

  • #10, z SimonSTuesday, 30. December 2014, 20:31 hodinky 10 years ago
    Step-by-step:

    1) Load this script: http://wiki.visionaire-tracker.net/images/a/a5/Shader_toolki...

    (is linked btw on this site: http://wiki.visionaire-tracker.net/wiki/Shader_%28CMS%29)

    2) open with an texteditor
    3) copy everything
    4) in your Visionaire project go to scripts (last symbol left side)
    5) add a script with the plus
    6) paste
    7) add another script
    8) paste this:
    shaderActivateLighting(2)
    
    shaderLamp(0, 0, {900,500,1}, {0,900,10}, {0.001,0.000001,0}, {0,0,0}, {1,1,1}, 1, 90, 0)
    shaderLamp(1, 1, {1000,50,1}, {0,0,1}, {0.01,0.0,0.00001}, {0,0,0}, {1,1,1}, 1)
    
    bind("light1", "lights[0].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 1))
    bind("light1", "lights[0].targetpos", point(inverty(cursor), 10))
    bind("light1", "lights[1].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 
        factor(dist(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200})), cursor), 10)))
    

    9) save & run

    requires the newest 4.1 editor and player.
    Is a very basic sample.
    If want to turn it off, you can use the action execute script, and paste shaderDeactivateLighting() there.
    The settings can be tweaked a little, but it's just a basic flash light.

    Kapitán

    1582 Posts


  • #11, z afrlmeTuesday, 30. December 2014, 20:57 hodinky 10 years ago
    @ Thomas: That would be an overlay. A mask would allow you to define a shape which excludes whatever part of a specified layer/image the mask is overlapping.

    Imperátor

    7285 Posts

  • #12, z jetsetwillyTuesday, 30. December 2014, 21:19 hodinky 10 years ago
    ????????? im lost sorry

    Well, actually it's not much of a problem to create and use a mask in Visionaire Studio. Just use a big black image with a hole in it as a mouse cursor. Then you have a classical flashlight. smile.................


    ok my screen resolution is 640X480 so my black image must be 1280X 960? with a transparent hole for example 90 pixel large at the center?
    wath is the command to fix it on the character ?

    Bažant

    69 Posts

  • #13, z afrlmeTuesday, 30. December 2014, 21:28 hodinky 10 years ago
    command? You would need lua to fix the image to the characters position. Also to fix the center of the image to the characters position you would need to calculate offset needed too because positioning is done via top left pixel of an image/animation & the characters position is based on the animation center you defined on the character which is usually set near the feet.

    Imperátor

    7285 Posts

  • #14, z VoltaicoTuesday, 17. February 2015, 05:27 hodinky 10 years ago
    Hi! I'm testing the lua script for the flashlight. I copied the main script and the additional script as Simon said. I'm very noob at scripting but from what I can understand the flashlight should be attached to the character and the target should be the mouse cursor, is it not?
    The thing is, I've got the flashlight effect working but the beam comes from the middle of the screen (not the character position) and it doesn't follow the mouse cursor at all.
    I tried the example in this thread with similar results ( http://www.visionaire-studio.net/forum/thread/shader-toolkit...!/2/ ).
    Is there anything I've been missing related to character position or binding??

    Thanks in advance!!

    Bažant

    5 Posts

  • #15, z SimonSTuesday, 17. February 2015, 11:28 hodinky 10 years ago
    Hi, you got anything in your log ?

    Kapitán

    1582 Posts

  • #16, z jetsetwillyTuesday, 17. February 2015, 22:50 hodinky 10 years ago
    fucking flash light

    Bažant

    69 Posts

  • #17, z VoltaicoWednesday, 18. February 2015, 03:48 hodinky 10 years ago
    Hi! I managed to get it working, dunno what was wrong in the first place but I started from scratch and now it's working perfectly. The effect is amazing and it gives so much depth to the scene. Amazing work Simon! All shaders effects are impressive. Congrats and thanks wink

    Bažant

    5 Posts

  • #18, z turricanTuesday, 09. February 2016, 14:30 hodinky 9 years ago
    Hallo, ich wollte nicht extra einen neuen Thread aufmachen:
    Ich habe leider auch das Problem, dass die Taschenlampe eine fixe Position einnimmt - das "bind" scheint nicht zu funktionieren.
    Hat vielleicht jemand einen Tip für mich?
    shaderActivateLighting(2)
    
    shaderLamp(0, 0, {900,500,1}, {0,900,10}, {0.001,0.000001,0}, {0,0,0}, {1,1,1}, 1, 90, 0)
    shaderLamp(1, 1, {1000,50,1}, {0,0,1}, {0.01,0.0,0.00001}, {0,0,0}, {1,1,1}, 1)
    
    bind("light1", "lights[0].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 1))
    bind("light1", "lights[0].targetpos", point(inverty(cursor), 10))
    bind("light1", "lights[1].position", point(inverty(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200}))), 
        factor(dist(scrollfix(offset(field("game.CurrentCharacter.Position"),{0,-200})), cursor), 10)))
    
    


    Setze ich "bind" vor "shaderLamp" werden diese gar nicht erst gerendert...
    Bin für jede Hilfe dankbar! red

    Ich habe noch ein wenig herumexperimentiert - leider ohne Erfolg.
    Im Log taucht aber folgendes auf, was ich leider nicht deuten kann:

    21:41:41: stack traceback:
    [string "torch"]:13: in function <[string "torch"]:11>
    [C]: in function 'DataDumper'
    [string "- ShadersToolKit -"]:1825: in function 'bind'
    [string "torch"]:7: in function <[string "torch"]:1>
    [C]: in function 'xpcall'
    [string "torch"]:1: in main chunk
    21:41:41: no uniform pass in shader

    Falls es wichtig ist, ich rufe es als Ausführungsskript auf...

    Bažant

    43 Posts

  • #19, z turricanThursday, 11. February 2016, 16:58 hodinky 9 years ago
    Niemand eine Idee? roll

    Bažant

    43 Posts

  • #20, z constantinThursday, 18. May 2017, 13:32 hodinky 7 years ago
    zunächst möchte ich sagen, dass mir diese taschenlampe irrsinnig gut gefällt. gratuliere. ich habe sie etwas modifiziert, weil ich einen schärferen lichtstrahl brauche.
    nun habe ich eine frage: sobald die taschenlampe aktiviert wird, wird der großteil des bildes sehr dunkel bzw. schwarz. warum ist das so? ich möchte die lampe in einer szene einsetzen, die zwar dunkel, jedoch nicht vollkommen schwarz ist. sobald ich aber die taschenlampe aktiviere, wird die umgebung (also alles, wo kein lichtstrahl hinfällt) vollkommen schwarz. 

    Fanoušek fóra

    167 Posts