Page 1 of 1

(Lets get screen shaders working!) If you pass Layer Master to a shader, what variable does it become in the shader?

Posted: Thu Oct 27, 2022 11:25 pm
by henvu50
I want to apply a shader to the master layer; background images and characters. Basically, a simple screen shader.

Here is my code so far, but I have no idea what variable RENPY.LAYER.MASTER becomes?

Code: Select all

Image IMAGE8398 = 'some_image.png'
label test()
   show layer master:
       shader("screen_shader_01")
       Model().child(IMAGE8398)
       
init python:
    renpy.register_shader("screen_shader_01", variables="""
        uniform sampler2D tex0; # IMAGE8398
        RENPY.LAYER.MASTER
        uniform float u_lod_bias;
        attribute vec2 a_tex_coord;
        varying vec2 v_tex_coord;
    """, vertex_300="""
        v_tex_coord = a_tex_coord;
    """, fragment_300=""" 
        vec4 some_texture = texture2D(tex0, v_tex_coord.st, u_lod_bias);
        RENPY.LAYER.MASTER
        gl_FragColor = RENPY.LAYER.MASTER * some_texture 
    """)
Which of these variables represents the RENPY.LAYER.MASTER, so I can perform calculations on it, as if it's a texture or something?

Code: Select all

vec2 u_model_size
float u_lod_bias
mat4 u_transform
float u_time
vec4 u_random
vec4 u_viewport
sampler2D tex0, sampler2D tex1, sampler2D tex2
vec2 res0, vec2 res1, vec2 res2
vec4 a_position 
vec2 a_tex_coord