Shader Toolkit Effects not Working properly in 5.0RC2

  • #1, by atrusSunday, 10. September 2017, 18:21 3 years ago
    Hi all,

    Been struggling the last days with getting the Shader Toolkit Effects like warp1,ripple1, etc... to work on 5.0RC2 with no success.

    As a base start, i am using a nice test .ved by user 'unreal', see relevant post. The ved is NOT working in 5.0RC2 even when i replace the shader toolkit with latest version 0.95.

    See attached the updated ved with the 0.95 shader toolkit version, feel free to test it; if you manage to get it working on 5.0RC2 will buy u some beers razz

    Need your assistance to figure this out, thanks!




    Forum Fan

    237 Posts


  • #2, by caligarimarteSunday, 10. September 2017, 21:10 3 years ago
    Well, I cannot give you an easy Solution, but I can tell from looking at the new Shadertoolkit that it does not actually include the several Shaders inside the Script -- which makes Sense, because in Vis5 that does not work anymore. Strangely, I know that shaderBlur() still works fine, so I have no Idea how that works exactly (is it not Part of the Shader-Toolkit??). But if these Shaders you want do not work anymore, then go to the old Shadertoolkit-Script, look for the Areas which are huge Piles of different-looking Code inside of Strings, and copy those Parts into separate Shaders (in the Editor's new "Shader"-Category), and change the Codes until you get no Error-Messages at the Bottom anymore (I guess that is easier said than done, seems like most People on the Forum haven't looked much into GLSL-Coding, and I am also but a mere Amateur). Once you have done that, you can call the Shader with a Script very similar to how it worked in Vis4:
    local eff = "NAME_OF_THE_SHADER"
    shader_effects[eff] = { shader = Shaders[eff].Compiled }
    shaderAddEffect(eff)
    1
    2
    3

    All of that might seem as of little Use if you do not know GLSL, but I personally tend to say that People should use their own Shaders if they can, it's actually kind of fun -- connects Coding, which I do not like so much, with creating visual Art, which I enjoy.

    Forum Fan

    145 Posts

  • #3, by atrusSunday, 10. September 2017, 21:30 3 years ago
    Thanks for the reply; well have managed to get all these effects working, but not on a specific object yet. The calling code suggested before in the forum doesn't seem to work any more:

    for example:
    local eff="ripple2"
    shaderAddEffect(eff) 
    shaderRemoveEffect(eff)
    shader_effects[eff].num.strength=1 
    bind(eff, "time", field("shader_iTime")) 
    shaderSetOptions({{shader = shader_effects[eff].num(), comp_dst=50, comp_src=4 }}, 1) 
    Objects.'object name'.ShaderSet = 1
    1
    2
    3
    4
    5
    6
    7

    shaderRemoveEffect(eff) is VERY weird here and causes black screen. If it is commented out the effect is shown. (why we remove the effect here???)

    shader_effects[eff].num.strength=1
    bind(eff, "time", field("shader_iTime"))

    Above maybe not needed?? Because they are already included in shaderAddEffect(eff) function!

    local eff = "NAME_OF_THE_SHADER"

    shader_effects[eff] = { shader = Shaders[eff].Compiled }

    shaderAddEffect(eff)
    Above sounds interesting, but how you can apply the effect to an object only?

    Forum Fan

    237 Posts

  • #4, by SimonSSunday, 10. September 2017, 21:39 3 years ago
    The syntax for binding to object has changed because the shaderset numbers were clunky.


    Instead of 
    shaderSetOptions({{shader = shader_effects[eff].num(), comp_dst=5, comp_src=4 }}, 2)
    Objects.Water.ShaderSet = 2
    1
    2
    3

    it's now:
    Objects.Water.ShaderSet = shader_effects[eff].num()
    1

    Thread Captain

    1367 Posts

  • #5, by atrusMonday, 11. September 2017, 09:21 3 years ago
    That was it , thanks so much! Had missed this part of the docs.

    Have checked all effects and they are working ok, except:

    ripple1
    ripple2
    highlight

    I have also noticed a 'light1' effect in the shader but doesn't seem to do anything.

    How can i remove an effect from an object? I guess it is not wise for performance purposes to leave an effect on an object forever, so i need to be able to detach an effect when leaving the scene.

    Forum Fan

    237 Posts

  • #6, by caligarimarteMonday, 11. September 2017, 10:31 3 years ago
    Simple. smile
    shaderRemoveEffect(eff)
    1

    Forum Fan

    145 Posts

  • #7, by atrusMonday, 11. September 2017, 10:40 3 years ago
    Yes i guess so,

    But!

    Let's say we have an effect assign to two objects, and i want to remove the effect from one object only?

    Forum Fan

    237 Posts

  • #8, by caligarimarteMonday, 11. September 2017, 10:54 3 years ago
    I don't know of a specific Command for that, but you could, when removing the Effect, reiterate its Addition to the Opject you want it to keep. But I can see how that might be a little janky, and a Chore (depending on the Amount of Objects).

    Maybe Simon can anwer whether or not a Shader applied to an Object in a different Scene will still influence Performance in any Way at all (because if not, then why bother?), because you and I can only guess.
    (Well actually, I could apply some reeeally heavy Shader to something and check that Way... maybe I should try that out...)

    Forum Fan

    145 Posts

  • #9, by atrusMonday, 11. September 2017, 10:57 3 years ago
    (Well actually, I could apply some reeeally heavy Shader to something and check that Way... maybe I should try that out...)
    1

    That would be nice (and easy i guess using the in-game dev console to check the system recources)

    Forum Fan

    237 Posts

  • #10, by SimonSMonday, 11. September 2017, 10:58 3 years ago
    If the object is not shown, it wastes no performance. If you want to remove the effect do:

    Objects.Water.ShaderSet = -1
    1

    Thread Captain

    1367 Posts

  • #11, by caligarimarteMonday, 11. September 2017, 11:10 3 years ago
    Thanks Simon, that is very useful to know. smile

    And yes, I just checked, as I said, and it is just like Simon says.

    Forum Fan

    145 Posts

Write post