Hi, I know one can get a material shader with python at the BGE, and from there sent uniforms and samplers to the shader that material uses; but what if I want to that for a filter 2D actuator shader? I ask this as I think the shader I got needs to receive the current camera clipstart and clipend values to act better.
@felipearts - Yes, it is. Just specify a variable as ‘uniform’ in the shader’s script, and create an object property (not a script variable) of the same name in the object that runs the 2D filter (i.e. if the Camera runs the 2D filter, make sure it has an object property (in the Game Logic’s Properties panel) that has the same name as the uniform variable that you’re using in the GLSL script).
@laser blaster - No, if I recall, there isn’t a built-in way to sample a texture in a 2D filter. You could fake it with a GLSL shader on an object that’s over the screen, sample the camera using the bge.texture module, and then write the 2D filter to do what you want with the camera output and the texture.
No, I meant that you could render the camera to a texture with the bge.texture module. I can’t give an example right now, but it wouldn’t be too hard to do.
Yes, it is. Just specify a variable as ‘uniform’ in the shader’s script, and create an object property (not a script variable) of the same name in the object that runs the 2D filter (i.e. if the Camera runs the 2D filter, make sure it has an object property (in the Game Logic’s Properties panel) that has the same name as the uniform variable that you’re using in the GLSL script).
Ah, it is very good to know it is possible! Thanks for your answer SolarLune