Sign in to follow this  
aFalcon

DOUBLESIDE plane, dynamically after create?

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, 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

! @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. : )

 

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.