upbge icon indicating copy to clipboard operation
upbge copied to clipboard

Add support of render to texture in UI.

Open panzergame opened this issue 6 years ago • 7 comments

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_TextureRenderershould 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.

panzergame avatar Jun 04 '18 20:06 panzergame

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 avatar Jun 05 '18 13:06 justinbarrett

@justinbarrett : here the viewport size is at the end the texture size too.

panzergame avatar Jun 05 '18 14:06 panzergame

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.

adriansnetlis avatar Jul 02 '18 21:07 adriansnetlis

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.

panzergame avatar Jul 03 '18 19:07 panzergame

Wait. Is there currently a way to get a rendered texture into 2D filters?

adriansnetlis avatar Jul 03 '18 21:07 adriansnetlis

You can pass a texture to the filter thanks to KX_2DFilter.setTexture : https://pythonapi.upbge.org/bge.types.KX_2DFilter.html

panzergame avatar Jul 04 '18 06:07 panzergame

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

sergio5528 avatar Jul 07 '18 03:07 sergio5528