Complex 3D Character?

Hi,

I'm familiar with both OpenGL and DirectX8 as far as setup
and construction of basic 3d geometric shapes, Etc.

What I want to do is Parse a 3D Character File and
construct that character making it possible to move
the character in relation to the Bones.

I know how to parse the file, create vertex arrays,
texture map, etc, I just can't figure out how to
define the character in a way that I can move/pose
it easily.

The 3D Character is defined with the following:

Vertices                     (X-Y-Z,Normal X-Y-Z)
TextureVertices      (U-V)
Bones:         Bound to Vertices
Blendings: Bound to Vertices
Faces:         Bound to Vertices

Of course VB source code would be great, but if someone
could point me to information(preferably free!) dealing
specifically with addressing bone manipulation I'd accept
that as an answer too.

Everything that I've found on the net deales with
character animation through transforms of the world view,
I'm looking for info on manipulating parts of an object
in relation to the rest of the object.

Also, I know squat about C++, so until next semester
(I'm taking C++ then), I need info in VB.  I'll raise the
points if this is extremly complex, It just seems like
I'm missing the forest for the trees here.....





DXNewbieAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kamareyConnect With a Mentor Commented:
Use D3DXCreateSkinMeshFVF instead of D3DXCreateSkinMesh.

D3DXCreateSkinMeshFVF(
  760,
  496,
  19,
  OPTIONS,
  FVF,
  pDevice,
  ppSkinMesh
);

In field OPTIONS you can put D3DXMESH_MANAGED or D3DXMESH_SYSTEMMEM and maybe D3DXMESH_DYNAMIC.
In field FVF put your vertex format.

If it doestn't work, write here errors you get.
If you can, post piece of code.

And take a look  here:
http://www.gamedev.net/reference/articles/article1835.asp
0
 
kamareyCommented:
Take a look at ID3DXSkinMesh.
0
 
DXNewbieAuthor Commented:
I don't find a reference to ID3DXSkinMesh in the Object browser?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
kamareyCommented:
You can find it in DirectX documentation.
0
 
M.E.PierceCommented:
That's because it's a C++ interface,
use the VB equiv: D3DXSkinMesh (No I)

Look here for more info about it, should bring you up to speed.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_vb/directx_vb/Graphics/Reference/VB/D3DX/Classes/D3DXSkinMesh/d3dxskinmesh.asp

You may be jumping a little further ahead than you should,
I'd create a simple character, try 2 bones with
2 cubes (sharing a common vertex plane for 1 face)
and add bones and cubes as you get an understanding of the
transforms required to pose it the way you want.

0
 
nomad516Commented:
Use an .3ds file instead, convert it to .x file via the
utility that comes with the DX8 SDK...then use .x files
instead...(just follow the documentation)
0
 
DXNewbieAuthor Commented:
The point of my question was that I want to be able to take
a 3D character from a 3D game and manipulate it in my program.
I can't very well ask the software company to send me .3DS files
of thier proprietary characters.....
0
 
DXNewbieAuthor Commented:
Comment for M.E.Pierce:

Ok, I see the structure of the mesh object but how do I
initialize the mesh?
I'm not sure about the CreateSkinMesh fuction, specifically
the options and declarations arguments.

My character file has:
19 bones
760 faces
496 vertices

I'm calling:
dim MyChar as D3DXMesh

Set MyChar = objD3DX.CreateSkinMesh(760, 496, 19, *, *, devDG)

I've tried every possible combination in the * fields,

Always exits with an automation error or type mismatch error.

(I've also tried CreateSkinMeshFVF)

Can you clarify the usage of either of these?
0
 
joachimcCommented:
Hi

Take a look at the

Implementing skinned meshes with DirectX8

http://www.gamedev.net/reference/programming/features/skinmesh/

It teaches you everything you need to be able to use a skinned mesh with .x files.

/Joachim
0
 
DXNewbieAuthor Commented:
I appreciate the inf, but I'm already familiar with matix
math and 3D transforms, I specifically need info on
Constructing a Skinned mesh from scratch in VB using
(preferably)DirectX 8(or 8.1) or (will accept)OpenGL.

Not loading it from a .x file , not the C++ method.

0
 
DXNewbieAuthor Commented:
OK, I think I've got the skin creation down, but how do I
Render the mesh?

Here's my code:

Option Explicit

Dim g_DX As New DirectX8
Dim g_D3D As Direct3D8
Dim g_D3DDevice As Direct3DDevice8
Dim g_D3DX As D3DX8
Dim IsInited As Boolean

Dim BodyMesh As D3DXSkinMesh
Dim HeadMesh As D3DXSkinMesh

Const D3DFVF_NVERTEX = (D3DFVF_VERTEX)

Dim g_VB As Direct3DVertexBuffer8

Dim bVertex() As D3DVERTEX          'Body Vertices
Dim hVertex() As D3DVERTEX          'Head Vertices

Private Sub Form_Load()

Me.Show

Set g_D3D = g_DX.Direct3DCreate()
If g_D3D Is Nothing Then Exit Sub

Dim Mode As D3DDISPLAYMODE
g_D3D.GetAdapterDisplayMode D3DADAPTER_DEFAULT, Mode

Dim d3dpp As D3DPRESENT_PARAMETERS
d3dpp.Windowed = 1
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
d3dpp.BackBufferFormat = Mode.Format

Set g_D3DDevice = g_D3D.CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,d3dpp)
If g_D3DDevice Is Nothing Then Exit Sub
Set g_D3DX = New D3DX8

CreateGeometry     'Read Skin Files and fill Vertex Buffers
InitGeometry          'Assign Parameters to SkinMesh

End Sub

Private Sub Timer1_Timer()

g_D3DDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET, &H808080, 1#, 0

' Begin the scene.
g_D3DDevice.BeginScene
If IsInited Then
    ' Rendering of scene objects occur here.
   'NOT USING THESE ANYMORE-ORIGINALLY FOR RENDERING PRIMITIVES
   ' g_D3DDevice.SetStreamSource 0, g_VB, UBound(cVertex)
    'g_D3DDevice.SetVertexShader D3DFVF_NVERTEX
    'g_D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, 1

End If
' End the scene.
g_D3DDevice.EndScene

g_D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0
End Sub

Private Sub Form_Unload(Cancel As Integer)

    Set g_D3D = Nothing
    Set g_D3DDevice = Nothing

End Sub

Private Sub InitGeometry()

On Error Goto ErrorHandler

Set BodyMesh = g_D3DX.CreateSkinMeshFVF(760, 496, 19, D3DXMESH_DYNAMIC, D3DFVF_NVERTEX, g_D3DDevice)
Set HeadMesh = g_D3DX.CreateSkinMeshFVF(931, 421, 1, D3DXMESH_DYNAMIC, D3DFVF_NVERTEX, g_D3DDevice)

If BodyMesh Is Nothing or HeadMesh Is Nothing Then Goto ErrorHandler

D3DXMeshVertexBuffer8SetData BodyMesh, 0, UBound(bVertex) * 3, 0,bVertex(0)
D3DXMeshVertexBuffer8SetData HeadMesh, 0, UBound(hVertex) * 3, 0,hVertex(0)

IsInited = True
Exit Sub
ErrorHandler:
MsgBox("Mesh Initialization Error")
IsInited = False
End Sub

I think I've successfully created my meshes, I know I still have to set the bone influences, texture data, etc.
but I'd like to be able to render the mesh before I start
modifying it,
So that I can see what's happening at each step.
0
 
DXNewbieAuthor Commented:
Thank All of you very much,
But I had to award the points to the person
who helped me the most(and most directly).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.