Search Result

  • RE: Yet another reflections query

    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.

    by afrlme, 6 years ago

    6
    0
    afrlme 6 years ago
  • Yet another reflections query

    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 achieveBear 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!

    by edmund, 6 years ago

    6
    0
    edmund 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    didnt recognize the god rays. Pretty neat. Im very interested in how that works :ONormalmaps as itself can be done inside a normal shader as you can use a normal map uniform _t_normal inside the callback(object)Oh, is there already a functional Normalmap-Lighting-Shader available online for Use in Visionaire? If so, I must have totally missed that -- and, where could I find that? (I think it could easily be combined with automatic Normalmap-Generation as I have started to work on.)The Godrays in that Screenshot are unfortunately rather expensive -- primarily because I have no Downsampling and therefore must use too many Samples (48 Iterations of Textures offset against the Light-Vector), so I have alternatively started to play around with a simpler Concept which uses only 3 Samples of Textures being bent/stretched and clamped at different Points (see Image, also with a Shadow using only 1 Sample -- I consider offering Graphings Settings with different Levels of Complexity).

    by caligarimarte, 6 years ago

    22
    0
    caligarimarte 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    didnt recognize the god rays. Pretty neat. Im very interested in how that works :ONormalmaps as itself can be done inside a normal shader as you can use a normal map uniform _t_normal inside the callback(object):...local nmap = "normalmaps/"..graphics.getCurrentSpritePath(object)...graphics.shaderUniform(lightingShader, "_t_normal", nmap )

    by sebastian, 6 years ago

    22
    0
    sebastian 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    why dont you use a normalmap for the light stuff?The reflection shader however looks neat. You need to share some scripts ;)...I thought you want to get the top/left position of the actual sprite and calculate it by substracting the AnimationSize from the actual players position. This however doesnt contain the offset from the sprite to the actual center.Thanks. :)The Mechanics are still a Bit faulty though, only the Reflection works without any Problems, because that is such a simple Technique... except for the Positioning/Scaling, as that is the big Problem discussed here.I actually started out writing a Shader that would automatically generate a Normalmap for my Character that could be used for Lighting (see Image -- though that is a WIP-Shot), but then I had to admit to myself that I just don't understand the necessary Normal-Vector-Dotproduct-Etc.-Calculations necessary to actually actually use the Normalmap (but I might keep trying), so I instead settled with the much easier Mechanic of using an offset inverted Alphamask blurred across the Character according to the Lightvector (as seen on the multiple Images I have already posted), and I think the Results are neat enough, and run fast enough as well. :)However, I never said that that the "Lighting-Stuff" -- i.e. the Character-Lighting -- is problematic in any Way, my Problem is with getting a properly positioned Mask for the shown Effects. I don't see how a Normalmap (on my Character) could possibly produce Godrays, Reflections, or Shadows cast across the Background in Pseudo-3D. Normalmaps don't help with that.Concerning this: I thought you want to get the top/left position of the actual sprite and calculate it by substracting the AnimationSize from the actual players position. This however doesnt contain the offset from the sprite to the actual center.I am currently using the Character's Position (and the upper-left Corner of the Duplicate would be there), which is at the Animation-Center and therefore have to offset the Duplicate by the Position of the Animation-Center, which usually is half the Width of the Character-Sprite, and ca. 0.94 of its Height. If, however, I could load the Animation-Sprite's upper-left Corner's Onscreen-Position directly, I would not have to shift it by any such Offset (which changes with each Angle) and could most probably directly place it where the current Sprite is. But you might be right, I should try and do the Calculation with the AnimationSize or AnimationInnerSize and see if that might make any beneficial Difference. :) (Problem still being that the AnimationSize does such weird Things when being loaded into the Shader.)

    by caligarimarte, 6 years ago

    22
    0
    caligarimarte 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    why dont you use a normalmap for the light stuff?The reflection shader however looks neat. You need to share some scripts ;)I am not 100% sure what you mean by substract also the spriteSize-"distance to position.x/y". Right now, the UV-Coordinate for the Mask gets a manually inserted Offset "+vec2(0.5,0.94)" to approximate the Position according to the Animation-Center. Did you mean something different? If so, then maybe that could be something I have been entirely missing so far. smileI thought you want to get the top/left position of the actual sprite and calculate it by substracting the AnimationSize from the actual players position. This however doesnt contain the offset from the sprite to the actual center.

    by sebastian, 6 years ago

    22
    0
    sebastian 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    getAnimationSize() should work.At least as i tried it last time, i got the sprite size incl. its zoom calculated in. the problem is that the sprite position is mostly not exactly the point where the sprite ends or exactly centeres. So you need to consider that you need to substract also the spriteSize-"distance to position.x/y"Yes, it is very strange though. I seemingly can load the AnimationSize (divided by the Screen-Dimensions or not):  graphics.shaderUniform(shader_effects[eff].num.num, "AnimationSize",     {      graphics.getAnimationSize(Erlene).x / 1920,      graphics.getAnimationSize(Erlene).y / 1080    } )But then, the Duplicate weirdly has very different Scaling-Dimensions compared to if I put in the Values of the usual Animation-Size manually inside the Shader -- as you can see in the Image with the three differently scaled Duplicates.(I also tried making the Screen-Dimension-Division inside the Shader when using the Uniform loaded via getAnimationSize(), but that strangely did not work at all then.)I am not 100% sure what you mean by substract also the spriteSize-"distance to position.x/y". Right now, the UV-Coordinate for the Mask gets a manually inserted Offset "+vec2(0.5,0.94)" to approximate the Position according to the Animation-Center. Did you mean something different? If so, then maybe that could be something I have been entirely missing so far. :)@ Machtnix:Yes, after loading the Sprite into the Shader and scaling/positioning the Sprite to somewhat fit the Player-Character, I use the Alpha-Mask to get a Mask for Effects like Shadowcasting and Crepuscular Rays (as you can see on one of the Images, though I will have to use a different Rays-Technique due to a Lack of Downscaling (or does Visionaire have that??)), or the RGB-Values for a Reflection (as seen one another one of the Images). Yes, the Alpha-Mask has the same Dimensions as the Sprite, but Positioning and Scaling the Sprite in the Shader (automatically and exactly) is the Problem. :)

    by caligarimarte, 6 years ago

    22
    0
    caligarimarte 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    Ich bin raus... Ich verstehe nur Bahnhof. und wenn ich den Übersetzer nutze (wie jetzt), kommt nur Müll raus.Warum die Figur doppelt erscheint, kann ich mir nicht erklären. Ist wohl wirklich ein Shader-Problem. Ich hatte es anfangs auch völlig falsch interpretiert, dank der Bilder sehe ich erst, was los ist.Dass die Figur doppelt erscheint, soll ja so sein, genau darum geht es in dem Shader, dass ihre Grafik dupliziert und an dieselbe Stelle gesetzt werde, damit eine "Maske" für den Shader erstellt werden kann, womit ich dann andere Spielereien machen kann. Dass bei dem Beispielbild nur ein schlichtes Duplikat abgebildet ist, ist nur zu'r Veranschaulichung des Größen- und Positionierungs-Unterschiedes, aber das ist wohl in meinen ausschweifenden Textwänden gelinde untergegangen, sorry.The Duplicate is intentional, to be used as a "Mask" for the Shader -- that it is here visualized as a mere Duplicate is just to visualize the Difference in Size and Position.

    by caligarimarte, 6 years ago

    22
    0
    caligarimarte 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    Ich bin raus... Ich verstehe nur Bahnhof. und wenn ich den Übersetzer nutze (wie jetzt), kommt nur Müll raus.Warum die Figur doppelt erscheint, kann ich mir nicht erklären. Ist wohl wirklich ein Shader-Problem. Ich hatte es anfangs auch völlig falsch interpretiert, dank der Bilder sehe ich erst, was los ist.I'm out ... I understand only station. And if I use the translator (like now), only garbage comes out. :) :)Why the character appears double, I can not explain. Is really a shader problem. At the beginning I interpreted it completely wrong, thanks to the pictures I see what's going on.

    by Machtnix, 6 years ago

    22
    0
    Machtnix 6 years ago
  • RE: Get Character's current Animation-Frame's Size & Position?

    Hm, I just tried the "quick and dirty" Solution, and without changing anything about my current Code correcting (and now hyper-correcting) the Values, the Result does indeed look different again (fourth Part of the Image, the first three Parts have no Corner-Pixels and show the Problem so far -- you can see a flatly lit Duplicate of her behind her, for Testing-Purposes, with an Offset). So that at least shows me that it really is an Issue with Visionaire cropping the Sprite down to the visible Pixels, or else the Version with Corner-Pixels (which here are clearly visible for Testing, to see the Difference) would be placed and scaled the same as the others.I could, of Course, use the quick and dirty Solution and apply such Corner-Pixels to all Animations, but it would be dirty for a Reason, I suppose, because the Cropping is done to cut down Texture-Sizes, if I get that correctly -- so that would probably hurt the Performance overall, albeit just a tiny, tiny Bit. (It might also still prove problematic if any special Animation with different Image-Sizes and different Animation-Centers are being used, which can occasionally happen.)Other than that, it would certainly we a somewhat functional Workaround, I suppose, so thanks for the Suggestion, but I still wish I knew of a Way to get the Character-Sprite's Position on Screen, so I could prevent the technical "dirty"-Part of such a Workaround and also make it work with all Animations automatically.(By the Way, I can indeed get the cropped AnimationSize via "graphics.getAnimationInnerSize()", though it strangely gives odd Results inside the Shader... though I might get that to work. Now I'd only need the same for the Sprite-Position, be it cropped or uncropped.)EDIT: So, is there a Way to get that Position via "ActiveAnimations" and "CurrentSpritePos" maybe, for the Character? I have tried that, but maybe I just didn't code it correctly.

    by caligarimarte, 6 years ago

    22
    0
    caligarimarte 6 years ago