0

Unexpected skin behaviour

Anonymous 11 years ago updated by Fdjjj Duuree 3 years ago 23
This discussion was imported from CodePlex

saphua wrote at 2011-02-24 18:55:

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!


saphua wrote at 2011-02-25 09:52:

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!


objo wrote at 2011-02-25 11:23:

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!


saphua wrote at 2011-03-01 12:06:

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


objo wrote at 2011-03-02 19:50:

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