This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
local eff="ripple1"
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.target_object.ShaderSet = 1
local eff="ripple1" -- effect name
-- the following lines are to make sure the shader is compiled,
-- a shader is mini program, that needs to be compiled to use it
shaderAddEffect(eff)
shaderRemoveEffect(eff)
-- this is a standard setting, the shader has a variable that is called strength, we set that to 1
shader_effects[eff].num.strength=1
-- also for any animation inside the shader, it needs the time,
-- so we bind the variable time in the shader to our time
bind(eff, "time", field("shader_iTime"))
--[[ that is tricky, it contains the settings for something we could call "effect channel",
like in an audio mixer, send to channel 1 or such.
So we say use the shader "eff" and composition method 5 and 4, list of methods here:
0 GL_ZERO
1 GL_ONE
2 GL_SRC_COLOR
3 GL_ONE_MINUS_SRC_COLOR
4 GL_SRC_ALPHA
5 GL_ONE_MINUS_SRC_ALPHA
6 GL_DST_ALPHA
7 GL_ONE_MINUS_DST_ALPHA
8 GL_DST_COLOR
9 GL_ONE_MINUS_DST_COLOR
10 GL_SRC_ALPHA_SATURATE
the comp dst means what of the destination goes into the equation
and comp src the same for source.
So we use the alpha channel of the source image (GL_SRC_ALPHA)
and for the destination the inverse (GL_ONE_MINUS_SRC_ALPHA).
Destination means our surface, source is the image we are drawing.
If we use GL_ONE, GL_ONE you will see that image is like blended
onto the surface because the colors are added.
]]
shaderSetOptions({{shader = shader_effects[eff].num(), comp_dst=5, comp_src=4 }}, 1)
-- simplest thing of them, set the object "target_object" to the effect channel 1
Objects.target_object.ShaderSet = 1
This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Through December 1: all licenses 30% off, for example the Indie Bundle for €69.30 instead of €99. Applied automatically at checkout.