Menu
Login
Language
DE EN FR ES IT CZ

Search Result

  • Save shader toolkit changes

    How is it possible after using the shader toolkit to save it's changes? I want an options menu where the player can change the game brightness, contrast. No problem with applying the desired effects, but I am having troubles with wiritng that to the .ini file. If I close and open the game again, the changes disappear.I am already using AFRLme's awesome Read/Write Config.ini script :D, and able to change volume, screen size etc. and save them to the .ini file. No idea however how to do this one.I pasted the main script of the shader toolkit to the script editor, also set as "definiton script". (Already check the resources linked in many different topics with similar questions, but I cannot find this exact answer.)Can anyone help me out? :(

    by blaise, 9 years ago

    2
    0
    blaise 9 years ago
  • [SOLVED] Digit String-Manipulation, and a strange Shader-Glitch

    Yesterday or so I have created a little System for my Game which generates Rooms for a Labyrinth or Maze according to a Code that is read when going through an Exit. While the Basics work, I also would like to refine it with two Features...1) ... for which I should get String of that "CaveCode"-Code turned into a Number, meaning to extract only the Numbers and ditch the Letters and an Underscore. I am not very familiar with String-Manipulation, be it in Lua or anywhere else (just not used to using it), so after some little Research I thought the following Line with a "%d+" supposedly finding all the Digits should work, but it doesn't and I don't know what I am doing wrong -- so, I'd be thankful to get some Help on this.Values.CaveCode.Int = tonumber(string.find("02a_00a04a03a01b","%d+"))Another Thing I noticed was what looks like a Glitch, but I am not sure about it. One of the Refinements I mentioned is that I want the Graphics for the Maze to be distorted depending on a Seed that shall not be random but belong to each Room's different Perspectives (so I should just extract the Digits from the CaveCode).2) The Problem is that when I apply a Shader to a Scene-Object, its UV will -- even if the original Graphic was filling the entire Screen -- be cut down to the Measures of actual Content abve zero Alpha. I am sure that is a good Feature for getting rid of unneeded Bytes and Megabytes being shoved into the Cache, but this is one of the Scenarios where it can be a slight Hindrance to my artistic Vision: When I use a Distortion-Shader on an Object, the Parts that should be followed by some empty Space with 0 Alpha, the UV Border is instead right where the Wall-Graphic ends, and thusly the Distortion is restricted to that Area and cannot go beyond, meaning that one Side of the Wall remains straight and undistorted, while the Rest is distorted.So I considered to just add some unnoticable Pixels with an Alpha-Value of maybe 2 or 3% in the opposite Corners of my Maze-Graphics, which automatically makes the Shader equally stretch across the whole Screen for each of the Graphics (because they all fill that exact Space). That Technique works for basically all Elements except the left Wall- and Exit-Graphics, which suddenly seem to have an Area which is not affected by the Shader (which becomes obvious because the Shader also colors the Graphics (because the Cave-Walls shall subtly change Color as you progress through the Maze), but not in this Area. It seems to be that Area which, at the Top and the Bottom, touches the UV-Border with Alpha above zero.This might not necessarily be as big a Problem once I replace my provisoric Placeholder-Graphics of just gray and white Cube-Walls with more organic and concavely shaped Cave-Walls, as their Shape would allow for the Shader to work even if the UV does not fill the entire Screen (which I guess sounds nonsensical, but it makes Sense), BUT then I would still have the Problem of the Shader's Distortion being scaled differently on different Elements, although I want the Distortion to be distributed evenly across the whole Screen.I suppose the more elegant Way to solve that Problem then would be to make it so the Shader's UV does not use the UV of the Object it is applied to, but that of the Screen, as if it was a Screen-Shader. But I haven't yet wrapped my Head around how to do that, even though I tried to look it up.So, either I have to make the Graphics all forced to be fullscreen and then get rid of that white Area, or otherwise learn how to use the Screen-UV for Effects to be applied to an Object. Any Ideas?

    by caligarimarte, 9 years ago

    2
    0
    caligarimarte 9 years ago
  • RE: Visionaire 5 ist unscharf und choppy?

    Vorweg: Ja, es sind Bitmap-Fonts, aber in Visionaire 4.2 weisen sie niemals solche Artefakte auf, der Fehler liegt also nicht per se bei ihrer Bitmap-Natur, sondern, wie Visionaire 5 sie anders handhabt als Visionaire 4 (anmaßend mutmaßende Erklärung folgt weiter unten). Gezoomt wird in meinem Spiel prinzipiell nicht, will ja nichts unscharf machen. ;) Ich habe nur die Projekt-Auflösung auf 1280*720 gestellt, bei Szenen mit 1920*1080 Größe, aber 1280*720 entspricht der Auflösung meines Player-Fensters.  Nein, ich habe noch zweimal nachgeprüft und komme zu folgenden Ergebnissen: * 5.0.2 MIT Smooth Scrolling: Unschärfe und Font-Artefakte treten a'm Wahrscheinlichsten auf, aber nicht immer. * 5.0.2 OHNE Smooth Scrolling: Beide treten auf, aber vielleicht ein kleines Bisschen weniger stark und weniger oft, vielleicht. * 4.2 mit ALTEM Scrolling: Keine Probleme, alles bleibt gestochen scharf. Es gibt auch keinerlei Zooms, keine neuen Shader-Effekte (in dem gezeigten Screenshot ist nicht einmal der Tag-Nacht-Wechsel aktiviert), und auch keine Unterschiede in der Auflösung, das war zwischen diesen Versuchen alles stets konstant.Aber ich habe das Problem, so bin ich mir bei genauer Betrachtung ziemlich sicher, erkannt: Das alte Scrolling war Pixel-für-Pixel, quasi "integer", wohingegen das neue Scrolling "floating" ist und Zwischenschritte zwischen den Pixeln hat.Das hat zu'r Folge, dass Grafiken, während sie bei'm Scrollen durch das Bild wandern, "unscharf wabern", weil ihre Pixel flüssig durch das Antialiasing hindurch wandern, und die Schärfe dabei immer wieder ab- und zunimmt. Das gilt auch für das normale neue Scrolling, wird aber bei'm Smooth Scrolling evtl noch verstärkt, gerade weil noch feinere Zwischenschritte erlaubt werden. Ich kann verstehen, dass Floating Point Scrolling auf dem Papier besser klingt als Integer, aber wenn dadurch das Bild unscharf wird und solche Artefakte auftreten, dann ist Integer doch vorzuziehen. Für mich persönlich ist das alles zwar kein großes Prblem, weil ich Scrolling generell verabscheue und in diesem meinem Spiel abseits dieses testzwecklichen Versuchs dezidiert nicht benutze (womit ich dann diese Fehler nicht haben werde, hoffe ich), aber es ist doch unpraktisch für all die vielen Nutzer, die Scrolling ganz toll finden und Gebrauch davon machen. (Was ich bei einem anderen Projekt vielleicht auch täte.) Vielleicht wäre es schön, ein Setting dafür zu haben, ob Scrolling "integer" oder "floating" sein soll? Ich bin mir sicher, das Smooth Scrolling würde auch mit Integer-Scrolling noch ganz gut aussehen.

    by caligarimarte, 9 years ago

    2
    0
    caligarimarte 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    @ AFRLme: Well, that sounds a little Bit totalitarian, doesn't it? I am reminded of the Ultima Games, where the Story-Focus lies on several very altruistic Virtues, and then in one Game these same Virtues are forced onto the People by a totalitarian Regime and all of a sudden it really doesn't sound quite as nice anymore. (Very close to Reality.)@ SimonS: Though I do not know that right now, I do assume that the Game's Performance might benefit anyway if a Shader is only active while the Scene it is for is running (do added Shaders on another Scene still "run" and eat up Performance, like looping Functions?), so it might be better anyway if I add and remove these specific Shaders Scene by Scene -- that Way the Shader will work fine, and maybe it'll even help the Performance. So, since I have found some Sort of Solution, I guess that last Problem of mine is of very little Importance, but none the less a Bit of a Problem (since one Shader on multiple Objects works fine with the No-Toolkit Form), and I can at last be at Peace. (Even though I am not entirely sure whether this qualifies for the Topic to be marked as "SOLVED" or not.)Thank you very much for all the Help so far, Simon.

    by caligarimarte, 9 years ago

    10
    0
    caligarimarte 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    (P.S.: I know it is a little bizarre that I keep up the English in a Dialogue between two German-Speakers, but in Case other People encounter the same Problems, I think the Problems and their Solutions should be available to every User on the Forum, so I prefer to keep it up.)I'm pretty sure all of us non-German speakers appreciate it. ;)If it was up to me, the entire forum would have an enforced English only rule. You could call me biased for that because my native Language is in English, but almost every single forum/discord/voip thing I join always have the English only rule, even when the owners aren't even native English speakers.Anyway, this shader stuff is too complex for me. Would love to be able to learn c languages/glsl but I lack the patience to learn it. Learning new things is kind of hard for me because of my bad memory.

    by afrlme, 9 years ago

    10
    0
    afrlme 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    Thank you very much, now the Shaders work! And I was quite ecstatic about not having to use the (indeed quite ugly) Main Loop, so I immediately changed the other already working Shaders from the "Without the Shader-Toolkit"-Form into the "With the Shader-Toolkit"-Form because the former didn't take the bind()-Command and thusly seemed to need the Main Loop...... but this has led me to another Problem: It worked fine when I was using the "No-Toolkit"-Form with the Main Loop on two Cloud-Objects, each in a different Scene and each having its own Script adding the same Shader but with different Values. Now that I have rewritten the Code into the "With-Toolkit"-Form and using only bind() instead of the Main Loop, only the second Cloud-Object will get its Shader updated, the first will be stuck.Both Scripts are Definition Scripts, so maybe I would have to go the extra Mile and turn them into Execution Scripts and turn the Shaders on or off depending on what Scene the Player is in? I tried to add shaderRemoveEffect inside the Script, before shader AddEffect (which I know can work on my Day-Night-Cycle to ensure it is not running before another Scene adds it), but here with the Cloud-Shader on two separate Objects, it doesn't seem to work.So now I am torn between the seemingly only halfway working bind()-Form and the ugly but working Main Loop. Is there a Way to fix that Issue with the bind()-Form alone?(P.S.: I know it is a little bizarre that I keep up the English in a Dialogue between two German-Speakers, but in Case other People encounter the same Problems, I think the Problems and their Solutions should be available to every User on the Forum, so I prefer to keep it up.)

    by caligarimarte, 9 years ago

    10
    0
    caligarimarte 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    The correct load code looks like this, seems the code was for another version of the toolkit:local eff = "Daynight"shader_effects[eff] = { shader = Shaders[eff].Compiled }shaderAddEffect(eff)bind(eff, "daytime", field("getTime() * 0.00125"))Also don't use that ugly main loop handler. You can do everything with the bind().

    by SimonS, 9 years ago

    10
    0
    SimonS 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    Thank you very much! I got the Clouds to work (and at Least it is quite a Blessing that seemingly Shaders no longer depend on rightly ordered IDs). Even though there is still a reeeally miniscule "not quite wrapping" Border visible (comparable to when I clamped the Coordinates), that is next to invisible, and thusly not a big Deal. Now I am happy with that Cloud-Effect.Though now I am trying to implement another Shader applied to the whole Screen (namely my good old Day-&-Night Cycle), and I am following the Example from the Reference you gave me -- thank you very much for it! --, but alas, for some obscure Reason the Script just won't activate my "daynight"-Shader. Can you tell me what I am doing wrong? (I am sure the Mistake is some truly minor Detail, making this whole Question look utterly ridiculous, but I am afraid I just can't find it.)Here is the Shader (for the Sake of Completion)...#ifdef GL_ES precision lowp float; precision lowp int; #endif uniform sampler2D texel; varying vec2 uvVarying; const float pi = 3.1415926535897932384626433832795; uniform float daytime; void main () {  float x = daytime;  float R = (0.75+sin((x-3.0)*0.5*pi + cos((x-3.0)*0.5*pi))*0.25);  float G = (0.75+0.125+cos(x*0.5*pi)*0.125);  float B = (0.75+0.125+cos(x*1.0*pi)*0.125);  vec3 col = vec3(R,G,B);  gl_FragColor = vec4(texture2D(texel, uvVarying.xy).rgb * col, 1.0); }... and here is the Script:local eff = "daynight" shaders[eff] = shader(eff, Shaders[eff].Compiled) shaderAddEffect(eff) bind(eff, "daytime", field("Values.Daytime.Int")) function updateDaynight()  shader_effects[eff].num.daytime = Values.Daytime.Int * 0.0125 end registerEventHandler("mainLoop", "updateDaynight") 

    by caligarimarte, 9 years ago

    10
    0
    caligarimarte 9 years ago
  • RE: Shader-Texture not seamlessly tileable?

    You can no longer write the shaders in lua, V5 uses DX11, so the shaders must be translated. Use the shader tab and create a shader, change the fragment with yours and mess around until it compiles.Now using it (ref here: http://www.visionaire-studio.com/luadocs/#shaders ):local eff="Wolkenmaske" local obj = "TestClouds" local id = 2 ----------------------------- shaders[eff] = shader(eff, Shaders["ShaderName"].Compiled) shaderAddEffect(eff) shaderRemoveEffect(eff) shader_effects[eff].num.strength=1 bind(eff, "time", field("shader_iTime")) bind(eff, "daytime", field("Values.Daytime.Int * 0.0125")); Objects[obj].ShaderSet = id 

    by SimonS, 9 years ago

    10
    0
    SimonS 9 years ago
  • RE: Animated background - and character "losing" color. Questions from a newcomer to both visionaire and game making at large

    You can use a shader for the character.I don't know why everyone's so afraid of GLSL.Create a shader Grayscale, change the Fragment to this:#ifdef GL_ESprecision lowp float;precision lowp int;#endifuniform vec4 color;uniform sampler2D texel;varying vec2 uvVarying;void main (){  vec4 col = (texture2D (texel, uvVarying) * color);  float grey = (col.r+col.g+col.b)/3.0;  gl_FragColor = vec4(grey,grey,grey,col.a);} Then using it (a definition script):local grayscaleShader = shaderCompile(Shaders.Grayscale.Compiled) function setGrayscale(char, active)   char.ShaderSet = grayscaleShader end setGrayscale(game.CurrentCharacter, true)Simple ay.

    by SimonS, 9 years ago

    5
    0
    SimonS 9 years ago