No announcement yet.

How to load model with textures?

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to load model with textures?

    I created a model in 3D Max, textures attached to the four walls and exported in FBX format. Then converted a through wave converter. I don't have textures, only model. Rendered it in wave engine, but it has no model materials (textures). How to load the materials specified in 3d max?

  • #2
    Here's a sample code to load texture to model
    Entity a= new Entity("a")
    .AddComponent(new Transform3D() { Position = new Vector3(0, -8, 0) })
    .AddComponent(new Model("Content/Models/fern.wpk")) // Set Model
    .AddComponent(new MaterialsMap(new BasicMaterial("Content/Textures/FernTexture.wpk"))) // Set Texture to a model
    .AddComponent(new ModelRenderer());


    • #3
      How to show model if there are already defined two textures, for example? First polygon - a texture, second polygone - other texture?


      • #4
        Hi rejjin,

        Using the following code you will assign two materials to the same model:

        // create materials map.
        Dictionary materialsMap = new Dictionary();
        materialsMap.Add("objectA", new BasicMaterial("Content/AwesomeTexture_A.wpk"));
        materialsMap.Add("objectB", new BasicMaterial("Content/AwesomeTexture_B.wpk"));
        Entity awesomeModel = new Entity("AwesomeModel")
        .AddComponent(new Transform3D() { Position = new Vector3(0, -8, 0) })
        .AddComponent(new Model("Content/Models/AwesomeModel.wpk"))
        .AddComponent(new MaterialsMap(materialsMap)) 
        .AddComponent(new ModelRenderer());
        If you pass a dictionary to the MaterialsMap constructor, each dictionary entry will be assigned to a object inside the model with a name equals to the dictionary entry key.
        In the example, the "AwesomeModel.wpk" has two objects, named "objectA" and "objectB". The MaterialsMap will assign a material to each object:
        - objectA : new BasicMaterial("Content/AwesomeTexture_A.wpk")
        - objectB : new BasicMaterial("Content/AwesomeTexture_B.wpk")

        Best regards,
        David Ávila


        • #5
          Very nice! Thanks!


          • #6

            I'm just starting out and would like to say good job and thanks for the work. I have been playing around a bit and engine looks cool.

            I'm sorry I have to rant about this. This feature kinda sucks .

            Just wanted to tell you that many developers work with multi-sub materials.

            Separating materials in to objects may be okay at the end, its often not ideal or desired because the work flow sucks. Its not bad in SI, because one can select multiple object and edit them as if it were one. In Max, put on a modifier and it half-ass works. Everywhere else its a time suck to edit multiple objects or joining and separating you assets. Later making sure you exported the assets with correct name that map to the code.

            I recommend using the names of material_clusters instead of objects and breaking them up during the export process in the Export Manager. Fewer problems by accidentally moving a component. All of the DCC's have this feature and a standard game-dev practice. Maya, Houdini, Blender, SI use names for clusters. 3DsMax uses IDs and names. I'm sure it I'm not the only one who would be a welcome the change.

            A. Kalugin
            Last edited by akalugin; 09-26-2014, 08:34 PM.


            • #7
              And for me not working why do you explain bad BasisMaterial, MyMaterial are not existing in WaveEngine 2.4 Please explain how do I get Material. I see bad because you explain ugly in Moddb :/ Please remove and clean please explain step to step


              • #8
                Hi SourceSkyBoxer

                You have to know that this is a 3 years old topic. WaveEngine has evolved during since then and some features have been changed and improved

                Here you have some articles about Materials in WaveEngine:

                And some recipes for easing your work:

                You can take a look out samples git page:

                Today the documentation page is down, but it will be available soon again.



                • #9
                  Ops sorry my dear jfernandez, you're right. I am sorry for wrong date. I will learn again. I will check github
                  PS: mono-jit and waveengine under Ubuntu works fine 100 % Congratulation - But for Mac OS and Windows won't work with mono-jit so sadly. I will be careful if old date than I never write here.... just I need create new topic. THANKS!