jweather / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

SkinInfo Issue - Skinning & Animation #587

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am using the latest SDK (downloaded 8 dec 2009).

I ported the skinning example to vb.net and got it working with tiny.x 
fine.  I then tried my own .x file with a single animation in it and the 
skinInfo variable does not get populated.  This then crashes the 
CreateMeshContainer.  Do I need to export my models in a different way for 
this to work like MDX.

Should the sample that is provided in the docs read and import any .x 
file ?  My MDX project (http://www.entombed.co.uk) reads the file fine.  I 
am wanting to port my entire project to SlimDX and this issue was found 
during preliminary testing.

Lastly, I have checked the issues log and someone else reported a similar 
issue but it couldnt be reproduced.  I also tried some sample code from 
that issue that was posted but it didnt compile (missing properties and 
spelling mistakes, etc).

Thanks for any input.

Original issue reported on code.google.com by daveemm...@hotmail.com on 9 Dec 2009 at 11:31

GoogleCodeExporter commented 9 years ago
If you post your code and the offending mesh I can try it out here to see what's
going wrong.

Original comment by Mike.Popoloski on 9 Dec 2009 at 5:08

GoogleCodeExporter commented 9 years ago
Here is a biped animation from max exported as a .x file.

Let me know how you get on.

Thanks.

Original comment by daveemm...@hotmail.com on 9 Dec 2009 at 6:47

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, forgot to mention that this .x file shows with the animation in the 
directx
sdk .x viewer ok.

Original comment by daveemm...@hotmail.com on 9 Dec 2009 at 6:48

GoogleCodeExporter commented 9 years ago
Using the SlimDX DirectX 9 Skinned sample, show that the model doesn't have any 
material.

The exeption throw is in the method of "DrawMeshContainer"

("i" is out of range)

Color4 ambient = extended[combinations[i].AttributeId].MaterialD3D.Ambient;
Color4 diffuse = extended[combinations[i].AttributeId].MaterialD3D.Diffuse;
Color4 emissive = extended[combinations[i].AttributeId].MaterialD3D.Emissive;

I successfully load the model and show the "Bug" or "Ant" ? adding color by 
default
to the material.

ambient = System.Drawing.Color.White;
diffuse = System.Drawing.Color.Yellow;
emissive = System.Drawing.Color.Violet;

If you want I can upload the source code.

Sorry for my bad english.

Original comment by ragnar...@gmail.com on 10 Dec 2009 at 3:58

GoogleCodeExporter commented 9 years ago
I have tried using the c# example and it doesnt load the model successfully 
(doesnt 
get past any of the lines which reference the skininfo variable).  I would very 
much 
appreciate it if you would zip the entire project you are using to show the 
animation and attach to a post.

Original comment by daveemm...@hotmail.com on 10 Dec 2009 at 9:12

GoogleCodeExporter commented 9 years ago
Ok, just downloaded c# and ran the sample and it stops on the same line, this 
one -

meshContainer.BoneOffsets = new Matrix[skinInfo.BoneCount];

Ragnarsun - you must have edited or changed the sample to get it to work.  Can 
you 
show any changes you have made please ?

Thanks.

Original comment by daveemm...@hotmail.com on 10 Dec 2009 at 9:26

GoogleCodeExporter commented 9 years ago
I don't change any of the source code, only add one or two validation.

Sorry if me source code is a little messy. I add the original directx9 skinned 
mesh
source code too.

Original comment by ragnar...@gmail.com on 10 Dec 2009 at 11:44

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for that.

The sample slimDX version stops and crashes at the same point.  It works with 
your .x files and the tiny.x file, but the temp.x file does not work with 
slimDX.  
null reference exception on the skininfo variable.

Your version works, so I will take a look and see whats different.  There must 
be 
something ..... thanks again for this.

Original comment by daveemm...@hotmail.com on 11 Dec 2009 at 4:51

GoogleCodeExporter commented 9 years ago
Ok.  If you add in the line to your app -

BoundingSphere bs = Frame.CalculateBoundingSphere(this.RootFrame);

after the SetupBoneMatrices(this.RootFrame) bit your application hangs and 
doesnt 
display the animation (not always but sometimes, corrupt memory ?).  In my vb 
app 
(and if I trap the error on the above line in your app) you get the message -

Attempted to read or write protected memory. This is often an indication that 
other 
memory is corrupt.

Any ideas ?

Original comment by daveemm...@hotmail.com on 11 Dec 2009 at 5:39

GoogleCodeExporter commented 9 years ago
BoundingSphere bs = Frame.CalculateBoundingSphere (this.RootFrame);

Forget that line of source code... there was another post about that problem 
(Attempted to read or write protected memory) about animations (Not the Skinned 
one that 
I post). I will try to check after work if I have enought time. Maybe the 
slimdx team can enlighten here.

Original comment by ragnar...@gmail.com on 11 Dec 2009 at 3:58

GoogleCodeExporter commented 9 years ago
I took a look and it appears to just be an issue with the sample. The sample 
never
checks that each SkinInfo isn't null, while rangarsun's does, so it avoids a
NullReferenceException there. Make similar changes and it will all work.

Original comment by Mike.Popoloski on 11 Dec 2009 at 7:34

GoogleCodeExporter commented 9 years ago
Its 2 things -

1.  The sample needs reworking slightly to look after the skininfo == null
2.  *But* even then it doesnt work with the model supplied by me.  The only way 
I 
can get it to render and animate (like ragnarsun) is by creating the device 
myself 
and to not use the sampleframework.

Hope this helps.

Original comment by daveemm...@hotmail.com on 11 Dec 2009 at 9:58

GoogleCodeExporter commented 9 years ago
We aren't supporting that version of the sample framework any longer, so those 
changes are unlikely to get made.

Original comment by josh.petrie on 12 Dec 2009 at 10:37

GoogleCodeExporter commented 9 years ago
Its ok, I have it working by creating the device myself, I was just letting you 
know 
that the sample framework doesnt work with it properly.  Not sure why.

Cheers.

Original comment by daveemm...@hotmail.com on 12 Dec 2009 at 10:46

GoogleCodeExporter commented 9 years ago
Ok then, closing this issue.

Original comment by Mike.Popoloski on 12 Dec 2009 at 11:04