Unexpected skin behaviour

Feb 24, 2011 at 5:55 PM
Edited Feb 24, 2011 at 6:27 PM

Hello,

Disclaimer: First time user of Helix and complete 3D nubcake.

I am trying to load and display 3d models from a game called League of Legends. The models are stored as .skn files and the materials as .dds files. I found two tools that help me conver these to a .obj and a .jpg file.

After converting I can add them to a Expression Bled project and drop the .obj file in my workspace. I can then alter the create DiffuseMaterial to use a ImageBrush and get this result:

http://stuff.saphua.com/Temp/Helix/blend.jpg

Now I am trying to do the same using Helix using this simple method which loads and parses the .obj file and changes the Diffusematerial to use an ImageBrush with the .jpg file:

        private Model3D LoadFile(string objPath, string jpgPath)
        {
            BitmapImage bmp = new BitmapImage();
            bmp.BeginInit();
            bmp.UriSource = new Uri(jpgPath, UriKind.Relative);
            bmp.EndInit();

            Model3DGroup group = ModelImporter.Load(objPath);
            GeometryModel3D model = group.Children[0] as GeometryModel3D;
            MaterialGroup materialGroup = model.Material as MaterialGroup;
            DiffuseMaterial material = materialGroup.Children[0] as DiffuseMaterial;
            material.Brush = new ImageBrush(bmp);
            return group;
        }

However, this produces this result (face-sword?):

http://stuff.saphua.com/Temp/Helix/helix.jpg

What do I need to do to fix this?

Here are my source files (copyright League of Legends blah blah!)

http://stuff.saphua.com/Temp/Helix/model.jpg
http://stuff.saphua.com/Temp/Helix/model.obj

Thanks!

Feb 25, 2011 at 8:52 AM
Edited Feb 25, 2011 at 9:16 AM

Ok, I am one step further:

Apperantly when I flip the image vertically it works perfectly.

Now I need to figure out how to do this in Helix.

Edit: Applying a ScaleTransform to the Brush doesn't seem to change a thing.

Edit: Oh wait, it does work! Woohoo!

Coordinator
Feb 25, 2011 at 10:23 AM

there might be a bug in the obj importer - not sure if I tested it with texture coordinates - try to change the ObjReader.AddTexCoord method to

        private void AddTexCoord(string values)
        {
            double[] fields = Split(values);
            TexCoords.Add(new Point(fields[0], 1-fields[1]));
        }

let us know if this solves the problem!

Mar 1, 2011 at 11:06 AM

Yes that fixed it, although I'm not sure if my textures are upside down or if the code was 'upside down'.

Coordinator
Mar 2, 2011 at 6:50 PM

If it was correct in Blend I guess this was wrong in Helix toolkit. I will check with other obj files with texture coordinates.