Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [DBPRO] The Sphere vertex count dilemma - I simply can't understand WHY!

Author
Message
Starshyne Emir
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location: Porto Alegre, southern Brazil
Posted: 23rd Feb 2018 16:52
Folks, take a look on this piece of code.



The vertexcount is showing 54 but I thought it would show 6. What is wrong? My code or my interpretation of how DBPro treats vertexdata on a sphere?
[size=+2]Forever and one[/size]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Feb 2018 17:40
It’s been a while since I’ve looked at this, but I suspect there are at least two things you need to be aware of:

1. Converting the object to a mesh probably destroys any welding so each poly in the mesh adds three vertices.

2. There are “hidden” polys attached to each pole.

It’s also possible that the number of slices, etc, is one more than you’d expect.

The safe way to proceed is to print out all 54 vertices and see which points in 3D space they correspond to. Then you’ll see what’s going on for yourself. I can’t be more specific till I return home over the weekend and get access to a real computer .

Another thing to try is to think of the sphere as constructed from a rectangular piece of elastic mesh divided into triangles in the “obvious” way. The vertices along the top edge get squashed together onto the North Pole and those along the bottom edge get squashed onto the South Pole. When you’ve done that you can then see which are the hidden polys. I vaguely recall there being others as well. Hope this helps .
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 23rd Feb 2018 20:58
Might wanna also mention it's generally best practice to model the sphere or other object using a modelling editor rather than use the built in commands. There's many old conversations where it was discussed that there are problems (of this sort) with the built-in objects.
Starshyne Emir
7
Years of Service
User Offline
Joined: 27th Nov 2016
Location: Porto Alegre, southern Brazil
Posted: 24th Feb 2018 07:04
Yeah, I checked out some of these threads.

Well, I rewrote that demo code and found out something interesting: the MESH made from the sphere has 54 vertexes, but if I count the vertexes of the limb 0 of the object (the object itself), the vertex count shows 15 - that is a reasonable numbers, since the beforementioned object has 8 triangular faces.

The good part is that playing around with vertexdata proved to be great for improving my yet-so-weak programming skills.

I adapted an old technique I used to produce 3D waves in matrices - pretty minimalist - and adapted it to work with vertexdata instead, and produced a plain object that has waves. Check it out.



In my PC it runs at 50fps with 6500+ objects at once - I instanced the object 1 to see if the vertexdata operations would be applied to all of them - and yeah, it wa
[size=+2]Forever and one[/size]
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 24th Feb 2018 09:12
Quote: "Well, I rewrote that demo code and found out something interesting: the MESH made from the sphere has 54 vertexes, but if I count the vertexes of the limb 0 of the object (the object itself), the vertex count shows 15 - that is a reasonable numbers, since the beforementioned object has 8 triangular faces."


Here's a question for you budding Vertex Master.

If I add some vertex's to the top of a plane, does it make more polygons if I don't move them?

Not even sure I can add vertexes in that way, but I need them. not really concerned if it adds more polygons.

But I'd like to add 4 or 5 vertexes to the top side of a plane. And then move them once to create odd shapes at the top of a plane.



Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 24th Feb 2018 10:03
Quote: "I adapted an old technique I used to produce 3D waves in matrices - pretty minimalist - and adapted it to work with vertexdata instead, and produced a plain object that has waves. Check it out.
"



BTW, Your snippit doesn't run...are you using an external DLL somewhere, (Like Matrix 1 Utils?)

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 24th Feb 2018 10:28
Ok...got it to run by adding the missing DLLs to a folder...but what dos that have to do with spheres? just looks like Planes to me?

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 24th Feb 2018 10:29
Oh . sorry

See you said it was for planes...I was expecting pulsating spheres...
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 1st Mar 2018 00:08
Like Mage says, if you want to work with a decent sphere, download Blender and export an icosphere (an evenly spaced sphere).
Aww heck.. I'll just attach one. Load it as a mesh...
Send your parents to noisy sprite demo hell... enter the D-Zone

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-18 19:20:29
Your offset time is: 2024-04-18 19:20:29