Jump to content

Extruded Shapes with distinguishable faces


MarcoC
 Share

Recommended Posts

Hi MC!

"distinguishable faces"?  Not real sure what you mean.

Like... mesh.convertToFlatShadedMesh()?

https://www.babylonjs-playground.com/#165IV6#164

That adds extra vertices and has some other problems.

Some folks use a clone, and then set a wireframe material on the clone.

https://www.babylonjs-playground.com/#165IV6#165

And BOTH can be done, as wanted.  Hope this helps.

Oh, JohnK beat me to the answer.  :)  Hi John, happy holidays.

 

Link to comment
Share on other sites

Cool!  Lighting is interesting, when using flat-shading.  Flat-shade a medium-subdivided sphere, and perhaps color it.  With the right combination of directional lights (perhaps 2-4), each slightly different .intensity, you can make each 2-face "facet" on the sphere... be a different color from any other facet. 

I'd start with 2 directional lights.  Although positioning a directionalLight is often not necessary, let's do it anyway.

When not using a ground-plane, set first directional light at position oh... -20, -20, -20.  Then call its handy light.setDirectionToTarget(sphere.position).  Light.intensity = 0.8, perhaps.

Set second directional light at position 20, 20, 20, and call light.setDirectionToTarget(sphere.position).  Light.intensity = 1.2;

How's the many-faceted sphere, look?  Is every square... a different color from any other?  Stupid stuff like this... fascinates simple minds like mine.  :)

Perhaps try it with spotLights.  A command like... spotlight.setDirectionToTarget(orbitingAroundMySceneMesh.position) is pretty fun... when put inside the render loop (using registerBeforeRender).  It reminds me of old wartime ground-based search lights... following warplanes... tracking them across the sky.  See our playground lighting demo... for sin/cos orbit-a-mesh techniques.

Sorry, Wingnut rattling-on, aimlessly.  :)  Hey, I got the snowblowing done... here at my slummy 4-plex!  Hurray.  It's only 0 degrees out there, and breezy.  brrrr.  I dressed in "full spacesuit".  Not much snow, though, so street-plow snowbanks were small and fast.  My snowblower was a bit bitchy... but performed well (I had to coax it into forward gear, after a reversing, sometimes.  Stuff was stiff). 

DONE!  Coffee and doughnuts time!  Party!

Link to comment
Share on other sites

  • RaananW changed the title to Extruded Shapes with distinguishable faces

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