Solved

DirectX File, beginner's question !

Posted on 2001-06-19
12
424 Views
Last Modified: 2013-12-26
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
Comment
Question by:LexZEUS
12 Comments
 
LVL 2

Expert Comment

by:cybermike3d
ID: 6211632
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
 
LVL 5

Author Comment

by:LexZEUS
ID: 6212677
>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
 
LVL 5

Author Comment

by:LexZEUS
ID: 6212750
The files (3ds, x, and texture) is sent to you ...
0
 

Expert Comment

by:Toyemann
ID: 6214852
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
 
LVL 2

Expert Comment

by:cybermike3d
ID: 6216784
ummm the texture map u sent me is grey ... without shading
0
 
LVL 2

Expert Comment

by:cybermike3d
ID: 6216799
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Author Comment

by:LexZEUS
ID: 6216819
> 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
 
LVL 5

Author Comment

by:LexZEUS
ID: 6216821
>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
 
LVL 2

Expert Comment

by:cybermike3d
ID: 6216865
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
 
LVL 2

Accepted Solution

by:
cybermike3d earned 200 total points
ID: 6216880
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
 
LVL 5

Author Comment

by:LexZEUS
ID: 6216958
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
 
LVL 2

Expert Comment

by:smitty1276
ID: 6223465
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now