3Ds studio max, Xen, Panda

Feb 12, 2010 at 4:31 PM
Edited Feb 12, 2010 at 5:27 PM

Hello everyone,

I was wondering if anyone has managed to get the materials used in a 3ds max scene into Xen. I have tried using the Panda exporter and I think all possible combination of export options but it is not working correctly. What happens is that the structure of the mesh is exporterted flawlessly but the added material(created via the material editor) does not display correctly. I see a color on the mesh but no material. What approach should I have? I am currently using the tutorial 10, without any custom shaders, do I need that?

The 3ds file (3ds stuio max 9):


How a render should look like:


Any thoughts.

Edit: Also tried the kwxport plugin but with no luck, these come out as all white or I get error about:


Error    1    The default value for the effect parameter "Technique" is of type texture, but the texture file "C:\Users\name\Desktop\XNA\xen\xen\src\Tutorials\Content\Default" cannot be found.
Fragment identifier "Technique".    C:\Users\name\Desktop\XNA\xen\xen\src\Tutorials\Content\kwtest7.X    Tutorials

Feb 12, 2010 at 6:17 PM


Take a look at http://www.kwxport.org/

I succeed to use the diffuse and animations with this tool.

Feb 12, 2010 at 7:13 PM
Edited Feb 13, 2010 at 11:29 AM

Hi, tried kwport and well all it gives me is an error for having unaloved map(which is the diffuse channel). Is it better to somehow create a texture and use that? I am not a modeller myself but the programmer who has to make it work.

Any tips what you need to do, like adding a uvw modification and so on? How does integrated shaders in the .x file work?


Ok I have gotten some help to lighten the issue. Panda exporter can only export diffuse so all my materials can only be a diffuse map, dunno if I am allowed anything but the bitmap in 3ds max, haven't gotten that far. Then I realised that the shader is NOT exported with the panda exporter and therefore I used under

Material Editor -> DirectX Manager, check dx display of standard material and Save as .FX File.

Then I move that into the tutorial 10 folder I am currently trying to edit and add XenFX as Custom tool but I get error :



Warning    3    Custom tool warning: Unhandled exception in XenFX:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Xen.Graphics.ShaderSystem.CustomTool.Dom.ShaderBytes.ExtractBytes() in d:\system files\Group 44 XNA\xen test\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\Dom\ShaderBytes.cs:line 75
   at Xen.Graphics.ShaderSystem.CustomTool.Dom.ShaderBytes.Setup(IShaderDom shader) in d:\system files\Group 44 XNA\xen test\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\Dom\ShaderBytes.cs:line 36
   at Xen.Graphics.ShaderSystem.CustomTool.Dom.ShaderDom..ctor(SourceShader source, String techniqueName, Platform platform, CompileDirectives directives) in d:\system files\Group 44 XNA\xen test\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\Dom\ShaderDom.cs:line 77
   at Xen.Graphics.ShaderSystem.CustomTool.Dom.SourceDom..ctor(SourceShader shader, String baseNamespace, CodeDomProvider provider) in d:\system files\Group 44 XNA\xen test\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\Dom\Dom.cs:line 76
   at Xen.Graphics.ShaderSystem.CustomTool.ShaderCodeGenerator.GenerateCode(String inputFileName, String inputFileContent, String fileNameSpace, CodeDomProvider codeProvider) in d:\system files\Group 44 XNA\xen test\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\PluginEntry.cs:line 40    D:\system files\Group 44 XNA\xen test\xen\src\Tutorials\Tutorial 10\testis2.fx    1    1    Tutorials


Now I am trying to use ShaderFX to create a shader but that is a pritty advanced step so well, I want It too wooooooork :D. Please help me out!

Btw to get the texture working(my bitmap from the diffuse texture map I added to the material I have to import the same image to the content processor, is this really the way it is ment? I mean if I use something different than a bitmap as a diffuse map how will that be moved to my model? Is it the shader that does that together with the materialinformation in the .X file`?

Btw to get the texture into my model it does not go per automatic, instead I have to write:


			//load the model data into the model instance
            model.ModelData = manager.Load<Xen.Ex.Graphics.Content.ModelData>(@"test2");
            Texture2D text = manager.Load<Texture2D>("Chrysanthemum");
            model.ModelData.Meshes[0].Geometry[0].MaterialShader.TextureMap = text;


Why doesn't the tiny_4anim.x need a shader attached to it nor a texture?


Thanks for reading, if I get this to work I will be SOOOO happy!!!!


Edit: Been doing some researching and trial-and-error(mostly errors). Created a shader with shaderfx which I exported. I had to change the POSITION vairable and set it to a GLOBAL variable(for a pointlight). Code of how I load the model with shader below, am I doing it right? No errors(so the globals must be set at least, but still it does not have a diffrent effect.


 Tutorial_10.Abc.Complete shader = null;
		public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
			//load the model data into the model instance
            model.ModelData = manager.Load<Xen.Ex.Graphics.Content.ModelData>(@"panda2");
            Texture2D text = manager.Load<Texture2D>("Chrysanthemum");
            model.ModelData.Meshes[0].Geometry[0].MaterialShader.TextureMap = text;


            //It is recommended to use the draw state to get a shared static instance of the shader. 
            //Getting shader instances in this way is highly recommended for most shaders, as it reduces
            //memory usage and live object count. This will boost performance in large projects.
           // shader = state.GetShader<Tutorial_10.Abc.Complete>();
            shader = new Tutorial_10.Abc.Complete();

            state.SetShaderGlobal("light1Pos", lightpos);


            Vector3 color = (Color.Black).ToVector3();
            shader.SetUIColor_7895(ref color);
           // Testis




Feb 14, 2010 at 8:38 AM

Done some work now but things are not as I want them but still.

My first try was to use the tiny_4anim.x file. Save that material and then change it but even with the adding of lights nothing happens to it(might be the textures or other settings, tried useing Tutorial14 settings to at least get an effect but it did not even change color).

After that failure I read up on unwrapping uv and things like that so I :

unwraped my object in 3ds max
exported the uv map with TEXPORTER
Made some pictures on it so I would know :D
Then I open my model again, used a new material and as the diffuse map (under maps) I used a bitmap which I then choose the texture.
I then apply it to my model of cause and export with the kwxport plugin. I uncheck "export shader"(As I have come to an understanding that that will only reference a kwxport.fx file which I have to implement myself).
I then put the model file and texture in the content folder, change the model type to "Model xen". I then use tutorial 10 and change the name, and VOALLA it works :D

After reading I found:
1) Multi-Sub material
2) DirectX Shader material (preferred)
3) Standard Material

Are the only types allowed by the kwxport, and well DirectX Shader(material editor>get material>DirectX Shader. should work best, why? Because there you can choose from some pre-made shaders which will be
exported together with the texture and a map (like a fur map). I was going to test this but it come up all white, don't know why yet though.

If I try to use the XenFX tool to convert the shader to a compile version I get a shader error: "A shader technique may only define a single Pass", is this the way to go? Do I really have to use "XenFX" when the shader
is defined in the .x file?

So where am I? I need to know if I have to convert the shader, I mean it is not a "Custom" shader as it is the one IN the .x file?
What is defined as Multi-Sub material and Standard Material? What options can I change without having to have a shader in place?

I really hope someone can help me out, someone has to have already overcome these issues!


Feb 15, 2010 at 10:49 PM

If the generated .x file is using a multiple pass shader then it won't be directly supported by the in built material shader inside XenFX. You would have to implement it yourself as a custom shader, you could do that by removing each of the passes into its own technique and then drawing the model using each technique applying the relevant render state changes in the code and not in the FX file