Posted: 9th Jun 2007 14:54
Hello all....

I started work on a new plugin which is being called (for now) MeshTools. The reason that I started work on this is for one of my projects. For some reason, I can NOT access the data of my models through DBpro's vertex manipulation commands. I can also not access the data through DmitryK's plugin DKAMV. If I converted the object to a Mesh, I could then get to the data. But, I didn't want to do it that way because it also contains vertex weighting info that I do not want to lose.
So, to make a long story short, I started my own plugin. There isn't much to it right now except that I can access and manipulate the vertex data that I was trying to get to.

My question is.... would anyone else find any use out of this?

I still have a lot of things that I need to do with it for my own basic purposes. When I get that far, I will probably release that portion of the plugin for free. Would there be any interest in an "Enhanced" version that included advanced features like poly reduction? I don't know what all I could throw in there, but I would be open to suggestions.

Any thoughts, ideas, suggestions?

Thanks!

-Ron
Posted: 9th Jun 2007 15:13
Would there be any interest in an "Enhanced" version that included advanced features like poly reduction?


Absolutely!

If you can produce a reasonable poly reduction algorithm that will work on .x and/or dbo's then I will most definitely be interested. I have been trying to find a good poly reduction tool for a while but to no avail.
Posted: 9th Jun 2007 15:30
YES DEFINITELY!

What I'v always wanted to replace a character models body part, weld the verts but maintain the UV's and weights. IanM's vert welding code works great with static meshes and I'm using that. But the addition of keeping the weighting would be awesome.

When you say "poly reduction features", do you mean pre-process or dynamic?
Posted: 9th Jun 2007 15:33
If you can produce a reasonable poly reduction algorithm that will work on .x and/or dbo's then I will most definitely be interested.


If I decide to do it, it will all be done through code from the user's side of things. So, basicly, there would be a command with some parameters to do the poly reduction. The nice thing about that is it would then work with any format that you could get DBpro to load. You could then just save your object as a new .dbo and be done with it. I will probably be working on a save as .x converter as part of it also.


Edit:
When you say "poly reduction features", do you mean pre-process or dynamic?

It would be "dynamic" because it would work on your currently loaded object. Since speed restrictions would be obvious in any kind of dynamic usage, you would probably only want to use it pre-process though. I'll have to see how it all works out when I get to that.
Posted: 10th Jun 2007 16:55
That would be awsome, The poly-count reduction alone would be well worth the purchase.
Posted: 10th Jun 2007 17:31
It sounds fantastic, like magical functionality that should have already been included but TGC forgot to hire you so it will be here soon.

To be quite honest, I wouldn't give anything away for free. Make it great, charge for it. Freeloaders don't deserve anything.
Posted: 11th Jun 2007 2:18
It sounds fantastic, like magical functionality that should have already been included but TGC forgot to hire you so it will be here soon.

Thanks. Working for TGC would be a very cool job. Too bad I'm an ocean away.

To be quite honest, I wouldn't give anything away for free. Make it great, charge for it. Freeloaders don't deserve anything.

I'll see where things go. The next thing that I want to do is some simple add/remove vertex commands. Then add commands for adding/removing polys. I would like to add some commands to save as a .x file (and possibly other formats) and (as mentioned above) some poly reduction commands.
Posted: 11th Jun 2007 8:01
If you had the ability to export to some different formats, you'd attract a much wider customer base. For the price that I think you'd charge for this plugin, it would be more than worth that price just for the exporting functionality. Anyone thinking of making an editor would want it.
Posted: 11th Jun 2007 12:27
@WOLF

For some reason, I can NOT access the data of my models through DBpro's vertex manipulation commands.


Curious. What data can't you access?
Posted: 11th Jun 2007 13:20
Giving people the ability to create a model editor in DBPro sounds like an exciting concept. If this is the kind of direction you are headed, then as well as exporting to different formats, as already mentioned, some uv mapping tools would also be good. I know very little about this sort of thing, or what is already possible with DBPro, but being able to paint different textures/colours to different polygons, stretch and shift textures, calculate surface normals for proper lighting, that kind of thing .... would seem pretty good to me if you could pull it off. Also, as well as poly reduction, how about poly increasing - eg. for extruding, or smoothing meshes? And, maybe going a bit far, but how about an add mesh (ie. join meshes together) and subtract mesh (ie. carve) function? With these things we could all have a go at writing the next 3d Studio!
Posted: 11th Jun 2007 14:40
@ Wolf,

Count me in - more versatile CSG commands etc?
Posted: 11th Jun 2007 15:48
Curious. What data can't you access?


I can't see ANY of my model's vertex position, normal or UV data using the standard DBpro commands. I'm not sure what is causing it to happen. When I access the object in C++, I can see a pointer to the mesh data. From there I can get to everything that I need.



I'll see what I can do to make some of the features listed above happen. The first goal of this plugin is to allow me to continue on my character creator application. Along the way, I will try to keep adding to this and see where things go.
Thanks for the input!
Posted: 11th Jun 2007 17:09
@WOLF

I can't see ANY of my model's vertex position, normal or UV data using the standard DBpro commands. I'm not sure what is causing it to happen.


That is weird - I use those commands all the time with no difficulty. Do you experience that problem with ALL objects, including DBP primitives, or just certain objects? If it's the latter could you post (or e-mail to me) a very simple example including the dba code you are using?

Also, which upgrade are you using?

[I'd be interested - except the existing commands have worked fine for me ... so far. ]

@Ric

some uv mapping tools would also be good ... stretch and shift textures


If you are interested, I'm working on a routine to stretch/shrink uv coords seamlessly so that when you texture something like a terrain you don't find one pixel has been stretched all the way up a cliff. Early days yet - but a prototype version is working. Just need to add extra features to reduce distortion. [With luck it might end up emulating "least squares conformal mapping" which is used by some modelling/surfacing software.]
Posted: 11th Jun 2007 18:10
That is weird - I use those commands all the time with no difficulty. Do you experience that problem with ALL objects, including DBP primitives, or just certain objects? If it's the latter could you post (or e-mail to me) a very simple example including the dba code you are using?

Also, which upgrade are you using?

[I'd be interested - except the existing commands have worked fine for me ... so far. ]


I am definately using the latest version of DBpro.
It does not happen for me on all objects. In fact, this is the first time that I have actually come across the problem (although it has been a while since I have tried to use it). At first, I thought that maybe I was doing something wrong with the commands. So, I tested the code with a simpler object and the code worked fine. So, then I tried to use DmitryK's plugin (which is great ), but it failed with my object too.
It is most likely something with the way DBpro is loading this particular object. There is probably a pointer in the DBO structures that are not getting set somewhere. When I get some time, I will compare how it loads other objects that work with the commands. Either way, I am starting to like how my commands are setup better anyway, so I will just contunue to use them.
If you would like to do some testing, I can send you an example dbo object. It is up to you.

So far, my plugin consists of 25 commands. More are quickly being added.
Here is the list:

General Info:
total = MT_GetVertexCount(ObjID, Limb )
total = MT_GetIndexCount(ObjID, Limb )
FVFformat = MT_GetFVF( ObjID, Limb )
FVFsize = MT_GetFVFsize( ObjID, Limb )
MeshID = MT_GetMeshID( ObjID, Limb )
total = MT_GetLimbInfluenceCount( ObjID, Limb ) <- Total bones that influence the mesh's deformation

Vertex Original Information:
-----------------------------------------------
This is the vertex info BEFORE any bone influence. I believe this is what the standard DBpro vertex manipulation commands work with.
x# = MT_GetVertOriginalPosX( ObjID, Limb, Vertex )
y# = MT_GetVertOriginalPosY( ObjID, Limb, Vertex )
z# = MT_GetVertOriginalPosZ( ObjID, Limb, Vertex )
nx# = MT_GetVertOriginalNormX( ObjID, Limb, Vertex )
ny# = MT_GetVertOriginalNormY( ObjID, Limb, Vertex )
nz# = MT_GetVertOriginalNormZ( ObjID, Limb, Vertex )
u# = MT_GetVertOriginalU( ObjID, Limb, Vertex )
v# = MT_GetVertOriginalV( ObjID, Limb, Vertex )
MT_SetVertOriginalPos ObjID, Limb, Vert, x#, y#, z#
MT_SetVertOriginalNorm ObjID, Limb, Vert, nx#, ny#, nz#
MT_SetVertOriginalUV ObjID, Limb, Vert, u#, v#

Vertex Calculated Information:
-----------------------------------------------
This is the vertex info after it has been affected by bone matrices
y# = MT_GetVertCalcPosY( ObjID, Limb, Vertex )
z# = MT_GetVertCalcPosZ( ObjID, Limb, Vertex )
nx# = MT_GetVertCalcNormX( ObjID, Limb, Vertex )
ny# = MT_GetVertCalcNormY( ObjID, Limb, Vertex )
nz# = MT_GetVertCalcNormZ( ObjID, Limb, Vertex )
u# = MT_GetVertCalcU( ObjID, Limb, Vertex )
v# = MT_GetVertCalcV( ObjID, Limb, Vertex )

Coming up next....
Next on the list is more info about vertex weighting. Such as a check to see if a limb has an influence on a mesh and weighting info for each influencing bone on each vertex. Then I want to add commands to be able to modify that data.
I also want to be able to set a vertices data by it's calculated position. To do that, I am going to have to work through all of the influences backwards to finally modify the original position (that should be interesting to do!).
Posted: 11th Jun 2007 18:52
This is the vertex info BEFORE any bone influence. I believe this is what the standard DBpro vertex manipulation commands work with.


Could that be the source of your problem? (I haven't knowingly used "bones" yet. )

Yes, I'd be happy to give your model a quick test.

Those commands look impressive.
Posted: 11th Jun 2007 19:20
Wolf - I think that I would be interested in this plugin. I was actually thinking of making some polygon addition tools for TerrainScape which would allow you to subdivide triangles, if this plugin would do it for me, that would save me a bit of time.

Polygon reduction could be useful as well, especially if you could pass an object limb to the reduction function as well as a reduction strength. That would be helpful for making specific limbs of lower detail than others (This may not be useful for many people, but I would find it invaluable), or if you could query the object for the indeces and to supply the function with a index range to reduce, that would be interesting. Providing a few different methods of Poly reduction would empower the users.

Also, if you offer a variety of different exportation options then I am definately buying this. Allowing to save in different formats is worth buying this alone (supposing it is not too expensive).
Posted: 11th Jun 2007 19:34
lol
I just found the problem! For some reason, the mesh data is all being shifted to the next limb.
The name of the limb that I am trying to work with is called mFace. It's mesh data is being shifted to the next limb number, which is given the helpful name of $NONAME$.

Oh well. There is functionality that I need that isn't provided with the standard commands. So, it isn't like I've wasted any effort. Still, I can't help but say.... Doh!
Posted: 11th Jun 2007 19:44
Polygon reduction could be useful as well, especially if you could pass an object limb to the reduction function as well as a reduction strength.


That is kind of how I was thinking. I think I would just ask for a target poly count. Then, it would determine the best places to make the cuts. I could also make it return the calculated "cost" of any particular poly. Then you could choose to delete them manually with a "delete poly" function.

Also, if you offer a variety of different exportation options then I am definately buying this. Allowing to save in different formats is worth buying this alone (supposing it is not too expensive).

Well, I NEED to write a .x exporter, so that one you can count on. I am also very familiar with the .3ds file format, so I could probably make an exporter to that without too much trouble (I have already written an importer for a contract job). I'm not sure what else I would include. Once it is in a .x format, there are many different ways to work with the data.
Posted: 11th Jun 2007 19:57
.ms3d would be amazing as well
Posted: 11th Jun 2007 21:14
.ms3d would be amazing as well


Doesn't Milkshape import/export .x? If so, it might be pretty redundant for the amount of work involved in writing an importer/exporter.


Three more cool commands have just been added dealing with vertex weighting:
Count = MT_GetBoneInfluences( ObjID, Limb, BoneNo ) <- Total influences for specified bone
Vert = MT_GetBoneInfluenceVert( ObjID, Limb, BoneNo, InfluenceNo )
Weight# = MT_GetBoneInfluenceWeight( ObjID, Limb, BoneNo, InfluenceNo )

Next will be commands to modify them. Things are moving ahead nicely!