#Spherical Coordinates (Splitting a sphere into eights)
163 messages · Page 1 of 1 (latest)
How many rings and segments are you thinking. (Easier if segments is a multiple of 8)
Maybe 32 for segments, 16 for rings
I might up it to 64 and 32 tho
But 32 and 16 seems to be good
Do you need faces inside the sphere on either side of the segments?
Yep
Otherwise it'll be hollow
So like think of it more like sowing the missing parts
That's the big issue. Splitting is one thing, but adding the faces might also be tricky
I could probably just draw to spheres with cylindrical coordinates, convert it to rectangular coordinates, and use those. I would need three circles. The issue is then we need to remove extranious parts of the circles too. So we need to do it off a case by case basis
What I'm thinking is we calculate which octant we're in
while we're generating the mesh
and if we don't need it, we don't calculate it
Then we just need to figure out which quarter circles to add
and then it's done
octogonal spheres are easier to cut up
I just started writing the code to generate it and realized something do you need UVs because I'm terrible at setting up UVs
I was about to declare the arrays
Why do you need a sphere mesh? What purpose do you want it for
I'm assuming you want it
I'm not the one asking I was trying to help
ah
print out each part separately for an existing godot csg sphere or a https://docs.godotengine.org/en/4.4/classes/class_spheremesh.html sounds a lot easier than generating one and then printing one
Inherits: PrimitiveMesh< Mesh< Resource< RefCounted< Object Class representing a spherical PrimitiveMesh. Description: Class representing a spherical PrimitiveMesh. Properties:,,, float, height, 1....
So I was curious why was there a need to both generate and print
If all you needed was the sphere in blender, you can even export the current scene to gtlf2
Oh me?
yeah
wdym?
We wrote a character generator once for work. Then the project meandered so we decided to https://github.com/V-Sekai/godot-vrm and do other godot engine related things
there's also the makehuman project
I know but I just want it as a challenge you know? Plus I want the full rights to the things created in it
We've done a lot of those steps to make a godot engine character generator. ask me anything
What parametes did you add?
I'm thinking @iFire may be more helpful but if it doesn't work (and you don't need UVs) at me and I'll resume making the generation code I'm fairly quick at it because It's my go-to method
previously godot engine only had a collada importer. So we added fbx and gltf2
I have this for the things people can customize
that looks like a lot like the make human blend shapes
Well anyhow, I got it partially working
except theirs this weird triangle?
It's like an artifact
nope not at all
Anyhow here's the weird triangle
Creating a 3D game can be challenging. That extra Z coordinate makes many of the common techniques that helped to make 2D games simpler no longer work. To aid in this transition, it is worth mentio...
are you sure that's a triangle? looks like multiple triangles
Turn on wireframe mode
Godot Engine doesn't have n-gons (not even quads)
How?
you probably are using the wrong triangle order or forward axis
it's an editor viewport debug mode
I'm generating it, I can't see it in the editor
this is here, so you can see it so you can turn on wireframe mode
No this is in the running instance
hm, uh writing your wireframe shader is a bit annoying
anyways as far as I can tell something is either cutting out the mesh or it's missing
Yeah
like a camera clip plane
I'm thinking it's either one of two things
either my function for checking octants is wrong
or it's just in multiple octants at once, which defaults it to true
can you do only one octant
it should be possible.
so standard tricks are divide and conquer and use the identity trick (make something that returns the input like 5 * 1 = 5)
Let me check
1 octant works
2 octants work
3 works
4 works
Wait nvm?
Octants can only print horizontally for some reason
that might be it
So what do I do then?
Yeah not sure what to do
I've tried debugging it
but it's kinda hard to
try doing only vertically
It get's the triangle issue then
did divide conquer work
Wait now I'm confused
Okay so it works
so long as everything
is on the same hemisphere
otherwise it breaks
sounds like backface culling
what's that?
you know when you have a mesh and go inside it and it turns transparent
Yep
one common optimization is don't draw the back face because someone assumed the mesh is manifold so it will never show
Yeah, I mean ideally I want that too
How would backface culling fix this?
Correction: How does it relate to this
good point
if you reversed the winding order or whatever
I don't think so
I could send you a copy of the project
That way you can debug it in godot
I'm a bit ragged so you can send it but I'll probably do more progress in this chat
hi, dropping in from the math channel, the length of this conversation is intimidating...
this page from the doc ends with a simple code to generate a spherical mesh that you may want to take inspiration from : https://docs.godotengine.org/en/latest/tutorials/3d/procedural_geometry/arraymesh.html
This tutorial will present the basics of using an ArrayMesh. To do so, we will use the function add_surface_from_arrays(), which takes up to five parameters. The first two are required, while the l...
That does help quite a lot
I FIXED IT
I think
kinda
No more weird triangle thing
I also have a few questions :
- does it have to be a mesh (writing a shader to render a perfect sphere isn't very hard, though I get you may need to get aquainted with shaders first)
- is the "UV sphere" you seem to be going for really fitting your needs ? another nice approach to meshing a sphere would be this (I've seen it called the "icosphere"): https://upload.wikimedia.org/wikipedia/commons/f/ff/Geodesic_icosahedral_polyhedron_example.png , or you could also use the popular fibonacci spiral (as seen here for example https://extremelearning.com.au/evenly-distributing-points-on-a-sphere/)
there's no gdscript in the project
I recommend icosphere too
I forgot the name and the algorithm
nvm
To the question does it have to be a mesh, yes it does. I'm merging it with other meshes later so it will have to be. Number 2, I'd like to stick to the UV Sphere if possible. I just personally don't like the icosphere method. I still have no clue whats wrong though. Even the one godot provided, adding the changes makes the triangle error. I think it's a error with the octant detection
well, I'm going to bed now ; please try to somewhat sum up what you've done and how it misbehaves, I don't think I'll ever want to read the whole thread
Yeah bassically we got the script to generate the sphere, we tried detecting when it split into octants, it did, but then their was this weird triangle artifact left behind. I then just noticed that a entire strip is missing. So I think it's the octant detection
Yo @rotund pilot
I think I fixed it
Well not me...
Sadly I had to get help from Claude
It fixed it though
But I don't like using AI
What's your opinion on it?
Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.
What's that supposed to mean?
AI will magnify the power of the powerful and the individual. I can't predict the future.
yay
To be honest I still would prefer the strategy of generating csg meshes then auto rigging them in godot engine.
As in?
Correct
a flaw of this approach is you won't keep water tightness "manifold"
secondly it's kinda annoying and you can't get the engine to help you with skinning or morphing
but you've gone further than me, so don't let tell you what to do
I mean your right
I'd detoured into making the avatars work in game
Wdym?
Like character controllers.
We decided not to make a character generator and like directly import vrm from vroid etc or unity packages from booth.pm
I'm still a little confused on what your trying to say
Thanks