Search Result

  • RE: Make mirror and reflections

    Ok you need to add first code to your shader list and call it ReflectionShader01 (or any other name but you will then need to add it to Lua part. Then you can call this shader with Lua (second code here) with any action you create (at begin of scene or whatever you use). Also you will need to have your mask png linkded correctly so game knows where shader is appled on the screen. I will attach one I am using for my game but you can make any shape of it... Also other picture is used if you want to create waves effect alike water. My code if for clear non moving mirror tho. But you can play with settings to customize as you wish :)#ifdef GL_ES precision lowp float; precision lowp int; #endif uniform sampler2D texel; uniform sampler2D DistortTex; uniform sampler2D MaskTex; varying vec2 uvVarying; uniform float time; uniform float TintR; uniform float TintG; uniform float TintB; uniform float TintMix; uniform float Mirror_PosY; uniform float Distort_MoveX; uniform float Distort_MoveY; uniform float Strength; //uniform float Mirror_PosX; //uniform float Brechung; void main () {   vec2 uv = uvVarying;   float Mask = texture2D(MaskTex, uv).r;   float Distort = texture2D(DistortTex, fract(uv + vec2(time*Distort_MoveX,time*Distort_MoveY) ) ).r;   vec4 ColorTint = vec4(TintR,TintG,TintB,1.0);   float Brechung = 1.0;   vec4 result = vec4(0.0);   vec4 base = texture2D(texel, uv);   float Offset = (Mirror_PosY-0.5)*2.0;     // if y 0.67 then 0.34     // if y 0.75 then 0.5     // if y 0.5 then 0.0   //   if (uv.y > Mirror_PosY) {     vec4 reflection = mix( texture2D(texel, vec2(uv.x,((1.0-uv.y)*Brechung) + (Distort*Strength) +Offset ) ) , ColorTint, TintMix);     result = mix(base, reflection, Mask);   } else {     result = base;   }   gl_FragColor = result; }local eff = "ReflectionShader01" shader_effects[eff] = { shader = Shaders[eff].Compiled } shaderAddEffect(eff) bind(eff, "time", field("getTime()*0.001")) bind(eff, "TintR", field("0.3")) bind(eff, "TintG", field("0.3")) bind(eff, "TintB", field("0.3")) bind(eff, "TintMix", field("0.5")) bind(eff, "Mirror_PosY", field("0.78")) bind(eff, "Distort_MoveX", field("0.0")) bind(eff, "Distort_MoveY", field("0.0")) bind(eff, "Strength", field("0.0")) --bind(eff, "Mirror_PosX", field("1.0")) --bind(eff, "Brechung", field("1.0")) graphics.shaderUniform(shader_effects[eff].num.num, "_t_DistortTex", "vispath:effects/clouds02.png") graphics.shaderUniform(shader_effects[eff].num.num, "_t_MaskTex", "vispath:effects/mask02.png")

    by nenad-asanovic, 6 years ago

    13
    0
    nenad-asanovic 6 years ago
  • RE: Make mirror and reflections

    Well you should really check this post LINK it's really easy to make things work as you would basically need just to copy and adjust shader to your game as you wish. HEre is sample of how it looks in my game (bottom part of screen is shader reflection, perfect mirror).

    by nenad-asanovic, 6 years ago

    13
    0
    nenad-asanovic 6 years ago
  • RE: Make mirror and reflections

    I have to be honest... trying to do this without using shaders to generate a mirrored reflection is a ton of work. You need to listen out for character animations, their positions, sort out offets & so on. Only having to deal with a characters idle/walk animations is one thing, but if you want to also include random animations/interaction animations, etc then things will get complicated real fast.I'm not sure if you are in our Discord server, but Caligari Marte has shared a bunch of shader stuff on there in the past & I believe one of the things was a reflection shader script. You can always join & @ping them about it.

    by afrlme, 6 years ago

    13
    0
    afrlme 6 years ago
  • RE: Several questions: character with gamepad + shader with texts + 3d environment + camera

    the bottom most & top most way points are the same values as the middle two, just their for safety or it's possible that I want from above/below a specific y-coordinate for the character to always be scaled at a certain value - mostly though, it's just a safety habit that I use to enforce that the characters below & above x point don't randomly change to a different scale value.If you are rotating the 3D character/object then you are in effect rotating the camera. I think you would just have to think in inverse directions though, so that right it left & down is up, etc. & you still have the scene camera/shader viewport camera for panning horizontally/vertically & zooming in/out.

    by afrlme, 6 years ago

    25
    0
    afrlme 6 years ago
  • RE: Several questions: character with gamepad + shader with texts + 3d environment + camera

    I guess if the environment was imported as a 3D object/character it might work as you could rotate that around - like Nige has done with his 3D inventory object, but performance wise... who knows. You can control the camera position/angle per 3D thing I believe, but the scene camera itself is 2D only, you can only pan/zoom.In regards to the way system - you could create 2 different way systems. One with way points & one without way points. You could listen out for input from gamepad/keyboard + mouse to set a condition to tell the game that x input is now primary & change way system based on that. In regards to scaling, you should ideally be creating the scale values outside of the way system border anyway. Vertical scaling works best. See my screenshot (below).https://i.gyazo.com/277abf44ea5ecf4dab922eedb4d28f2e.pngI'm not really sure about the text thing & shaders. I don't really mess around with shader side of the engine all that much. As an alternative you could use images or Lua draw instead of built in display texts.

    by afrlme, 6 years ago

    25
    0
    afrlme 6 years ago
  • Several questions: character with gamepad + shader with texts + 3d environment + camera

    Hi everyone!Just finished my submission for Adventure Jam 2019. I invite you to have a look if you're curious. Here's a video and the link to the Game Jolt page:https://gamejolt.com/games/mvem_twotio/418477https://youtu.be/hcfRoQs60kcI would like to continue this project and add several improvements, but there are several things that I don't know to do, and it would be great if you could help me.Here's my list of questions:   1/ Character with Gamepad:In my recent tests, I had no problem to setup the VS5 script to play with keyboard/gamepad and it's working quite well.My main problem is that the character follows too much the waypoint, which is not very natural with this gameplay.Is it possible to "disable/dissociate" the waypoint from the main character in order to allow the player to move freely (but still have the changes of scale, and still keep the way borders)?   2/ Shader with text:During my cutscenes I wanted to zoom on the characters with the shaders. However I am using specific code for the texts, and as a result as soon as the zoom is activated, the text is not at the correct position anymore.I know that that there is a code to exclude interfaces from shaders, I am using it and it works well.Would there be also by chance a code to exlude text? I have this code but it doesn't do anything:eShaderExcludeTextsAndCursor 2   3/ 3D environment:This is a much more complicated question. The 3d characters are working very well in VS and I am very happy, and it would seem that there is also the possibility to use 3d objects (which I didn't need in my demo for Adventure Jam). Is it possible to create a 3d environment? I mean something very simple (like a sphere or box) where the character could be located on a plane surface and walk?   4/ Camera:This question is related directly to the previous one. If I can put my character in a sphere or box, walking on a plane surface: is it possible to change the camera (rotate it around the character)? And increase the distance of the camera from the character? I think that this is quite complicated however, and that an engine like Unity would be more apropriate, but on the other hand I like the simplicity and stability of VS and would love to continue to use it.Thanks in advance, I'm looking forward to read your messages of help, and try to include new features in my project!

    by Simon_ASA, 6 years ago

    25
    0
    Simon_ASA 6 years ago
  • Build missing shaderUniform textures from dynamic paths

    I've been playing around with shaders and have normal mapping working pretty well -- at least as long as I'm running within the VS Editor. However, when I create a build and test there, it seems to not include the necessary textures.The problem seems to be that the build process only includes hard-coded texture paths, e.g. this works fine when I run my build: graphics.shaderUniform(shader, "_t_normal", "vispath:frame01_n.png")However, when I construct the path to the texture dynamically at run-time, the texture is not included in the build and hence my effect falls apart. Even something as simple as this makes it not include the texture in the build:  graphics.shaderUniform(shader, "_t_normal", "vispath:frame01_n" .. ".png")Looking into the generated report.txt I can confirm that my texture is indeed not included in the build here.I've tried including the texture in an unused animation on my character, in which case it does appear to be included in the build according to report.txt, but I can't seem to access it at the expected path to pass it to my shader.Is there any way I can force the build process to include specific textures? Preferably via Lua so that I can just include a big directory tree of images?This is with VS 5.0.9 on Mac OS 10.13.6.Thanks!

    by propapanda, 6 years ago

    4
    0
    propapanda 6 years ago
  • RE: Problem with flashlight in VS 5?

    I'm still experimenting with shaderlamp ... At the moment it seems generally not possible to connect shaders to a fixed position in the scene or an object / character. The screen size of my game is 1920x1080 and the scene is almost twice as big. If I want to place the beam of a lamp, the light moves along when scrolling. That means the beam stays in the same place on the screen but my scene with the lamp moves away from it. Can I use this shader for such purposes at all (lamps, sunlight, flashlights, ...)?

    by steve-12, 6 years ago

    10
    0
    steve-12 6 years ago
  • RE: Yet another reflections query

    I have written a Variation of my Script to hopefully suit your Purpose. :)https://drive.google.com/open?id=1gOrPJx9jkk_0-F10gzg3ziXzi8Qu6gc1Put "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. :)

    by caligarimarte, 6 years ago

    6
    0
    caligarimarte 6 years ago
  • RE: Yet another reflections query

    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.https://www.visionaire-studio.net/forum/thread/get-characters-current-animation-frames-size-position/2/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.

    by afrlme, 6 years ago

    6
    0
    afrlme 6 years ago