[Solved] Shaders (again) in VS5

  • #1, by Simon_ASASaturday, 02. February 2019, 20:00 6 years ago
    Hello,
    Congrats for all the great updates in VS5!

    I had lost track of the changes during the last years and when I open my older projects it would seem that the shaders are not working anymore.

    I have updated the script with what is (I think) the latest shader toolkit
    (script version 0.96 update 28/9/18 lua 5.3)

    And I use some very simple shaders such as
    shaderNoise(0.05, 1, 0)

    However it doesn't work, nothing changes in the game.

    Also I see a new Shaders menu but I don't understand anything lol

    Could anyone help me?
    Thanks in advance

    Great Poster

    321 Posts


  • #2, by afrlmeSaturday, 02. February 2019, 21:23 6 years ago
    A'llo mate,

    This is the latest version of the shader toolkit: here.

    The new shaders section is for people to write their own custom shaders, if they want/know how to.

    Imperator

    7285 Posts

  • #3, by Simon_ASASaturday, 02. February 2019, 21:54 6 years ago
    Thanks for the quick reply!
    But that is the version I already tried. As written above:

    I have updated the script with what is (I think) the latest shader toolkit

    (script version 0.96 update 28/9/18 lua 5.3)
    So I was up to date.

    Mmh strange, I wonder what's wrong in my project.
    Any other idea why an old project would have the shaders to stop working?
    (when I say "old" it is Visionaire 5, but one of the very first versions)

    Great Poster

    321 Posts

  • #4, by afrlmeSaturday, 02. February 2019, 23:36 6 years ago
    it's possible that Simon changed how it worked somehow? check the examples in the commented section near the top of the shader toolkit script.

    also, any errors mentioned in the log?

    Imperator

    7285 Posts

  • #5, by Simon_ASASunday, 03. February 2019, 11:34 6 years ago
    Mmmh the log is empty, strange.

    I've checked the examples of Simon and either I don't understand, either it's as usual like I did before.

    Here 2 screenshots of my shaders settings:

    The main script (latest version)

    And the shaders that I try to activate

    And in the game nothing changes, there are no shader effects whatever the values I try in the shaders.
    Usually it used to work fine, I have been using the shaders for a while (since Catyph) and experimented many different things.

    I must be missing something....
    I'll probably need to read furthermore the new examples and changes explained by Simon, but even though if the old version doesn't work anymore it should be said in the log, no?

    Great Poster

    321 Posts

  • #6, by Simon_ASASunday, 03. February 2019, 11:52 6 years ago
    Ok I've found out, it was vicious lol

    In the previous scripts the parameters were like
    strength, on, delay

    Now it's more like
    on, strength, delay

    Solved! Thanks mates!

    Great Poster

    321 Posts

  • #7, by Simon_ASASunday, 03. February 2019, 12:11 6 years ago
    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 effect
    local 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?

    Great Poster

    321 Posts

  • #8, by afrlmeSunday, 03. February 2019, 12:26 6 years ago
    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 effect
    local 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.

    Imperator

    7285 Posts

  • #9, by Simon_ASASunday, 03. February 2019, 19:17 6 years ago
    Oh great, yes it works, thanks so much!!!

    So to summarize for future people who would be interested:

    1 - Use the latest script available
    (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.2

    bind(name, "time", field("shader_iTime"))
    (where you have to replace ShaderName by one of these:
    warp1
    tv1
    ripple1*
    ripple2*
    ascii
    edgeglow
    chroma
    ripple3
    warp2
    ripple4
    pearls
    highlight
    fourbit
    tv2
    tv3
    tv4)

    * Might be broken

    And enjoy the result!

    Great Poster

    321 Posts