Page 1 of 1

How do you pass a scene; e.g, kitchen image & 3 char images, to a shader, as a texture?

Posted: Thu Oct 27, 2022 1:48 am
by henvu50
I have a shader. I need to pass it a base texture image and overlay texture image.

Can I pass the current Ren'py scene as a texture? Imagine you hide the UI, now all you see is a Kitchen and three characters on the screen.

Code: Select all

images/kitchen.png
images/char1.png
images/char2.png
images/char3.png
How do I pass that scene as a texture, or get a variable image that represents the current seen with the UI hidden?

Code: Select all

# pass this as a texture image to a shader
Renpy.ReturnCurrentSceneAsTextureWithoutUI()?
The goal is to be able to apply shaders to the whole scene, minus the UI.

UPDATE: I found a way to combine images into one composite image, then pass that to the shader, but is there a better way?

Code: Select all

image dynamic_scene_image = Composite(
    (1920, 1080),
    (dynamicImg01_x, dynamicImg01_y), dynamicImg01,
    (dynamicImg02_x, dynamicImg02_y), dynamicImg02)

label test():
    show screen_shader_combined_image_of_scene:
        shader("photoshop.softlight")
        Model().child("dynamic_scene_image").child("images/soft_light_overlay_effect05.png")
    
    "Screen Shader Applied"
    hide screen_shader_combined_image_of_scene
    "Black Screen"