Sparky Posted September 1, 2015 Share Posted September 1, 2015 ive had a look through the docs and can't find the answer. How would I go about creating an octahedron and projecting it onto sphere?Thanks! Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 1, 2015 Share Posted September 1, 2015 Hey Sparky, Maybe someone else will understand it better, but I am not sure - what you mean by "projecting it onto a sphere"? Quote Link to comment Share on other sites More sharing options...
jerome Posted September 1, 2015 Share Posted September 1, 2015 some regular polyhedrons will be soon in BJStrust me RaananW 1 Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 1, 2015 Author Share Posted September 1, 2015 Hi Raanan, Perhaps I didn't explain it very well, I wasn't sure exactly how to phrase it. I want a sphere that's made up of subdivided diamonds, starting with an octahedron. As in this article: http://www.isprs.org/proceedings/XXXVI/4-W6/papers/267-270JianjunBai-A042.pdf I've seen something similar done with three.js but not quite sure of the methods used (the example using three started with an icosahedron and subdivided to triangles). But basically, an octahedron (that will be further subdivided) bent into the shape of a sphere. Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 1, 2015 Author Share Posted September 1, 2015 Hi jermone, That's good to know. Assuming BJS gets regular polyhedrons soon, is there anything bakes into BJS at the moment that would allow me to distort them into a sphere or to subdivide it's faces? Or perhaps another approach would be to start with a mesh of 4 diamonds (i.e. a flattened out octahedron, subdivided or otherwise) and bend it round a sphere like you would a texture? Ultimately I need to be able to perform actions on the diamonds separately after/before they are made into s sphere. They will essentially be tiles on a world. Quote Link to comment Share on other sites More sharing options...
jerome Posted September 1, 2015 Share Posted September 1, 2015 I'm afraid these high level geometric tools don't exist yet in BJS for now Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 1, 2015 Author Share Posted September 1, 2015 Thanks jerome (and apologies for mistyping your name the first time . They may well exist by the time I need them. For now I'll have a go at three.js to start me off. What I'm ultimately doing after this bit can be done in BJS easily. Is there anything like that planned for future releases yet? Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 1, 2015 Share Posted September 1, 2015 Babylon is an open source project, contributions are always welcomed ☺. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 1, 2015 Share Posted September 1, 2015 Can't agree more! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 2, 2015 Share Posted September 2, 2015 Hi Sparky! http://urbanproductions.com/wingy/babylon/hedra/hedra01.htm [zipped] (sorry for the slow camera and beginner code) That's likely totally useless to you, as you probably prefer genned vertices, not hard-coded. Professor Stemkoski is a trailblazer of great 3js demos... one of which is a massive polyhedra demo. In that demo... he uses a json storage object... http://stemkoski.github.io/Three.js/js/polyhedra.js ... and I stole that data for my demo (the first url in this post). As you can see, I have incorrectly applied the indices and normals data. In fact, the only good-for-BJS data inside that json structure... is the vertex data. The rest of it is for quad-patch meshes and per-face stuff used by 3JS (I think). What good is any of this for you, from within BabylonJS? Probably none whatsoever. Actually, I never expected to see Prof Stemkoski use static hedra defs. I figged he would have used fancy math formulas... dynamically plotting the shapes. Nope. Static. Oh well. Sparky, I think you should stay right here with us, and play with some BJS geometry plotting. Even in the BabylonJS playground! (Ignore the blue boxes. They were there to help me learn, and can be turned off.) C'mon Sparky! Can I get you a beverage? Some wheat thins? (quick, someone book him a nice hotel room... I'm sure he'll stay and party with us for at least one more night) Quote Link to comment Share on other sites More sharing options...
jerome Posted September 2, 2015 Share Posted September 2, 2015 they did a huge job here by archieving all needed pre-computed data : http://stemkoski.github.io/Three.js/js/polyhedra.js I guess I will re-use them if they are correct instead of calculating them by myself (what if is not that easy actually) to implement some BJS regular polyhedrons. Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 2, 2015 Author Share Posted September 2, 2015 Thanks Wingnut, that looks interesting. Same for the link you posted jerome.I'm staying here for the party, I'm just considering pre-drinks at three to help me get my head around it . I'm really not that hot on 3D stuff, but would be happy to contribute if I manage to do something useful!I've found a couple of articles with fancy maths, here's the one that started me on this road: https://experilous.com/1/blog/post/procedural-planet-generationWhat Andy has done is great, but I'm put off by the hexagons as it's difficult to have varying levels of detail with hex's as one set of hexes don't sit nicely within another, hence looking at the diamond option.So far I'm basking in a maths headache trying to understand the methods Andy has used, particularly slerp() and subdividing a icosahedron on a spherical plane. Although I'm starting to find my way out of that.I'd be interested to understand how the subdivision of a sphere works in BJS at the moment as that might help. (I'll dig out the code later)Also, I don't quite understand the notation used defining the vertices for a shape as per the preparatory json link jerome posted. Am I right in thinking its defining each vertex as an offset from 0,0,0? (Told you I'm a 3d noob!)Thanks again for all your help.P.s wheat thins? (I'm a Brit - never heard of them) Wingnut 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted September 2, 2015 Share Posted September 2, 2015 I just hope that these are the coordinate of each vertex in the JSON file ... Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 2, 2015 Author Share Posted September 2, 2015 For comparison, Andy uses these for a isocahedron: var phi = (1.0 + Math.sqrt(5.0)) / 2.0; var du = 1.0 / Math.sqrt(phi * phi + 1.0); var dv = phi * du; nodes = [ { p: new Vector3(0, +dv, +du), e: [], f: [] }, { p: new Vector3(0, +dv, -du), e: [], f: [] }, { p: new Vector3(0, -dv, +du), e: [], f: [] }, { p: new Vector3(0, -dv, -du), e: [], f: [] }, { p: new Vector3(+du, 0, +dv), e: [], f: [] }, { p: new Vector3(-du, 0, +dv), e: [], f: [] }, { p: new Vector3(+du, 0, -dv), e: [], f: [] }, { p: new Vector3(-du, 0, -dv), e: [], f: [] }, { p: new Vector3(+dv, +du, 0), e: [], f: [] }, { p: new Vector3(+dv, -du, 0), e: [], f: [] }, { p: new Vector3(-dv, +du, 0), e: [], f: [] }, { p: new Vector3(-dv, -du, 0), e: [], f: [] }, ]; Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 2, 2015 Share Posted September 2, 2015 Ok, I finally read the PDF and saw what Andy is doing, so I understand where you want to go. Yeah, BJS has ya covered... for the high-performance rendering/visualization of that stuff. Fastest gun in the west! The BJS engine will be dozing-off, waiting for your JS to give it more data to render at 120 fps. Okay, that was a bit of bloviating on my part. But, yeah, I would love to see BJS-based tools that we could use to experiment with these things. Terrain quantizing and indexing. I think earthquake researchers use things like these, sometimes fed with remote sensor data. Way cool. Great topic/project! Quote Link to comment Share on other sites More sharing options...
Sparky Posted September 3, 2015 Author Share Posted September 3, 2015 Ha, glad you like it Wingnut. I think it will be super-cool, especially in BJS . I'm struggling to find the right techniques and formulas for a diamond grid at the moment. I've found one, but it's in chinese and the google translation is poor. Everyone is too keen on triangles! Wingnut 1 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.