Render To Texture UPBGE 3.0

I’ve been playing around with UPBGE recently and have been trying to get a render to texture setup going in the most recent version. I’ve read through the bge.texture documentation but I’m not sure how to make it work since this version doesn’t really use the texture slot system anymore. Otherwise, I’m trying to use bge.texture.ImageRender (scene, camera, width, height, samples, hdr)

ok got it working! this is definitely not the best way to do it but it does the job for me so far so I’ll leave it here.

import bge

scene = bge.logic.getCurrentScene()
camera_obj = scene.objects["scalecam"]
renderplane = scene.objects["downscaled"]
texChannel = 0
texture_object = bge.texture.Texture(renderplane, 0, texChannel)
texture_object.source = bge.texture.ImageRender(scene, camera_obj, 128, 128)

def update(self):
    texture_object.refresh(True)

what are you going to use this for?

something really silly haha

I couldn’t figure my way around writing glsl filters for blender, and all I wanted to do was create my own pixelate filter since the old one that someone else wrote didn’t do it for me. my horrific solution is to create a render texture at a really low resolution and point the main game camera at it. It actually works a lot better than I thought it would and now I want to see if I can try and do some dynamic resolution stuff since this now comes with the benefit of rendering the game itself at a lower resolution.

i can see you render at resolution 128 x 128 in you script, is that not a little low considered that most old games back in the day ran at resolution 320 x 200.

that was just for testing! I’ve increased it since.

I think there is a example in python component templates - video utils