Jump to content

Transparency with planes of a 3D Rectangle Mesh possible?


bws
 Share

Recommended Posts

Hi,

 

Just wanting some guidance here...  :huh: I'm new to 3D Web development and Babylon  :)

 

I'm wanting to create a 'room' with objects in it with the arc camera. The room is shaped as a simple 3D rectangle (as you would expect a room to be).

 

When the user looks at the room from a short distance, I'm wanting the walls to be transparent (so the user can see inside the room), however the walls at the very back to be visible.

When the camera spins around the room (180 degrees for example), the same thing is to apply. Similarly with the floor and the roof by moving up and down.

 

How can I achieve this?

 

I was thinking of creating the 6 'planes' manually, and then using some maths to set the transparency of each plane individually depending on where the camera is positioned (is this even possible?).

Or, is there a type of Mesh best suited to do this? Do i need to turn back culling off?

 

I wasn't able to find anything on this hence my question. Any help would be greatly appreciated....

 

Thanks,

bws.

 

Link to comment
Share on other sites

Oh thanks! I only just solved this myself by simply setting the sideOrientation parameter to BABYLON.Mesh.BACKSIDE.

 

In other words, instead of

var box = BABYLON.Mesh.CreateBox("box", 10.0, scene);

you put

var box = BABYLON.Mesh.CreateBox("box", 10.0, scene, false, BABYLON.Mesh.BACKSIDE );

It was exactly what I was after.

 

Thank-you for your response Convergence.

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