Jump to content

How to use same texture in different scenes (multi scenes) ?


leht
 Share

Recommended Posts

Hello,

I'm migrating an medical application that viewing DICOM files from Three.js to Babylon.js.

In my application I have a canvas with different frames (viewports) that have different meshes in them. The different viewports can get from same textures from data (that created from DICOM files). They need supports rotating, zooming, panning independently from other viewports. You can see my screenshot in the attachment.

I'm considering to use multiple scenes, each scene for each viewport. But as I understand, the textures in Babylon need belong to a scene, although in my case it need to be used by multiple scenes. Could I create a texture without assign it to a scene? Is this possible if I just create a material (with a scene) and pass that texture as parameter in the function setTexture of that material?

Or could you suggest the best solution for my case? I've read about the multiple cameras & viewports but I think it's not suitable with my case.

 

 

Screenshot_2.jpg

Link to comment
Share on other sites

Hello, Babylon.js has an internal list of texture data, so if 2 scenes create a texture on the same url / data, the data will be shared and not loaded twice.

 

In your case you can also consider having a single scene with 4 cameras (with viewports)

Link to comment
Share on other sites

Thanks DeltaKosh, I will continue my implementation of multiple scenes and will let you know the result soon.

About the option of single scene & multiple cameras, it's harder to manage the meshes' position, because each frame has separate meshes & textures, and the frame count is not fixed to 4 (it depends on user's choices).

Another point is most of the time I don't want to re-render all the frames, just render the changing frame. So I think the multiple scenes option is fit to me.

Link to comment
Share on other sites

  • 3 weeks later...

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