[x3d-public] RenderedTexture support

Andreas Plesch andreasplesch at gmail.com
Tue Jan 16 04:21:01 PST 2018


Hi Michalis,

oh, apologies, I had somehow overlooked the cubemap component
documentation:
https://castle-engine.sourceforge.io/x3d_implementation_cubemaptexturing.php

It looks like ComposedCubeMapTextureNode does not take RenderedTexture
as field values since RenderedTexture is not  derived from Class
TAbstractTexture2DNode ?

This is understandable since GeneratedCubeMapTexture is available.

So I probably should try to implemenent GeneratedCubeMapTexture. All
the pieces should be already there.

An advantage of using ComposedCubeMap with rendered textures is that
it is possible to only make a subset of the faces dynamic for
increased efficiency. After all, each face needs a render of the
scene.

x3dom has a pingpong shader pass which may be helpful for recursive
mirror effects.

x3dom also generates a fbo for each rendered texture and I learned how
to use it for the composed cubemap via gl.copyTexImage2D() which seems
to work well. Does castle use another opengl function ?

I may look a little bit at the implementations, and potentially test scenes.

best,
-Andreas


On Tue, Jan 16, 2018 at 5:51 AM, Michalis Kamburelis
<michalis.kambi at gmail.com> fwrote:
> Hi,
>
> Castle Game Engine and view3dscene support both RenderedTexture and all
> cubemap nodes, including GeneratedCubeMapTexture .
>
> See
>
> https://castle-engine.sourceforge.io/x3d_implementation_texturing_extensions.php#section_ext_rendered_texture
>
> https://castle-engine.sourceforge.io/x3d_implementation_cubemaptexturing.php
>
> They work on all platforms (desktop and mobile - Android, iOS). We use
> OpenGL(ES) FBO (Framebuffer Object) in both cases to efficiently capture the
> rendered result to the texture. In case of GeneratedCubeMapTexture, we can
> specify which face of the cubemap is currently written, so it's quite
> efficient - the rendered contents are put by GPU straight into the proper
> texture side.
>
> See
> https://github.com/castle-engine/castle-engine/blob/master/src/images/opengl/castleglimages_rendertotexture.inc
> for our TGLRenderToTexture class that wraps FBO to expose all the necessary
> features.
>
> P.S. We also use this class for GeneratedShadowMap,
> https://castle-engine.sourceforge.io/x3d_extensions_shadow_maps.php :)
>
> Regards,
> Michalis
>
>
> 16.01.2018 2:28 AM "Andreas Plesch" <andreasplesch at gmail.com> napisał(a):
>>
>> Hi Don,
>>
>> thanks for your response. Here is a first round of support links.
>>
>> http://www.xj3d.org/extensions/render_texture.html
>>
>>
>> https://castle-engine.sourceforge.io/x3d_implementation_texturing_extensions.php#section_ext_rendered_texture
>>
>> Castle does not seem to have ComposedCubeMap or GeneratedCubeMap
>>
>> http://doc.instantreality.org/documentation/nodetype/RenderedTexture/
>> was the template for the x3dom node.
>>
>> I suspect freeWrl supports imagecubemaps, probably composedcubemaps,
>> only perhaps generatedcubemaps and renderedtexture.
>>
>> There are good screen capturing web browser extensions which can
>> produce small and large animations, example gif attached.
>>
>> All the best,
>> -Andreas
>>
>>
>> On Mon, Jan 15, 2018 at 7:20 PM, Don Brutzman <brutzman at nps.edu> wrote:
>> > Thanks for the analysis and suggestion.  No this node has never been
>> > proposed for use in X3D.
>> >
>> > I searched and found documentation at
>> >
>> >         X3DOM documentation: Node: RenderedTexture
>> >         https://doc.x3dom.org/author/Texturing/RenderedTexture.html
>> >
>> > "This extension provides the ability to dynamically render a partial
>> > scenegraph to an offscreen texture that can then be used on the geometry
>> > of
>> > a node. This can be used in many different ways such as creating mirror
>> > effects, inputs to shaders etc. The purpose of this component is to
>> > provide
>> > for extended visual effects, but not the complete form of offscreen
>> > rendering and buffers that would be available to lower-level rendering
>> > APIs."
>> >
>> > The fields are quite diverse and utilize multiple parts of a scene.
>> > Some
>> > further composition might be needed, worth closer scrutiny.
>> >
>> > It is certainly interesting to expose this kind of functionality to
>> > scene
>> > authors.  If rendered results might be saved to a file, then it could
>> > also
>> > increase options for interactions within HTML pages.
>> >
>> > The interpupillary distance field looks like something we would defer to
>> > X3D
>> > v4.1 for Mixed Augmented Reality (MAR) VR/AR applications.
>> >
>> > It would be great if someone wanted to lead the effort to add this node,
>> > and
>> > perhaps closely related nodes.
>> >
>> > On 1/16/2018 7:39 AM, Andreas Plesch wrote:
>> >>
>> >> Dear group,
>> >>
>> >> x3dom has a RenderedTexture node which very useful. Prompted by a
>> >> x3dom-user list question, I started to think about using
>> >> RenderedTextures as faces for a ComposedCubeMapNode which is also
>> >> available in x3dom albeit only for ImageTexture sources.
>> >>
>> >> Although I first thought it is technically difficult due to webgl
>> >> limitations, after deep diving it turned out that there is a way to
>> >> efficiently use gl textures (generated for RenderedTexture) as faces
>> >> for gl cube map textures (using gl.copyTexImage2D()).
>> >>
>> >> So I am developing in my cubemap branch of x3dom the ability for
>> >> ComposedCubeMapNode to use RenderedTexture which can be updated per
>> >> frame, for dynamic mirror effects and probably other uses. Here is an
>> >> example:
>> >>
>> >>
>> >>
>> >> https://rawgit.com/andreasplesch/x3dom/cubemap/test/regression-suite/test/cases/cubemap/colorcube.html
>> >>
>> >> It more or less works but before I go further I would like to know how
>> >> other browser approach dynamic cube maps from a high level. There is
>> >> also the x3d GeneratedCubeMapNode which is intended for this effect.
>> >> So one question would be which players actually implement a
>> >> GeneratedCubeMapNode.
>> >>
>> >> There are quite a few x3d browsers which have a RenderedTexture node.
>> >> Do they allow using it with ComposedCubeMap ?
>> >>
>> >> A big question is how recursive mirror in mirror are handled.
>> >>
>> >> Is a RenderedTexture node a target for v.4 ?
>> >>
>> >> Any feedback much welcome,
>> >>
>> >> Andreas
>> >>
>> >
>> >
>> > all the best, Don
>> > --
>> > Don Brutzman  Naval Postgraduate School, Code USW/Br
>> > brutzman at nps.edu
>> > Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
>> > +1.831.656.2149
>> > X3D graphics, virtual worlds, navy robotics
>> > http://faculty.nps.edu/brutzman
>>
>>
>>
>> --
>> Andreas Plesch
>> Waltham, MA 02453
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list