Maybe you should consider using a 2D Filter instead, with the filter manager you can easily set textures, and filters work by literally drawing a quad with the texture filtered.
Thank you, this sounds like an idea. But I’m too dumb.
I suppose one would render to texture and then use this as input into the Filter.
A bit like here (which doesn’t work anymore in UPBGE 0.3):
But I have no clue how to set the texture even with the provided info. E.g. here the tex in my pseudo code:
You need to use the bind code from the dynamic texture with setTexture, along with the name of the sampler. This code is for setting the filter, you could put it after creating the dynamic texture.
You can modify the texture coordinate and use to sample the texture and create a mask, it’s possible to pass the position and size of the square/rectangle (in pixels) as a vec4 uniform.
When testing, I kept getting a black texture, turns out it when scaling down the texture, it was trying to access the mipmaps, which appear to be enabled but not set. To avoid this, I used .capsize on the source to limit the size to that of the rectangle.
Thank you sooo much!!!
I tried to get my hands on something like this but this is way over my top!
I would have never been able to create such a solution!
Thank you !
(PS: I would mark it as solution but it’s another solution to the asked question.)
This way has 2 benefits:
Much better image qality than using a plane in front of the camera.
The possibility to adjust the impact on the FPS by skipping frames on the Texture.refresh.
I also tried using setViewports on the rendercam which works nicely but I didn’t find a way to skip frames.
Here you can see the much better quality of the upper (filter)-rectangle opposed to the ugly rendering on the plane beneath it (which also washes out depending on the background)
The only advantage of the plane is that it can be cropped to a square easily
Sadly though, Apple Silicon computers cannot use GLSL-based shaders that are rendered onto an object. Due to a bug or lack of a proper shading pipeline for GLSL object-based rendering, it will just output an unsupported message, and show nothing but a blank texture. I do know that the upcoming Metal support will likely solve this problem. Postprocessing shaders (2D Filters) do not have this problem as they are drawn using the GPU and also through something else, and are able to bypass this through a different way, possibly through the screen.