Search Result

  • RE: [SOLVED] Lightmap-Tint in Character-Shader

    Okay, I have solved the Issue as described, by loading the Lightmap into the Shader and calculating Color of the Player's Spot on it inside the Shader -- assuming a Game-Resolution of 1920*1080px, here are some Code-Snippets for that Solution, in Case anyone else on the Forum might ever need it.LUA-SCRIPT: graphics.shaderUniform(eff, "ObjPosX", Characters["Player"].Position.x /1920); graphics.shaderUniform(eff, "ObjPosY", Characters["Player"].Position.y /1080); graphics.shaderUniform(eff, "_t_LightmapTex", game.CurrentScene.LightMap)  SHADER: uniform sampler2D LightmapTex; uniform float ObjPosX; uniform float ObjPosY; ... vec3 Lightmap = texture2D(LightmapTex, uvVarying / vec2(1920,1080) + vec2(ObjPosX,ObjPosY) ).rgb; result.rgb *= Lightmap;For the Sake of other People's Comfort, if anyone will ever search for it, I will also change the Title of the Thread, to befit the Solution better -- I hope that is okay.

    by caligarimarte, 5 years ago

    5
    0
    caligarimarte 5 years ago
  • RE: [SOLVED] Lightmap-Tint in Character-Shader

    it seems to be -1 for default tint (aka no tint) otherwise if you were to assign a red tint with 0x0000ff, then it would return 255 which I think is the alpha equivalent of hex? Though I have just tried and turned off the Shader-Script entirely, then told Visionaire to wait two Seconds before executing Values.DebugText.String = tostring(Erlene.Tint), and then after another short Pause told it to give show me <vs=debugtext>, and although without the Shader I can clearly see the Character being tinted according to the Lightmap, the Value I am shown is still "-1". So, it must be something other than Default-Tint aka. no Tint...... or is the Character's lightmap-influenced Tint not saved in the Character's "Tint"? This has just now occurred to me, in which Case it would make Sense why this hasn't worked so far. But as far as I can tell, "the lightmap (if present) and scene brightness will be used for the tint of the character", so to my Understanding (or Lack thereof) the Tint according to the Lightmap should actually be accessible via the Character's Tint, without a manual Setting. Or is lightmap-influenced Tint just "no Tint"? But then, where and how do I get the Linghtmap-Influence-Tint via Lua?EDIT: I guess it might be possible to load the current Scene's Lightmap into the Shader and use the Character's Position to calculate from that Lightmap-Image what Color it should be. I guess. I just hoped it would not have to be such a clunky Workaround. :/</vs=debugtext>

    by caligarimarte, 5 years ago

    5
    0
    caligarimarte 5 years ago
  • RE: [SOLVED] Lightmap-Tint in Character-Shader

    tint is 0xBGR I think. for some reason red & blue are not in the correct order they are supposed to be, so red would be something along the lines of 0x00ff00 instead of 0xff0000.I am aware of that (in BGR Red would be 0x0000ff), but that is not my Problem. I just do not know how to visualize the Value so I can check what it looks like, because I have to assume the Conversion Code cannot handle it, and if I depict tostring(Characters["Player"].Tint) in an Object Text via <vs> (since I cannot seem to make Sense of the print-Function in Visionaire), I only get -1 or nil as a Result. Depicting or utilizing (in the Shader) a manually written Hex-Code is no Problem, so I have to assume there is something odd about the Tint's Format, and it is not just that it is BGR.Here is the Conversion-Code, and the Line to depict it as an ObjectText for the Value "DebugText"; "Erlene" is a Global that refers to my Player-Character, getObject("Characters[Erlene]"). What could I be doing wrong?Values.DebugText.String = tostring(Erlene.Tint)hex = tostring(Erlene.Tint):gsub("0x","")graphics.shaderUniform(eff, "ObjTint", { tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))} );

    by caligarimarte, 5 years ago

    5
    0
    caligarimarte 5 years ago
  • [SOLVED] Lightmap-Tint in Character-Shader

    Hello, I recently noticed that after applying a Shader to my Character, the Character would lose its lightmap-influenced Tint. So, I thought I'll just add the Tint to the Shader as a vec3 -- and then I remembered the Tint is in Hex-Code, so I have to try and parse it from Hex to RGB first. I have a functioning Script for the Conversion, at least it functions if I manually write down a Hex-Color like "#ff0000" or "0xff0000" and convert that to RGB, but when I tell the Code to do that with Player-Character's Tint, it just doesn't work. I would like to try and display what the Character's Tint Value looks like, by trying to display it either as an Int or a String onscreen (I don't seem to understand how to use the print Function in Visionaire -- yes, I know that sounds ridiculous), but the only Results I get are "-1" or "nil", but never anything that looks like a Hex-Colorcode. So, in Order to know what exactly it looks like and to know how the Hex-RGB-Conversion Script must be adapted, how can I see the Character's Tint displayed anywhere?

    by caligarimarte, 5 years ago

    5
    0
    caligarimarte 5 years ago
  • RE: Torch effect like in Lone Survivor?

    You need the shader tool kit, its called  shaderscript11.lua and you'll find it in the wikihttp://www.visionaire-studio.com/luadocs/downloads/shaderscript11.luaOrder matters! so the shaderscript11 is listed first then the script with the vignette shader script

    by Nigec, 5 years ago

    4
    0
    Nigec 5 years ago
  • RE: Torch effect like in Lone Survivor?

    You can do it with a Shader, I failed dismally but Simon put me right:local name = "vignette"shader_effects[name] = { shader = Shaders.vignette.Compiled }shaderAddEffect(name)shader_effects[name].num.u_resolution = {1920,1080}shader_effects[name].num.vPos = {1920/2,1080/2}varying vec2 uv;uniform sampler2D texel;uniform vec2 u_resolution;uniform vec2 vPos;void main (){  vec4 color = texture2D(texel, uv);  vec2 position = uv - vec2(0.5);             float dist = length(position * vec2(u_resolution.x/u_resolution.y, 1.0));  float radius = 0.5;  float softness = 0.09;  float vignette = smoothstep(radius, radius - softness, dist);  color.rgb = color.rgb - (1.0 - vignette);  gl_FragColor = color;}

    by Nigec, 5 years ago

    4
    0
    Nigec 5 years ago
  • RE: Torch effect like in Lone Survivor?

    The professional way would be a shader, but I have no idea how to do that, maybe look into vignetting?The age old  way is and image with a transparent dot in the center twice the size of the stage as a cursor or following overlay

    by Nigec, 5 years ago

    4
    0
    Nigec 5 years ago
  • RE: [Solved] Shaders (again) in VS5

    Oh great, yes it works, thanks so much!!!So to summarize for future people who would be interested:1 - Use the latest script availableGet it here: https://www.visionaire-studio.com/luadocs/#shadertoolkit(download shaderscript.lua, open it and paste the content in a new Definition script)2 - Make sure you use the correct syntax (check the examples in the script, the syntax might differ from previous versions)Examples:-- shaderBlur(radius, delay)-- shaderSaturation(factor, delay)-- shaderLightness(offset, delay)-- shaderContrast(contrast, delay)3 - Use this script to activate a premade fullscreen shader:local name = "ShaderName"shaderAddEffect(name)shader_effects[ name].num.speed = 0.2bind(name, "time", field("shader_iTime"))(where you have to replace ShaderName by one of these:warp1tv1ripple1*ripple2*asciiedgeglowchromaripple3warp2ripple4pearlshighlightfourbittv2tv3tv4)* Might be brokenAnd enjoy the result!

    by Simon_ASA, 5 years ago

    8
    0
    Simon_ASA 5 years ago
  • RE: [Solved] Shaders (again) in VS5

    And also how does it work now to use the premade shaders (tv1, tv2, etc)?I was just trying to use the new script provided by Simon:-- using as fullscreen effectlocal name = "ShaderName"shader_effects[name] = { shader = Shaders.ShaderName.Compiled }shaderAddEffect(name)shader_effects[ name].num.speed = 0.2 bind(name, "time", field("shader_iTime"))I tried by replacing "ShaderName" with "tv1" for example.However it doesn't seem to do anything.  I saw others threads about this, but they don't seem to have come with a solution. Any ideas?delete the shader_effects[name] = { shader = Shaders.ShaderName.Compiled } line. & replace "ShaderName" in the local name = "ShaderName" line with the name of the shader effect. tv1, tv2, etc.Quick note: I think ripple1 & ripple2 are broken. I was trying to get them to work the other day & ripple1 was doing nothing - but returned an error when I tried including it as a custom shader script (something to do with uniforms) & ripple2 was masking out most of the image/animation it was applied to.

    by afrlme, 5 years ago

    8
    0
    afrlme 5 years ago
  • RE: [Solved] Shaders (again) in VS5

    And also how does it work now to use the premade shaders (tv1, tv2, etc)?I was just trying to use the new script provided by Simon:-- using as fullscreen effectlocal name = "ShaderName"shader_effects[name] = { shader = Shaders.ShaderName.Compiled }shaderAddEffect(name)shader_effects[ name].num.speed = 0.2 bind(name, "time", field("shader_iTime"))I tried by replacing "ShaderName" with "tv1" for example.However it doesn't seem to do anything.  I saw others threads about this, but they don't seem to have come with a solution. Any ideas?

    by Simon_ASA, 5 years ago

    8
    0
    Simon_ASA 5 years ago