shader effects help!

  • #1, by yoyanMonday, 22. June 2015, 14:45 9 years ago
    Hi again guys, I want use shader effect in a scene object. If only use one effect to objects works.

    ok I do this:

    Actions
    At the beggining of the scene:

    Execute a script:
    local eff2="tv2"
    shaderAddEffect(eff2)
    shaderRemoveEffect(eff2)
    shader_effects[eff2].num.strength=1
    bind(eff2, "time", field("shader_iTime"))
    shaderSetOptions({{shader = shader_effects[eff2].num(), comp_dst=5, comp_src=4 }}, 1)
    Objects.object1.ShaderSet = 1
    Objects.object2.ShaderSet = 1
    Objects.object3.ShaderSet = 1
    Objects.object4.ShaderSet = 1

    Execute a script:

    local eff="ripple3"
    shaderAddEffect(eff)
    shaderRemoveEffect(eff)
    shader_effects[eff].num.strength=1
    bind(eff, "time", field("shader_iTime"))
    shaderSetOptions({{shader = shader_effects[eff].num(), comp_dst=5, comp_src=4 }}, 1)
    Objects.object5.ShaderSet = 1

    Ok, If only put one of the script.work perfect.

    But if I want two diferent shadereffects in a two diferents objects in the same scene, I cant. Always works only the last shader efecct applied. can you help me? I read wiki but dont get it. Thanks in advance smile.

    Newbie

    32 Posts


  • #2, by SimonSMonday, 22. June 2015, 17:52 9 years ago
    Hi, if you use multiple shaders on objects you need to use multiple ShaderSets:

    The second call would be:
    local eff="ripple3"
    shaderAddEffect(eff)
    shaderRemoveEffect(eff)
    shader_effects[eff].num.strength=1
    bind(eff, "time", field("shader_iTime"))
    shaderSetOptions({{shader = shader_effects[eff].num(), comp_dst=5, comp_src=4 }}, 2)
    Objects.object5.ShaderSet = 2
    

    Just change the id.

    Thread Captain

    1581 Posts

  • #3, by yoyanMonday, 22. June 2015, 19:46 9 years ago
    ok, thanks. now work. I had just changed objects.object5 = 2. thanks simon wink.

    Newbie

    32 Posts