This is what I learned working the last week to create
DirectX models for use in
DarkBasic Pro. To begin, I could only make models that worked if you are use DirectX 9.0
I'm currently looking into other solutions to create models that work for DirectX 10. I used three free modeling tools available, Truespace 7.6, Wings3d 1.1.2, and Blender 2.4.9 for this.
The idea was to create an object that is uv mapped and textured with Light Baked textures to provide photo-realistic effects that render differently in game depending on the lighting conditions.
I started creating a terrain texture with
Truespace 7.6;
Here's some of the Truespace Widgets you'll be using to shape and modify your terrain...
You have to export your model in
Truespace 6.0 mode...
The DirectX Truespace Terrain Model would not load into the DirectX viewer, and it also crashed DBPro, so I exported a *.3ds model and a *.obj model and switched to attempt to get a DirectX model I could use that was created using
Wings 3d. I ended up importing the OBJ model into
Wings 3d, because
Wings 3d crashed when trying to parse the
Truespace 3ds model.
Also, DirectX doesn't like any models with more than 65000 Vertices. I deliberately created a large terrain model to see
how DBPro would handle the rendering in game...
Here I'm just shaping Terrain. Of all the 3d editors, I liked Wings 3d the best, and will end up using that the most in the future. The auto-rotate tool is awesome for getting a 360 look at your model, and picking out vertices to work on.
Above, is the first render, with a painted texture applied to the surface of the terrain. All the painted textures were created with Paint Shop Pro 8.0
Here above, I'm unwrapping a UV map, which will be used to apply pre-baked light textures...
Here's what the terrain looked like when I finished in
Wings 3d. Unfortunately, The
DirectX *.x model loaded using both DirectX 9.0 and DirectX 10.0, however the texture maps were not being included so I was ending up with a plain white object.
I exported the model in *.OBJ format as well as *.3ds format, and then switched to
Blender to see if I could get a functional DirectX model from
Blender. The *.OBJ model had problems, so I ended up importing the Wings 3d *.3DS model.
First I had to map the painted tile to a
Blender Texture.
Then I had to link the
Blender Texture to the
Blender Material.
Finally I exported the model to DirectX using a
Python 2.5.2 script. Yes, you are going to have to install Python on your system if you want to do this! Now the DirectX Model loaded again, But I still couldn't get the texture map to load. I went into the DirectX SDK documentation and took a look at how DirectX renders 3d models to get a better understanding of why these editors weren't creating good working models. I found my solution here;
It turns out that the path to the texture image file is being hardcoded into the Python DirectX export script, and it points to the wrong directory!!! When I dropped the painted terrain map into the same directory as the DirectX model and changed the Texture filename in the DirectX *.X file it correctly loaded the texture map and mapped it. The fully functional terrain model was now rendering good in the DirectX 9.0 viewer.
Time for some DBPro action!
Here's one of the first renders that worked using DarkBASIC Pro. The Terrain is a DirectX model finished in
Blender, and the trees are also DirectX models created using TreeMagik.
Here's a view looking down... You can see the baked UV rocks look really good... For some reason DarkBasic Pro offset the texture map about 15% along the Z axis when the *.X terrain model was imported into the game space, however this is something that can be fixed with a bit more coding...
Here's a night shot of the same terrain and forest. The framerate is a bit faster. The ambient light is set way down.
For the time being, I'll end up mostly using the Advanced Terrain Features of DarkBASIC Pro, mostly becuase it''s really easy to use, and faster than DirectX. I still want to create DirectX models for custom terrains, and for other objects though, as these will eventually be used for DarkGDK projects.
DarkGDK is slower, but much more powerful for being able to take advantage of all the features of DirectX and Visual C++
The answer is Yes, you can create DirectX models using the free 3d editing tools (Truespace, Wings 3d, & Blender), that are UV texture mapped, that are bump mapped, and that can be used in DarkBASIC Pro games!