Yet another reflections query

  • #1, by edmundFriday, 29. March 2019, 13:38 5 years ago
    Hi, I'm trying to make a bathroom mirror reflect a character.
    I searched the forum, got a bunch of hits and tried all the code/scripts/(whatever that gibberish is) in all manner of places and ways, but couldn't figure out how any of it is supposed to work.

    I also tried to make a second version of the character, flipped ALL their sprites and assigned them to the opposite directions etc - it took AGES but was a massive waste of time since I can't get them both to just move along at the same time (not to mention idle/ blinking animations won't play at the same time etc - but I can fudge that for the single scene.)

    Could someone who actually knows how to write shader script or lua code please explain in basic terms what I'm supposed to put where to use any of the shader stuff floating around (ie, do I copy paste it into the shader section? If so, what tab? Then what do I do to make it show up? etc etc etc) 

    - OR what I could do to make a manually drawn reflection character actually walk along, or animate the same as the original, behind a semi transparent object "window" to make an illusion of a mirror.

    All I'm trying to do is make a simple rectangular mirror, with another, slightly transparent copy of my character a little offset in it, and in all honesty it seems like it's way harder than it needs to be to figure out how.

    Please excuse the rubbish picture, but here is an explanation of what I want to achieve

    Bear in mind I'm an absolute turbo-tard when it comes to any kind of scripting and coding!

    I've managed to get a few rooms done, with some inventory and an unnecessarily complicated interface setup etc, but things like this mirror stuff, or getting the background sound to carry across scenes, or having the black fade out not be a yucky little box in the corner, but rather the FULL screen - that's all kicking my ass.

    Sorry for the blog post!






    Newbie

    4 Posts


  • #2, by edmundFriday, 29. March 2019, 14:48 5 years ago
    If it isn't possible to use shaders (useful for symmetrical characters - unlike mine) this might work, although it requires a mirrored sprite be added to each frame of the animations (on a separate outfit)

    So.. If the picture helps - 

    1. I create a hotspot area (yellow)
    2. When my character walks into the zone, it makes an object visible on either side of the mirror.(pink)
    3. Those objects are just the wall in the background, and their centres are low enough that the character can walk behind them and be obscured by them. (pink dotted line)
    4. It also changes the outfit to the one with the little reflection sprite added to each frame.
    5. Since i'll have the "reflection" in front of the character (and she only goes side to side in this scene) the reflection will be obscured by the "wall" end objects before the actual character sprite - at which point she steps OUT of the hotspot/zone whatever it's called, and everything reverts back to normal.
    6. That way, i can just manually add a mirrored version of each frame of each idle/blinking animation (tedious even with placeholder gfx, can't imagine how sucky the full version will be to draw!!) and it'll all line up.

    So if anyone else is silly enough to want to make a reflective mirror, this might be a way to do it (with added complexity for scenes where you walk forwards and backwards?

    I'd still appreciate any help with doing this quicker, perhaps with some sort of code instead!

    Newbie

    4 Posts

  • #3, by afrlmeSaturday, 30. March 2019, 11:24 5 years ago
    I'm afraid only Simon &/or CaligariMarte are about the only people on this forum that could help you out with the shader reflection side of things.

    I know that I would be able to figure out an animation/Lua script approach to reflections, but like you said... it would require a tedious amount of work. Here's an example of something you could do: if you setup a character for reflections, you could probably create an event handler to listen out for when a particular condition is true & for when you play an animation that is linked to the playable character & then have it play that same animation for the reflection character. But as you said, it would still be a tedious amount of work.

    Imperator

    7278 Posts

  • #4, by edmundSaturday, 30. March 2019, 11:39 5 years ago
    Thanks for the reply.
    Yeah, I'm inclined to agree that it's a whole heap of work for very little gain. 
    I managed to get that half-assed fudge working using outfits, but even then, it doesn't necessarily work too well on anything except a very simple scene where the character moves from side to side, otherwise it quickly becomes a nightmare.

    Newbie

    4 Posts

  • #5, by afrlmeSaturday, 30. March 2019, 11:51 5 years ago
    Maybe you will get lucky & one of the people I mentioned will see the post. I know CaligariMarte has posted a reflection shader script before. They shared some screenshots in another post recently which I believe shows a reflection done by shaders.


    I wish I could wrap my head around shaders, but it's mostly just a bunch of random looking gibberish & math - the latter of which I'm not very good at.

    Imperator

    7278 Posts

  • #6, by caligarimarteSaturday, 30. March 2019, 12:21 5 years ago
    I have written a Variation of my Script to hopefully suit your Purpose. smile


    Put "Lua_MirrorShaderScripr" into your Project as a Lua-Definition-Script, and put "Shader_MirrorBehindPlayer" into your Projetc as a Shader, with the Name "MirrorBehindPlayer" so the Script can recognize it. If you just follow the Instructions in the Comments (behind -- in the Lua-Script, and behind // in the Shader), then you will certainly know what you have to change to make it work for your Scene and Character. Unfortunately, I currently had Issues with letting Visionaire recognize and apply these Values automatically, so you will have to put them in manually, I am afraid.

    Hope this helps. smile

    Forum Fan

    145 Posts

  • #7, by edmundSaturday, 30. March 2019, 13:33 5 years ago
    Woah Caligarimarte! Thank you so much, that's really kind of you to help me out!
    I'll give it a try smile

    Newbie

    4 Posts