• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

DirectX File, beginner's question !

Hi all ...
 
I create a space craft using 3DStudio Max4, it is a frame (group) which contain 3 main meshes : GUN, COCKPIT, BODYCRAFT. I group it together as CRAFT_GROUP.
I save it as *.3DS, then I export it into *.x files.
 
My question :
1. Using 3 tools (converter from MS-Dx 8.0 SDK, 3D Explorer, and 3D Viewer), all gave me wrong x files. One X file give a craft with wrong direction (the craft face down, the gun face up ...??), another give me craft without guns, and another giving me a "NICE AND COMPLETE" craft, but not in group anymore (CRAFT_GROUP is gone, replaced by 3 child meshes)... How to solve this problem ?? ?
 
2. Then, I create a simple space craft which all the thing embedded in one object (the gun, body and cockpit). Conversion is fine .. although now the space craft is facing up (craft.x) ... Now I tried to use it in Borland Delphi (WDirectX). Next strange behaviour occurs ... no texture ! The space craft is simply mono-color : grey, without shade. But when I see the craft.x using 3D Explorer or 3D Viewer, it has texture ! So who's fault ? I suspect my code is wrong, so I replace the craft.x with dolphin.x or car.x (taken from MS-DirectX 8.0 SDK), it works fine ! The car is green, the dolphin is silver ... So, where is my mistake ?
 
I read this from SDK :
 
SetRenderState( D3DRENDERSTATE_LIGHTING, DWord(TRUE))
Only works for vertices which include a vertex normal.
 
What that means ?
I keep making new space craft with different color, different texture bitmap, or even without texture ... all is displayed with no-shading grey color ...
 
I can e-mail my craft.x / craft.3ds if someone is insterested ...
 
 
rgds,
 
Alex
0
LexZEUS
Asked:
LexZEUS
1 Solution
 
cybermike3dCommented:
Make yr spacecraft out of three seperate meshes then export the meshes seperately.  Join up the meshes in your application ... there is a lot of dx8 that just does not work unless a very specific sequence of params are set up in a very specific order. .. Dont do any grouping or linking or any other funny.

U R quite welcome to email me the mesh ... to check out , along with the textures

mike@cybermike3d.co.za
0
 
LexZEUSAuthor Commented:
>Make yr spacecraft out of three seperate meshes then export the meshes seperately.  

See my 2'nd question ... the craft is no longer seperated mesh ... it is a simple craft with only 1 mesh ... but I will send the 3DS and the X to you .. just wait ...
0
 
LexZEUSAuthor Commented:
The files (3ds, x, and texture) is sent to you ...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ToyemannCommented:
Regarding your first question:

In my first attempt to convert 3ds to .x file, I ran into same problem.  Grouping doesn't really help.

After careful reading, I've found that you need to attach them as one mesh:

Under "Edit Mesh" modifier, there's a button called "Attach List" in the "Edit Geometric" panel.  Click it, select all the parts you want to attach together, and then confirm it by clicking the "Attach" button.  But before you attach them all, you need to trash the "MeshSmooth" modifiers, if any.  Once they are all attached, then you can re-use the "MeshSmooth" modifier.  One thing, though, don't forget to rename the new Mesh name.  (I always forget that.)


Regarding your second question:

I don't know much about Delphi, but these I know...

Are you using textures from the Material Library?  If so, I bet that's where the problem is.  Your program can't find the material you referred in the 3DSMAX.  I still haven't figure out how to export the Material Library to a bitmap file, and if I do, I'll let you know.

Meanwhile, why not just use the plain color texture or your own customized bitmap.  If you use the color texture, you never have to worry about a bitmap file.  And if you do use a bitmap, make sure it's in the same folder as your mesh file.


Hope that helps...

Best Regards,
-Toyemann
0
 
cybermike3dCommented:
ummm the texture map u sent me is grey ... without shading
0
 
cybermike3dCommented:
and the size is wrong it is 82 by 72 pixels. Dx8 textures have to be divisible by 2^n ie 64x64, 128x128, 256 x 256, 32 x 128 etc etc in order to work properly.
0
 
LexZEUSAuthor Commented:
> I've found that you need to attach them as one mesh:

No I cannot attach the mesh become one single mesh ... Then how to make the tank's head spinning while the body still facing to particular direction ?
Need to load both part as seperated x file ? I guess no.

>ummm the texture map u sent me is grey ... without shading

What do you mean without shading ?

Material material_1 {
 1.000000;1.000000;1.000000;1.000000;;
 24.251467;
 1.000000;1.000000;1.000000;;
 0.000000;0.000000;0.000000;;
}

Which one is the shading parameters ?

The X file I gave to you is "shaded" well in 3d Explorer and 3D viewer ...
0
 
LexZEUSAuthor Commented:
>and the size is wrong it is 82 by 72 pixels. Dx8 textures have to be divisible by 2^n ie 64x64, 128x128, 256 x 256, 32 x 128 etc etc in order to work properly.

Ok .. it even won't works without the craft.bmp ... the color still grey even though I edit :

Material material_1 {
1.000000;0.000000;0.000000;1.000000;;
...
}

Which is suppose to be red ...
0
 
cybermike3dCommented:
Firstly. the .BMP file u sent me is just plain grey ... there is no texture on it. Next, you can't just specify the material paramater and expect to get a red craft.  It just doesn't work. I wrote a little program which would enable me to set up the params for an object. You can see the screenshot at ..  
www.cybermike3d.co.za/1jet1.jpg
Unfortunately, it is in VB. But I suggest u do the same. Display the object with sliders for diffuse, ambient, specular, emissive, properties for both material and lights ... and be sure to specify the alpha's for all the above as 1. It doesn't help if you set up a light, and then wonder why it dont work, because the alpha it inhereted from max was 0 ... u wont see any lighting. Specify all the alphas as 1!

You have to set all the material and lighting params ... its all fine and well setting the material, but if the light is wrong, u r not going to get anywhere.

Maybe you should start off by making the emissive lighting of the material all 1. That way, it should glow in the dark so to speak. Then, when u specify a light, make sure the light isn't 'inside' the object. cos then it does all sorts of funnies.
0
 
cybermike3dCommented:
Firstly. the .BMP file u sent me is just plain grey ... there is no texture on it. Next, you can't just specify the material paramater and expect to get a red craft.  It just doesn't work. I wrote a little program which would enable me to set up the params for an object. You can see the screenshot at ..  
www.cybermike3d.co.za/1jet1.jpg
Unfortunately, it is in VB. But I suggest u do the same. Display the object with sliders for diffuse, ambient, specular, emissive, properties for both material and lights ... and be sure to specify the alpha's for all the above as 1. It doesn't help if you set up a light, and then wonder why it dont work, because the alpha it inhereted from max was 0 ... u wont see any lighting. Specify all the alphas as 1!

You have to set all the material and lighting params ... its all fine and well setting the material, but if the light is wrong, u r not going to get anywhere.

Maybe you should start off by making the emissive lighting of the material all 1. That way, it should glow in the dark so to speak. Then, when u specify a light, make sure the light isn't 'inside' the object. cos then it does all sorts of funnies.
0
 
LexZEUSAuthor Commented:
Hmmm ... that means ... every file I create using 3d Max, I have to convert it to X then manually changing the texture color in order to make them works ... a quite painful job is it ?

>Firstly. the .BMP file u sent me is just plain grey

The BMP is ok ... I put it as Dolphin.x's texture and the dolphin become grey ... then I put the dolphin and my craft at the same window (using the same DirectX container) ... it gives me different color ... and the dolphin still looks very pretty ... Actually the BMP is fine, since I can open it in paintbrush and color it with red, and the dolphin also become red, but not my craft ...
Ok, maybe I should try first what you've suggested to me ... make a simple application just to set the light parameter manually ... I will come back to you if that still doesn't work ..

rgds,

Alex

0
 
smitty1276Commented:
To be honest... the .3ds to .x file conversion util that comes with DX just DOESN'T WORK VERY WELL.  You'll find many, many complaints about it if you go to the forums on www.gamedev.net.

You would be better off spending the time just once to write your own mesh loader class and using it instead.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now