[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Complex 3D Character?

Posted on 2002-06-22
12
Medium Priority
?
397 Views
Last Modified: 2013-12-26
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.....





0
Comment
Question by:DXNewbie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 2

Expert Comment

by:kamarey
ID: 7100996
Take a look at ID3DXSkinMesh.
0
 

Author Comment

by:DXNewbie
ID: 7101587
I don't find a reference to ID3DXSkinMesh in the Object browser?
0
 
LVL 2

Expert Comment

by:kamarey
ID: 7101884
You can find it in DirectX documentation.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:M.E.Pierce
ID: 7102144
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
 
LVL 1

Expert Comment

by:nomad516
ID: 7103988
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
 

Author Comment

by:DXNewbie
ID: 7106120
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
 

Author Comment

by:DXNewbie
ID: 7106243
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
 
LVL 4

Expert Comment

by:joachimc
ID: 7106611
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
 

Author Comment

by:DXNewbie
ID: 7107280
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
 
LVL 2

Accepted Solution

by:
kamarey earned 800 total points
ID: 7108523
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
 

Author Comment

by:DXNewbie
ID: 7110713
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
 

Author Comment

by:DXNewbie
ID: 7111478
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question