Jump to content

DOUBLESIDE plane, dynamically after create?


JackFalcon
 Share

Recommended Posts

I see a plane can be created as {sideOrientation: BABYLON.Mesh.DOUBLESIDE}, 

But is it possible to make a plane which is FRONTSIDE by default... and then DOUBLESIDE dynamically at runtime?

CONTEXT: a plane is imported by blender (as a complex shape), it is DEFAULT FRONTSIDE.

After many user interactions the plane then can become DOUBLESIDE .

How to do this?

Without it being DOUBLESIDE on the blender import.

Feeble attempts in this playground: https://www.babylonjs-playground.com/#LXZPJK#53

There is a delay, and then tries to:

1) convert directly  plane.sideOrientation = BABYLON.Mesh.DOUBLESIDE (no change)

2) and it seems possible to clone the mesh and re-create it with DOUBLESIDE (but complications with height,width, rotation, performance overhead, etc)

So, curious: Is there a way to dynamically apply DOUBLESIDE to a plane?

3) if not, will probably blenderfix...etc.  : )

Thanks, 

Link to comment
Share on other sites

This function gets called in the end of the creation function when you create a BJS mesh like a plane:

https://github.com/BabylonJS/Babylon.js/blob/67e5c07c225f02fc3a880ea7ccb1fa8332687595/src/Mesh/babylon.mesh.vertexData.ts#L2729

So that's how meshes get their sides changed from the initial front side; their vertex data get changed. That's my 2 cents.

Link to comment
Share on other sites

  • 2 weeks later...

! @Gijs and @jerome, didn't see you respond.

Tips are excellent! Thank you for confirming variation on geometry, had no clue. : )

Makes sense.

SOLUTION:

Because the context involved blender-import, as usual, solution involves a BLENDERFIX.

Tried 3 things:

1) checkbox for BackFaceCulling (unchecked) === seemed to have no effect.

2) Add Modifier -> SOLIDIFY -> Apply (for each plane) in edit mode === it works, but changed rendering, because geometries changed....

3) Found Vertex Data Object -> checkbox -> DOUBLESIDED trying that... === seemed to have no effect.

SOLUTION: going with solidify. : )

 

 

Link to comment
Share on other sites

Nice option, tried it, and failed. But reading your steps carefully... I didn't clone the indices, and then update vertex data. Makes sense. Will try someday. Thx. Out of likes for the day....

The variation I tried was to create a new plane DOUBLESIDED, maybe that would work to do that then update vertex data? Worth a try. 

Not sure if it needed reverse or not.

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