MarcoC Posted December 25, 2017 Share Posted December 25, 2017 Hello guys, is there a way to have Lathe, Tubes, Ribbons or Custom Extruded Shapes (with low tasselation settings) with distinguishable faces (like Extruded Polygon or Polyhedra)? Thanks, Marco. http://playground.babylonjs.com/#4G18GY#17 Quote Link to comment Share on other sites More sharing options...
JohnK Posted December 25, 2017 Share Posted December 25, 2017 Try mesh.convertToFlatShadedMesh(); on your mesh. MarcoC 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 25, 2017 Share Posted December 25, 2017 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. MarcoC 1 Quote Link to comment Share on other sites More sharing options...
MarcoC Posted December 25, 2017 Author Share Posted December 25, 2017 mesh.convertToFlatShadedMesh() is exactly what I'm looking to catch. Please forgive me if I was not able to find it by myself. Thanks a lot guys and happy holidays! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 25, 2017 Share Posted December 25, 2017 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! GameMonetize and MarcoC 2 Quote Link to comment Share on other sites More sharing options...
MarcoC Posted December 27, 2017 Author Share Posted December 27, 2017 Very cool indeed! Playing with flat-shaded meshes and spotLights it's what I'm actually trying to do. Here's a tree (I used a tube to make the trunk and a dodecahedron to make the leaves). The more I know, the more I love you, BabylonJs GameMonetize and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.