rockwell15 Posted December 13, 2017 Share Posted December 13, 2017 Hi, I'm trying to create a handrail, by using extrude with an array of points for the path of the handrail. However, at any turn it appears the shape gets stretched out. For example I just want an even 1x1 block that runs along the path, but when I use extrude it appears the block thins out to be less than 1x1 at the corners. I took a look at the docs and didn't notice anything on how I can prevent this. If there's a better way of accomplishing this, please enlighten me. http://www.babylonjs-playground.com/#165IV6#18 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 14, 2017 Share Posted December 14, 2017 Hi RW! I have no solutions yet, but I wanted to offer a playground demo that shows the "thinner at the corners" issue, perhaps. https://www.babylonjs-playground.com/#Z1SIC I need to get a new pipe-bender. Anyway, after further screwing-round... I tried a 2-part extrude thing. https://www.babylonjs-playground.com/#13AEVX#10 That looks... well... sort-of ok. I'm not sure why it looks so "hollow" from the back-side view. Fix that, and then you can use a clone instead of a 2nd extruded board. I tried clone(), but I needed to rotate the clone, which caused its hollow-looking back-side... to face forward. (anyone understand that? let's hope not) And don't ask me who arranged the uvs for the texture mapping. It might not even HAVE uvs. They can be added, and would provide some woodgrain-mapping power, I suspect. For close-up "joint inspection", remember control-dragging to "slew" the arcRotateCam target, and adjust camera.wheelPrecision = <number> for setting mouseWheel zoom sensitivity. Also camera.minZ = .0001 for SUPER close-up inspecting. It is a playground demo for everyone to experiment-with, and test some methods. Perhaps someone will install/tweak some uvs. Stay tuned. More versions likely. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 14, 2017 Share Posted December 14, 2017 Hi again. I did a little UV work on the boards. https://www.babylonjs-playground.com/#13AEVX#12 The right-side board (e1) now has some accurate/decent UVs. I tried to use the Babylon.Texture invertY parameter to vertically "flip" e2's (top board) texture, but that didn't seem to work. Next, I put an identical texture on e2, and used texture.vOffset (line 185) to Y-offset e2's texture until the light-colored band of grain... aligned with e1's light-colored band of grain. It looks pretty good, but a meticulous eye can tell... that e2's grain-sequence... is reversed from e1's grain sequence. E2's texture is vertically backwards, or... upside-down. There might be an easy way to do a vertical flip of e2's texture, but I couldn't think of it, and I'm getting kind of fried/tired. I hope e2 doesn't need its own set of UVs... but perhaps it does. Sorry for all the mess in the playground. I have some helper tools that assist in my UV adjustments, such as boxify() and wireframe. Boxify stacks boxes... when a vert position is repeated and a box is already positioned at that location. The 15,16,17,18,19 box stack... means there are 5 vertices at that same location... and each one has a UV value. The boards are 20 vertices each, and therefore they have 20 UVs each. The UV mapping system places X/Y (U/V) of 0,0 in the lower-left corner of the texture/image, and 1,1 in the upper-right. We all knew that already, didn't we? Current texture in use: [ click here ] Ok, things are getting nicely out-of-control now, huh? Just what we needed... UV school, eh? heh. Quote Link to comment Share on other sites More sharing options...
rockwell15 Posted December 15, 2017 Author Share Posted December 15, 2017 Hi Wingnut, thanks for taking a look! Sorry, looks like I added the wrong link for the playground. I'll add one here. http://www.babylonjs-playground.com/#165IV6#138 The handrail's shape will be changeable (sometimes just a rounded block, sometimes circular with a flat bottom, etc. ) So I don't think top down extrusion is a viable option :/ Is there any way to do an uneven extrusion? (Where the left extends further than the right resulting in the mesh ending in a face with a *for example* 45degree angle) Ribbons I think ribbons could work for the shape, but since I can't add texture to ribbons with paths of different length (which I can't avoid at corners), that counts ribbons out.Creating separate meshes & clipping the extra I found this document on morphing meshes, but it only shows that I can morph extruded shapes with scale & rotation functions, which aren't helpful in my casehttps://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh My idea here is that if I can just have the meshes overlap, and cut out the extra it should look good, I'll attach a pic of an example where I'd like to cut out the extra Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 15, 2017 Share Posted December 15, 2017 http://www.html5gamedevs.com/topic/4427-csg-in-babylon/ 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.