Bug?

Sep 15, 2008 at 5:21 AM
Hey again

Question 1

I'm putting in a huge static mesh model that i'm trying to load into the physics engine.  So I dug out the JigLib samples and found TriangleMeshObject which I modified and added to my project.  Right now when I load that mesh into JigLib using the VertexProcessor, it seems the collisions version is about 14 times bigger than the rendered version.

            IPrimitive prim = new SpherePrimitive( new Vector3( 0.0f ), 10000.0f );
            testmodel = scene.CreateSceneModel("Models/Terrain", prim);
            testmodel.LightingEnabled = true;
            testmodel.Transform.LocalPosition = new Vector3(0.0f, 0.0f, 0);
            testmodel.Transform.LocalScale = new Vector3(1.0f);
            scene.Add(testmodel);
            scene.AddGarbage(testmodel);


            //Try adding this to physics
            Matrix orientation;
            testmodel.Transform.GetOrientation(out orientation);
            TriangleMeshObject tMeshObj = new TriangleMeshObject(physicsSystem, testmodel.Model, orientation, new Vector3(0.0f) );
            scene.AddGarbage(tMeshObj);


If I scale the model's local scale to about 14 then its pretty close, but its still weird how much difference there is.  The VertexProcessor Model scale is set to 1.  It almost seems the rendered scale isn't the exported scale from MAX.  I'm using KW Xport, with a scale of 1.  When I compare my un-scaled character and ground in max, it does look like the rendered version should be 14x what its rendering at.

Question 2

Also I'm trying to get my player model to not look washed out in the same scene.  I've tried all sorts of lighting options, and even disabling lighting all together.  Is there something I need to do to get the full colors of my character.  Plugging my model into the default CharacterDemo has the same effect.  Basically it looks milky white.

Thanks in advance
Adam

P.S.  Question 1 may be better directed in the JigLib forums, so i'll post it there as well when I get a chance.


Coordinator
Sep 15, 2008 at 3:02 PM
Hi Adam!

For the first question... I'm not real sure. Try looking at the Matrix that you are getting from testmodel.Transform.GetOrientation(out orientation). It should be identity. If it's not, then the bug is in my Transform class.

I'm not sure what to suggest here...

For the second question... which type of class are you using to render your character - the SkinnedModelComponent or the CSkeletonBaseComponent? What lights are you using in your scene? Also, can you post the code that creates the character?

I just now looked, and I think I have some bugs in my SkinnedModelComponentDrawer class.

I will be releasing a new version of Ox in the next day or two. It will have some changes that I hope will fix your second issue.
Sep 18, 2008 at 9:04 PM
Hey thanks for the quick reply, i haven't gotten time to debug question 1 any further, but as for Question 2, here is the code I use to create the player model.

            m_playerModel = m_scene.CreateSceneSkinnedModel(
                "Models/Player", new BoxPrimitive(new Vector3(-100), new Vector3(100)));
            m_playerModel.Transform.LocalPosition = new Vector3(-10, 700, 0);
            m_playerModel.AnimationController.StartClip(m_playerModel.SkinnedModel.AnimationClips["Idle"]);
            m_playerModel.LightingEnabled = true;
           m_playerModel.DrawProperties |= DrawProperties.Shadowing;

As for the lighting i've used the exact lights you have setup in the CharacterDemo.

But right now i'm trying to just a single white directional light.

            directionalLight2 = scene.CreateDirectionalLight();
            directionalLight2.DiffuseColor = Color.White
            directionalLight2.ShadowCameraPosition = new Vector3(0, 512, 0);

I've also tried setting LightingEnabled to false and that doesn't work either.

Thanks Adam
Sep 18, 2008 at 9:06 PM
Edited Sep 18, 2008 at 9:09 PM
If it helps I'll see if I can get some screenshots posted sometime in the next few days.  Also on another note the player has 2 different textures, the bug may be related to that?

Also while we are talking about rendering skinned models.  Do you think its possible to open up the ability to specify a FaceMode for each model?

Example:
    m_playerModel.FaceMode = FaceMode.AllFaces;

Sep 22, 2008 at 1:27 AM
Heres the screen shots

In Game:

http://www.allgamedevelopment.com/Pictures/InGame.JPG

In Viewer

http://www.allgamedevelopment.com/Pictures/InViewer.JPG

Thanks again for all your help
Adam
Coordinator
Sep 23, 2008 at 1:53 AM
Edited Sep 23, 2008 at 1:55 AM
Hi Adam!

I'd bet that it's the fact that the ambient light values are different between the programs. The default ambient light value in the XNAnimation viewer is [0.1f, 0.1f, 0.1f] whereas the ambient light value in CharacterDemo is Color.DarkGray.ToVector3() (which comes out to approximately [0.6f, 0.6f, 0.6f]. Try changing the ambient light value in your program to new Color(new Vector3(0.1f)).

When you find discrepancies like this, always compare the values to what's in the XNAnimation viewer's code.

If this doesn't fix the issue, then please await the new build :)
Coordinator
Sep 23, 2008 at 2:13 AM
Oh, also that lack of a setter for FaceMode was an oversight. It's been addressed :)
Sep 23, 2008 at 5:01 AM
"I'd bet that it's the fact that the ambient light values are different between the programs. The default ambient light value in the XNAnimation viewer is [0.1f, 0.1f, 0.1f] whereas the ambient light value in CharacterDemo is Color.DarkGray.ToVector3() (which comes out to approximately [0.6f, 0.6f, 0.6f]. Try changing the ambient light value in your program to new Color(new Vector3(0.1f)).

When you find discrepancies like this, always compare the values to what's in the XNAnimation viewer's code.

If this doesn't fix the issue, then please await the new build :)"

-Sadly i've already tried this as well, when using this setting the character is almost fully grey, and the terrain is completely Black.


"Oh, also that lack of a setter for FaceMode was an oversight. It's been addressed :)"

-Thats awesome, thanks for updating that!  I made the change locally as well.

Thanks again
Adam
Coordinator
Sep 23, 2008 at 6:11 AM
Hmm...

Could you just send me the model so that I can try to figure out the problem on my local machine?

bryanedds@yahoo.com

Thanks!
Sep 25, 2008 at 3:09 AM
I just emailed it out, let me know if you have any issues with the file.

Thanks again, i'll keep looking at it locally.

Adam
Coordinator
Oct 8, 2008 at 11:37 PM
Hi again!

Sorry I went off for a bit. Had those pesky "real life issues" get in the way as usual :)

I tried loading your character but you didn't give me the fbx file. You want me to load it as a SkinnedModel, right? I did manage to load it as a normal Model and it looked fine. There are several ways to load a model in Ox - let me know which one you are trying and make sure I've got the same file that you're loading if I don't already :)

I did make some changes to the default DiffuseColor which may have helped your cause - but I'm still not sure. Download the new release and see what happens I guess :)