Jump to content

Clone CubeTexture from ReflectionProbe


SvenFrankson
 Share

Recommended Posts

Hi everyone,

I'd like to do the following :

- Using a ReflectionProbe

- Assign renderList and position

- Render the cubeTexture

- Assign cubeTexture to a given mesh

- Dispose reflectionProbe / Use it for something else.

To do so, I'd like to clone the renderered cubeTexture, like here : https://www.babylonjs-playground.com/#NPSPXA#1 (see lines 37 - 38)

But cloning a cubeTexture gives odd results. Is there already a method to clone cubeTexture ?

(actually, here it's a cubic RenderTargetTexture, maybe that's where my problem is ?)

Thanks a lot for your inputs ! Have a nice day.

Link to comment
Share on other sites

Hello you are cloning a RenderTargetTexture, which will create a rendertargettexture ;) you are not cloning the content. The new RTT will then get its content from the scene.

 

You can still think about creating an empty CubeTexture: cubeTexture = new BABYLON.CubeTexture(null,scene) and then connect it to the internal webgl texture used by the rendertargettexture but this will not work as the next time the RTT will be updated your cube texture will be as well

So my question is: why do you need this? why not creating multiple RTT? As long as you set the refreshRate to 0 it will only be updated once. Memory wise, you can call RTT.disposeFramebufferObjects() and thus the memory footprint will be the same as a regular cubetexture

 

Link to comment
Share on other sites

The use case is an room visualisation app. There is many static meshes, and I want to assign them a cubic environmentTexture.

As it's nearly all static, the rendering has to be done only once, so I'd like to manage it to split it accross frames (generate the 30 environmentTexture accross 30 different frames). Using one probe moving from mesh to mesh seemed like easy to implement on my side, but it's obviously not the way to go with renderTargetTexture.

I'll create multiple probes and sync them from a Manager object, it should be easier.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...