upbge
upbge copied to clipboard
Add support of render to texture in UI.
The idea is to reuse the base of planar and cube map definition from UI to just copy the render of a camera into a texture without using long python scripts.
The modification in UI should be done inside environment texture. The options should be :
- viewport size
- filtering
- camera
- ignore layers
- auto update
From python BL_Texture.renderer
could be KX_CameraMap
(similar to name for KX_PlanarMap
, KX_CubeMap
).
In the same time KX_TextureRenderer
should be simplified to move clip data and viewpoint object to a higher inheritance level shared for KX_PlanarMap
and KX_CubeMap
.
Name suggestion or useful options are welcome.
just curious...
- viewport size is reffering to the output xy of the texture? or the actual rendered frame? this is something I would like to see btw.
@justinbarrett : here the viewport size is at the end the texture size too.
This looks great. Would it be possible to make an option to render one of those textures before the render pass of the rest of scene? Another nice thing would be ability to save those rendered textures as offscreen buffers for 2D filters to access.
This looks great. Would it be possible to make an option to render one of those textures before the render pass of the rest of scene?
This is already the case.
Another nice thing would be ability to save those rendered textures as offscreen buffers for 2D filters to access.
I don't see the interest of exposing the off screen, the user is not rendering to and have already a way to get the texture bind code through BL_Texture.bindCode
. Also this could be dangerous for planar map as they will use unique texture per viewports later as they renders are unique per view.
Wait. Is there currently a way to get a rendered texture into 2D filters?
You can pass a texture to the filter thanks to KX_2DFilter.setTexture
: https://pythonapi.upbge.org/bge.types.KX_2DFilter.html
can we get depth texture in render to texture?it will be great if we can do that,like when we render water,we need to smooth the edges of water ,which depth texture will help ...and if we need custom shadow mappin,we can use depth texture