Search Result

  • 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, 5 years ago

    22
    0
    caligarimarte 5 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, 5 years ago

    22
    0
    sebastian 5 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, 5 years ago

    22
    0
    caligarimarte 5 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, 5 years ago

    22
    0
    sebastian 5 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, 5 years ago

    22
    0
    caligarimarte 5 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, 5 years ago

    22
    0
    caligarimarte 5 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, 5 years ago

    22
    0
    Machtnix 5 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, 5 years ago

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

    Ah yes, it might make Sense to explain that Problem: The Character.Position is centered on the manually set Point where the Character's Feet touch the Ground, but if a Sprite is being loaded into a Shader as a Texture, the Center-Point will be the upper left Corner of the Sprite, so the Character-Sprite loaded into the Shader would have its upper left Corner centered on the Point where the actual Character's Feet touch the Ground (and the loaded Sprite would be displayed to the bottom right of the actual Character). So, the Sprite loaded into the Shader should have its upper left Corner placed where the actual Character's Sprite has its upper left Corner placed on Screen.The Problem is similar to scaling or rotating an Object via Lua, in which Case the Sprite's "RotationCenter" can and should be set as well, but since "graphics.shaderUniform" wants me to load in a Sprite via Filepath, I seemingly cannot just make it load a specificly defined Sprite that has been definied to have its RotationCenter at a specific Point (if that would even help me here).So, I am afraid the Character.Position is not what I am looking for in this particular Case, though I am currently using that (and Character.Size) to place and scale the Sprite in the Shader, but that needs anadditional Correction, and depending on my Character's current Animation, that Approximation (which necessarily includes Values which make no Sense to me) can sometimes fit perfectly and sometimes have a slight but noticeable Offset, possibly (but I can only speculate) because the Character's current Sprite might be cut down to only its visible Pixels (which would be the Difference between "graphics.getAnimationSize" and "graphics.getAnimationInnerSize", which I might be able to use for Scaling (not sure, I tried, it did not work, but maybe I just coded it wrongly), but that still would not help me with the Sprite's Positioning, I think).

    by caligarimarte, 5 years ago

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

    Hello, I have recently experimented with some Shader-Ideas (Shadowcasting, Reflections, Crepuscular Rays) by loading my Character's current Sprite into different Shaders via "graphics.getCurrentSpritePath()" -- and it works pretty well! But I have only managed to approximately place and size the loaded Sprite manually inside the Shader, the manual Positioning does not always entirely match up. It would be nice if I could load in that current Animation-Frame's Size and Position (on Screen) to directly feed these Values into the Shader, automatically and always fitting. I have tried several Methods, among them "CurrentSpritePos", "Sprite:getPosition()", and "getAnimationSize()", but the Problem seems to be that the Methods either only work for Object-Sprites but not Character-Sprites, and/or I do not know how a Character's current Animation-Frame could be accessed (except for its Filepath). Can anyone help me with that?

    by caligarimarte, 5 years ago

    22
    0
    caligarimarte 5 years ago