3D model which created on Blender is drawing without texture

The wrong transfer from the Blender. I am not a specialist in this program.
It is worth esteeming here.

To use Monogame Pipeline Tool from your project. Then all files will be written down in the project. (If model correct.)

First, you don’t have to include the texture file in the pipeline project. The .fbx ‘should’ include it automatically.
Exclude the png,Clean up the project , rebuild the model and check if it builds the texture xnb.
2) open the fbx in a text editor , if it’s binary reexport as ascii format. Search all references for the png. Some programs will put an absolute path to textures instead of relative to the fbx.

Can I rebuild model and texture out of project?

Additionally check if the vertex declaration in the model mesh contain UV (texture map) coordinates.

Pipeline project did not include texture automaticaly. What must I do next?

How can I do it??? Write full path to this value

So I’ve understood that monogame is not preferable for 3d games or even is not designed

Regular models with just texturing information will work.
You have to set the image mapping option in blender to uv set the image
cut the model before un-wraping it or ensure it works in blender in the preview window.

When exporting as well.

You have to click one of the path options at the bottom when you export.
This is with blender and you don’t convert it at all with that fbx tool at least i didn’t for the below.

It’s copy i think or relative path or something i forget. Ive hit everyone of them on 10 different models 10 different ways when exporting over the last few days of testing.

Here is a cube.fbx i made with blender that works you have to put the texture in content and load it in like you would a normal one for this.

Anything beyond that even multiple textures per model, weight info for bone meshes, ect … forget it.

Put a breakpoint right after the model loads and look thru the model instance. Or turn on your console in Visual Stuidio … project -> properties -> application -> output type (drop down button) call this right after you load the model.

Add this code to your game1 and look at the output.

        string msg = "";
        string space = "";
        public void PrintOutWhatsInTheModel(Model model)
            msg += "\n\n__________________\n";
            BasicModelBoneInfo(model.Root, 0);

        public void BasicModelBoneInfo(ModelBone b, int n)
            space = "";
            for (int i = 0; i < n; i++)
                space += "  ";
            msg += "\n" + space + "Bone: " + b.Name;
            if (b.Parent != null)
                msg += "" + space + " Parent: " + b.Parent.Name;
            if(b.Meshes.Count <1)
                msg += "\n" + space + "|_Meshes: None so no MeshParts either";
            foreach (var mm in b.Meshes)
                msg += "\n" + space + "|_Mesh: " + mm.Name;
                if (mm.MeshParts.Count > 0)
                    msg += "\n" + space + "|_MeshParts: " + mm.MeshParts.Count;
                    for(int i = 0; i < mm.MeshParts.Count;i++)
                        msg += "\n" + space + "|_MeshPart["+i+"]... primitive count:" + mm.MeshParts[i].PrimitiveCount;
                    msg += "\n" + space + "|_MeshParts: None";
                if (mm.Effects.Count > 0)
                    msg += "\n" + space + "|_Effects: " + mm.Effects.Count;
                    foreach(var emm in mm.Effects)
                        var te = emm.Parameters["Texture"];
                        if (te != null)
                            msg += "\n" + space + " : " + te.ToString();
                            var t = te.GetValueTexture2D();
                            if (t != null)
                                msg += "\n" + space + "       Texture: " + t.Name;
            if (b.Children.Count > 0)
                msg += "\n" + space + @"|_Children("+ b.Children.Count+")... ";
                msg += "\n" + space + @"|_No Children";
            foreach (var c in b.Children)
                BasicModelBoneInfo(c, n + 1);

There is One especiality that I use monodevelop on Linux instead Visual Studio on Windows.

I’ve been doing some testing today with the new Blender v2.8.
And it turns out that FBX export does not export data about the texture of the material.
I’ve tried every path option, and converted all the .fbx files with Autodesk FBX converter to ASCII human readable format to verify the results - none had any mention of the texture anywhere.
I’m not sure if its a 2.8 thing (they changed the way materials with textures work) or if its been like this for some time now - i think the last “good” version for FBX exporting was v2.68.
I’ll try some 2.7~ versions tomorrow to see if i can get them to export the texture references, but at this point (with 2.8 release right around the corner) it seems like i might just as well go back to 2.68 for exporting.
(Btw that cube model you posted also does not contain any texture references and placing the textures in pipeline with build or copy actions does not make any differences - no textures on model load (which makes sense since there’s no references to them in .fbx file))

1 Like

It looks like you tried to export an .FBX file with material that you created with Blender nodes editor.
This solely works for Blender Cycles.

If you want to export an .FBX file with textures you have to create a material without nodes and add baked Cycles textures as input (under “Texture” tab, “Influence” panel).

Have in mind that most Blender exporters do not support Cycles node based materials at all

Yes, because the version 2.80 does things differently, and you can’t get the texture on the material without the use of nodes (at least that is my understanding).

I’ve also now tried to export to .fbx with version 2.79 and that does seems to work - the texture reference is in the exported .fbx file and the content pipeline will pick up the texture file and convert it as well (for this to work the fbx was exported with Strip path option and the .png file was placed next to the .fbx file in the content directory), it all gets loaded by the .Load at runtime and it displays the texture IF i set the effect.Alpha = 1 (For some reason the alpha gets set to 0 sometime during the processing/loading, i’m still looking into this).

I’ve tracked the Alpha value issue down to Assimp importer material.Opacity value, which comes set to 0 (in OpenAssetImporter.Import() method).
I think it must be a bug in Assimp library when processing binary formated blender fbx exports.
Note: It only hapens with binary exported fbx files. When i convert the Blender’s binary fbx export into ascii format (using fbx converter 2013), it defines Opacity as 1 and the Assimp also correctly reads the value.
Alas we must use binary exported fbx since ASCII exported fbx files get the error message: Assimp.AssimpException: Error importing file: FBX-DOM unsupported, old format version.

So I did not understand which blender version is best for monogame.
And who can show tutorial how to create model with texture on blender and build it on Pipeline Tool?

There you go: http://community.monogame.net/t/how-to-export-process-load-and-draw-textured-model-from-blender-basic/
I’ll do a more Advanced version over the weekend.

1 Like

Umm… I’m going to ask a stupid question, but…

Did you try putting in effect.TextureEnabled = true; into your for loop dealing with effects?

protected override void Draw(GameTime gameTime)
            foreach (ModelMesh mesh in _model.Meshes)
                foreach (BasicEffect effect in mesh.Effects)
                    effect.View = viewMatrix;
                    effect.World = worldMatrix;
                    effect.Projection = projectionMatrix;
                    effect.TextureEnabled = true;

Yes I tried this yesterday. Texture is covering but repeating, whole texture covers each face

Hmm… I’m shooting in the dark (mainly due to not knowing much), but check your model’s UV map in Blender. I think that improperly unwrapped model can cause issues when rendering texture ingame.

Yes, I’ve already gotten it. It’s very difficult for me

There are a bunch of tutorials on you tube for texturing a cube most all of them require you to mark seems on the cube or sphere before unwrapping it.

Once you do that blender has another tool that will let you subdivide it down to a sphere.

If you just need a sky sphere specifically though i have class that will generate one programmatically. It will generate the uv’s proper to wrap a standard skybox texture onto it. It also generates the normals and can flip them as well for spheres or for a skysphere as well as finding the tangents. (from which you can find a binormal if you so desired from the normal and tangent, in order to apply a normal map to it, i do it on the shader though). It works by tessellating a cube so you can set the lod.