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 / Vertexdata animation

Author
Message
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 10th Feb 2011 15:00 Edited at: 10th Feb 2011 15:01
Hi you all.
Playing a bit with vertexdata, we can create amazing objects without the need of an external editor .This can be a bit tedious, but for those who like the challenge of inventing new things and discover new possibilities with the DBPro, here is a small piece of code.






Once done our object, we can save it as .dbo and load it directly and use the animation subroutine.When we have the dbo, we can use this code:





What I try to do now is figure out how to save the animation in the same object. I hope this piece of code can help someone

Cheers.




I'm not a grumpy grandpa
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 10th Feb 2011 21:16 Edited at: 10th Feb 2011 21:18
You might try to stash the animation information in an image file associated with the model as a texture. You could use a 64x64 pixel texture, which is more conventional that the 50x50 you are working with. Then you might have about about 25KB left over from what is needed in the 50x50 portion you using for texturing purposes (assuming you are saving as png or other 4 byte/pixel format). You might be able to store the animation info in those leftover bytes.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Feb 2011 02:16 Edited at: 11th Feb 2011 02:18
Hi Jeff Miller.
The purpose of this example was rather to show how we can use vertexdata to make objects from within DarkBasic, that´s why I used this small texture, but we can use greater one.I know how to make a data file to load the animation from Dbpro, but I don´t figure out how to save it all in the same object .


For the example below, I used a plane and I modified the vertices with vertexdata to create a curve. So we can create nearly every thing with this method.



I'm not a grumpy grandpa
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th Feb 2011 12:32
Nice work Chafari!

That's great.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Feb 2011 14:35
@baxslash
Thankyou . I`m working on a jeep car model. I will show it when I finish.

Cheers.

I'm not a grumpy grandpa
enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 12th Feb 2011 01:00 Edited at: 12th Feb 2011 01:09
You could create your own vertices from scratch and use the Make Object commands from matrix1 to create a real object out of them...



Now, this example has a few bugs... but you get the general idea...

EDIT: This was a program I experimented with a bit to try stuff like this out, so I have commented out some of it, and also a part that uses D3D_FUNC...

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Feb 2011 02:15 Edited at: 27th Sep 2011 03:16
@enderleit
I will study deeply your code, it looks really interesting. Thank you for your example.

Here is another simple but curious effect.






Cheers.

I'm not a grumpy grandpa
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Feb 2011 20:41 Edited at: 12th Feb 2011 20:42
Hi there.
It is difficult and slow, but very fun. This is what I have so far in my model.That´s nothing special, but we must bear in mind that the object is done by moving vertices of planes and spheres with vertexdata.



Cheers.

I'm not a grumpy grandpa
noturno
15
Years of Service
User Offline
Joined: 9th Mar 2011
Location:
Posted: 21st Mar 2011 16:20
Hey chafari and enderleit, very good job!

I`ve been looking for how to bend a box on fly with benzier or cubic curves and it seems to help a lot. Actually I had just started a new thread on that issue.

Also:

Quote: "For the example below, I used a plane and I modified the vertices with vertexdata to create a curve. So we can create nearly every thing with this method."


To chafari, I would start asking if you could share the code you used to make that image on your second message above: the bended plane.

Thanks a lot for the insightfull job, dudes!
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Mar 2011 16:45
There's a command ADD MEMBLOCK TO OBJECT.

Quote: "The memblock is stored inside the objects custom data feature, and remains with the object even if the object is saved and reloaded. This feature is ideal for exporting additional settings for the object such as scale, rotation or more exotic data such as sound or image data. See the memblock category for more features provided through the memblock system."


That might be how you could store animation data.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 21st Mar 2011 21:19 Edited at: 21st Mar 2011 21:27
@noturno

Here`s the code...very simple
You will have to add the texture.





Cheers.

I'm not a grumpy grandpa
noturno
15
Years of Service
User Offline
Joined: 9th Mar 2011
Location:
Posted: 23rd Mar 2011 07:23 Edited at: 23rd Mar 2011 08:30
Hey chafari, very good aproach, for sure! Thanks a lot.

I was just wondering how to improve the code so we could choose how many sections would be used to bend the box. In your example, you use 7 sections (with of course 8 general vertices and their clones). But what if I would like it to use, for instance, 32 sections (so 33 general vertices and their clones)?

My small changes in your code are:



So, one should just change the value of variable "num_sections" at the very begining of the code.

A very basic question I still have though, and probably you guys may help, is how to measure the lenght of the bended box in the example above (more specifically, the lenght of the arch formed by the bended box in the exmple). Any tips will be very much welcome!
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 23rd Mar 2011 10:45
Very simple, since you still use polygons to create the curve, and not a spline (which is i guess a non existent method in DBPro), you should just use the Pythagorean theorem poly by poly, then add this all together, and there you have it.

You can even get the length of the inner and outer curves this way, or the center length which is a bit trickier.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Mar 2011 12:32
Quote: "But what if I would like it to use, for instance, 32 sections (so 33 general vertices and their clones)?"


we have to take into account that all mesh start with vertex zero...so we have 7*4 rows == 7+1*4+1 == 8*5=40.


Cheers.

I'm not a grumpy grandpa
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Mar 2011 12:47 Edited at: 23rd Mar 2011 18:16
Sorry for double post

I'm not a grumpy grandpa
PAGAN_old
20
Years of Service
User Offline
Joined: 28th Jan 2006
Location: Capital of the Evil Empire
Posted: 29th Apr 2011 07:42
isnt this how animation used to be done in the 90s 3d games?

dont hate people who rip you off,cheat and get away with it, learn from them
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Apr 2011 14:49
Quote: "isnt this how animation used to be done in the 90s 3d games?"


Probably, therefore we can use this technique with DBPro.

I'm not a grumpy grandpa
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 16th Jul 2011 07:10 Edited at: 16th Jul 2011 07:13
CLOTH WITHOUT PLUGIN
Hi there.
I have been trying to make somthing like cloth using just Dbpro ...that is what I have so far but I'm trying to improve it.



Cheers.



I'm not a grumpy grandpa
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Sep 2011 02:33
Animating a mesh in real time.

I took part of my 3DTree script to show how to animate a mesh in real time moving the mouse. I hope it can help someone.





Attached all media files.

Cheers.

I'm not a grumpy grandpa
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 27th Sep 2011 02:37
All of this real time modelling work is ace!

Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 27th Sep 2011 02:58
Chafari! You gotta write a tutorial or something on this! This is amazing! O_O

All I've done is load OBJ files using Memblock data to create meshes and objects!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Sep 2011 03:10
Quote: "All of this real time modelling work is ace!"

I made some tricks to add the tail . Just playing with my trunk creator program.


Quote: "Chafari! You gotta write a tutorial or something on this!"

Well , I have my own handwritten but I'll have to translate into english .
If you have any Question, I could answer

Cheers.

I'm not a grumpy grandpa
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 27th Sep 2011 03:11
If you could translate it into English, I'd definitely read it. I have been thinking about making my characters 3D while my background for my game is 2D isometric.
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 27th Sep 2011 03:21
Actually, I guess this is a good start to ask:

What is vertex data, and how can it be manipulated?
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Sep 2011 03:22 Edited at: 27th Sep 2011 03:37
I could put all detailed examples in a Pdf. I'll think about it .


Edited Sorry, we were writting at the same time.

Quote: "What is vertex data, and how can it be manipulated? "


All objects are made with faces and vertex, hence if we move this vertex, we can make differents objects . Example code:




Cheers.

I'm not a grumpy grandpa
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 27th Sep 2011 03:36
Thanks! That will give me something to play with a bit later.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Sep 2011 03:39
@Da_Rhyno

You are wellcome !!

Cheers.

I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 8th Jan 2012 10:55
@chafari

I like your cloth example

it gives hope that clothing could be created
for a caricature in game that they can ware

would adding in the option for tearing it
be an option ?

to move side ways - is to move forward
Since a Strait line gets thin fast
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Jan 2012 12:41
Quote: "I like your cloth example "
Thanks you can use it as is is free code.


Quote: "would adding in the option for tearing it be an option "


Note that we are working with vertexdata, and we can add delete and much more. This example of poor cloth, is made with a plain object 20*20*4*4 vertex ...we could do the same just making triangles and adjusting UVmapping to the final whole mesh.

Cheers.



I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 8th Jan 2012 12:55 Edited at: 8th Jan 2012 19:54
@chafari

easy for you to say
as I just slowly starting to understand how vertex data could be manipulated

the problem with Dark Physics was it was not fished
you need anther program to make an object manipulable
and even then there is a limit on the density of vertex data
with this example it means taking a regular object and letting
it forum to what after is being put on and letting it being
affect by what ever it will come in contact with

I know some of that sounded double stated

I just wanted to show the path

with your example I can now do more , even make a program
to help me get the info out of the item so that it can be used
in my projects

well once i understand bit more

to move side ways - is to move forward
Since a Strait line gets thin fast
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Jan 2012 14:41
@Resourceful
I'm glad some of my code can help you. Vertexdata is difficult at first, but then it is easier than it looks . I made my lathe tool working entirely with vertexdata. The most hard task playing with vertexdata, is find out how to texture the object, but it is easy to create triangles and control points to fix the mesh.

Cheers.



I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 8th Jan 2012 20:12
@chafari

one other thought comes to mind
holes in objects

I know some one was working on dll for such
but he stopped because it got too complicated

with this a bit of extra code
such could be accomplished

the hard part of the code would be adding in the correct
vertex's so that every thing blends

well that's how it seams to me

to move side ways - is to move forward
Since a Strait line gets thin fast
Visigoth
21
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 8th Jan 2012 20:29 Edited at: 8th Jan 2012 20:29
more fun with vertexdata.
Using the DarkGDK.net plugin, and C#, and the Microsoft Kinect SDK, and a Kinect, realtime mesh deformation using the depth camera of the Kinect. I have big plans for this setup, eventually.

http://www.youtube.com/watch?v=yCKwO-DvwHQ
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Jan 2012 20:52
@Resourceful

Yes, we can make holes in the mesh with shaders or just deleting vertexdata. The way we find out where the vertex are, is like in a matrix . Every object starts with vertex 0 to the end(sometimes thousands) . This piece of code show us the vertex position of a sphere.



I prefer for this purpose, use an image with the hole, and then set object transparency...there are lots of ways. If it is an object with a single mesh, it is harder as we have to finde out vertex position, but if the object has several limbs, we can just texture limb and scroll texture to the correct position.

@Visigod
Nice videos...I will put an eye in this

Cheers.




I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 8th Jan 2012 21:53
it all makes sense

as for many ways

the one that has the fastest results is the best one

working with a single object like a "sphere"
when your getting into objects either as one big item
or is broken down into peaces then there is more to locate and calculate

at least now I got a basic idea to work with but
since I am much slower at picking the full thought
it could be a year or two at my speed before I have some thing worked out
that I can live with or even share

for now @chafari thanks for the pointers

to move side ways - is to move forward
Since a Strait line gets thin fast
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Jan 2012 00:24
@Resourceful

You are welcome !!

Cheers.

I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 12th Jan 2012 23:03
the code I have found here has given me several idea


the problem is coming up with a way to apply what I have in mind
my lack of fully understanding dose not help

too bad Dark Physic was never finished
even with some doing an up date on the physic's it will be some time
before they get that part

a vertex controls system would be the best option make such happen
saying that I wish I could then I finally could have some thing to sell
and start to make a living and not feel like I am getting hit by train
well make that train's both going forward and backwards

@chafari

I tried to expand the cloth to be larger so when it was falling example
it would cover more of the object but it did not take

to move side ways - is to move forward
Since a Strait line gets thin fast
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Jan 2012 23:40
@chafari - It would be awesome if you got into C and Assembler as these projects you've been working on would be so smooth and you could do so much more.

Excellent work by the way! Had to pipe in...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Jan 2012 00:34
Quote: "I tried to expand the cloth to be larger so when it was falling example
it would cover more of the object but it did not take"


Well ..that example had just 20*4 vertex, so we need to make a plain with more vertex, and add more control points.

Quote: "It would be awesome if you got into C and Assembler as these projects you've been working on would be so smooth and you could do so much more"


Perhaps I could, but now I'm too old and I make all this just for fun. Perhaps I could make a group of people interested in programming.

Cheers.



I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 13th Jan 2012 03:27
@chafari

After looking closer at the example
I understand that the one item you start out with
it is broken down in to many

to have a bigger one it means it would have to be many more added to it

to move side ways - is to move forward
Since a Strait line gets thin fast
SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Jan 2012 03:54 Edited at: 13th Jan 2012 03:56
@chafari

If you have functions to play back your animation....why not store the animation in the objects memblock area?

My original setup for model prop was saving the animation data inside the dbo's memblock area. I created several memblocks to store all the textures and then even a memblock for the animation data. Once finished i created a single memblock consisting of all those memblocks inside packed into 1.

Then you just need to unpack it at load time...

I can create an example if you like :p

Just let me know...


The Second choice would be to create your own format such as i did with Model Prop. Then you can store pritty much any data you want in any order and would be easier for you to load in.

But the memblock idea is definatly easier to code then an entire model format.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Jan 2012 11:27
Resourceful

Quote: "to have a bigger one it means it would have to be many more added to it"

Yes... you're right , that's why I said cloth without plugin just using vertexdata....if we need to do big projects you had better use the cloth plug-in.

SMD_3D Interactive
What I did, is just save all postion of the control points that move the mesh, then I have to use again vertexdata to play the animation.

Quote: "I can create an example if you like :p"


Ok...we can learn every day from young people

Cheers.

I'm not a grumpy grandpa
SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 14th Jan 2012 01:24
ok ill write up a quick example of dumping some memblock textures and animations into a single memblock and have it save and load from the dbo file.

(i'll post it when done!)

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Jan 2012 01:26
Thanks

Cheers.

I'm not a grumpy grandpa
SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 14th Jan 2012 01:38 Edited at: 14th Jan 2012 01:41
i dont know if this helps....but i coded this already...lol!

Here is an example of just unpacking textures from a .dbo and playing back animations loaded from seperate files. Now these animations are not done with "play object" or "loop object" as i had to create myself some functions to do the animation sequences.

Have a look.

I will dig to see if i can find the code that created the dbos with the textures packed inside.

If you want to do something simular to this i will rewrite it for you so its easier to understand and can be used as a utility to pack things in a dbo and extract.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Jan 2012 03:02 Edited at: 14th Jan 2012 13:49
Hei... nice robot with the little antena like a tail Thanks so much....I will study your example code and I will report you back tomorrow.


Edited.
SMD_3D Interactive
I'v been studing your code, and that's what I do saving position, rotation and scale to a txt file using open to write and open to read. What I would like to do, is add this animation to the same file though. To do that with vertexdata, is hard, as to save every vertex position makes a txt of 2 or 3 MB. I could make meshes instead and play animation just changing mesh like this example.




I will try to adapt your code to my objects

Cheers.

I'm not a grumpy grandpa
SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 14th Jan 2012 16:38
well ok so you would like animation in the dbo file correct?

here let me test your last code you posted.... i'll make something for you :p

SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 14th Jan 2012 19:22 Edited at: 14th Jan 2012 19:24
ok im not quite done yet but i got the first chunk coded to create a texture file from data statements after saving it.

I will finish this when i get home from work.

-what i will now do when i get home is create a vertex animation and dump the vertex animation into a memblock as well as the texture file into a single dbo and then re-extract it.

(no media required for this example)

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Jan 2012 19:56 Edited at: 14th Jan 2012 19:57
SMD_3D Interactive

I'v got something similar to your code. Imagine an image (ico) with 20*27 pixels that is just 4.096 bytes----- when I save it using memblock, the data.dat is 118.784 bytes that is 46 times bigger than the actual bmp size, and the file will be separated....that is just the image, but we don't need to include image in the same object...just animation. This is the code I use so far.




If we had to do the same with an image 256*256, probably that would be many MB's

Cheers.

I'm not a grumpy grandpa
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 14th Jan 2012 20:48 Edited at: 14th Jan 2012 20:49
@chafari

one thought to doing a data.dat would stop people stealing your 3d objects
the images there is nothing much can be dun about that

I relies the files sizes would be large
but the object would be unusable for any one else

also the memblock locations would have to be found
for saving and the locations for the objects would loaded into
would also need to be known

I know a set of functions could be built to take care of this

to move side ways - is to move forward
Since a Strait line gets thin fast

Login to post a reply

Server time is: 2026-07-10 10:33:53
Your offset time is: 2026-07-10 10:33:53