In this chapter I'm going to show you how to model a very simplified window. This is a step by step tutorial in which we'll use advanced material settings like double-sided attribute and alpha-transparency. I also show you how to read the logs displayed in Blender Console.
You can start modelling a window in a number of ways depending on how this window should look like. For demonstration purposes I've decided to create a window from a few distinct objects: a frame, an inner-cross and a plane that represents a glass.
I assume you already know the basics of Blender and you have Dark Exporter plugin installed.
Start your Blender. If you are using Dark Exporter 0.1.7 you should run it only in Blender 2.59.
We'll start from the standard cube so don't delete it. Rename it Frame. Change the name on the object and mesh level.Â
Remember to frequently save your .blend file. Let's call it win.blend. Save it to a folder of your choice.
The window's dimensions in Dromed should be 3x1x4, so we have to adapt X,Y,Z dimensions in Blender to the same values. Make sure the Transform panel is displayed (N key). Type the values like below:
Switch to Edit Mode (TAB) and delete front and back face to make a sort of frame. Select all four vertices of the front face and press X, then select faces. You should see the following object:
Add a Solidify modifier to your model. Adjust the slider called Thickness to some neat value. Note how your frame thinkness is affected on the fly. Make sure Offset value is -1.000. Once you're satisfied with the shape Apply the modifier. Applying the modifier will transform the modification into a mesh. You can also select the inner vertices and scale the edges along the X axis. You should then see the following object:
Switch back to Object Mode (TAB key) and create a new object in the middle of the frame. The 3D Cursor should still be in the coordinates 0,0,0. Name the new cube as VertPost. It will be a vertical post of the inner cross:
Scale down the VertPost object along X and Y axis to make it thin enough and then scale it up vertically:
Duplicate (SHIFT+D) the VertPost and name the copy HorizPost. Rotate it around Y axis 90 degrees. You'll get a cross. Now you have to scale duplicated part down a bit along the X axis to make it fit inside the frame:
The two posts are two distinct objects and they intersect in an improper way i.e the intersecting parts are coplanar. We have to scale the horizontal bar a little bit in X and Y to get the following shape:
This inner cross can be created also by dividing the vertical post and extruding the horizontal posts on both sides. For some of you it may even be easier and more natural approach. It's all up to you.
Let's create the last part of this object namely the glass. Create a new mesh and choose Plane. It will be created in the center of our window:
Rename the plane Glass on both object and mesh level.
Rotate Glass around X axis 90 degrees. Next scale it up vertically and horintally to fill the inner space of the frame. You should get the following shape of the window:
Remember to save your progress frequently.
Since our basic model is ready, let's try to export it via Dark Exporter. Click File\Export\Dark Exporter (bin)... The export process will fail. Note what's in the console (if you cannot see the console, enable it in the top menu Help\Toggle System Console):
The log says the four meshes have been found, but three of them don't have any materials. Let's make new materials.
In Blender select Frame object and switch to the Material Panel (on the right). This was our initial object so it already has a material named Material. It's a good practise to give materials more meaningful names. So change its name to Wood. You can also change the Diffuse color to brown if you want. In the Specular section choose Wardiso shader. It will be translated to FLAT shader in E file.
Select HorizPost and switch to its Material Panel. Let's assign to it the same Wood material. Do the same for VertPost object.
Select Glass object and create a new material named Glass. Change its Diffuse color to blue. In the Specular section of the material choose Phong shader. It will be translated to PHONG shader in E file. Scroll down to the Transparency section and enable it. Move the Alpha slider to set 0.624 or something around it:
There's one more thing we have to do with Glass. Since this object can be seen from both sides we have to make it double-sided. The plane is visible from both sides in Blender, but not in Dromed. First divide your workplace to see UV/Image Editor. Select Glass object and switch to the Edit Mode (TAB key). Select all four vertices (A key) and press U. It will display a context menu of UV unwrapping. Select Unwrap. It will create a UV map in the Image Editor window. We will assing textures later, so for now that's all we had to do. Being in Edit Mode open Object Data panel and check Two-side option:
Go back to Object Mode.
Our model should look like this now:
Let's try to export it again:
Everything is all right now. The win.bin file has been generated in the project folder and copied to the Thief obj subfolder. Note how Dark Exporter logs in the console all detected materials, shaders and transparency. Material Glass has been detected to have double-sided attribute.
Open win.E file with Notepad or any other text editor:
In line 4 the plugin signed the file to inform that it's been automatically edited. Note how materials section has been changed in terms of shaders, transparency and double-sided attribute.
Let's import the new model in Dromed. See how it looks like:
Since the shape of our basic window is done we can move on to texturing.
Texturing in Blender is very easy because it's outfitted with a great UV map editor. However texturing for Thief requires a workaround which I describe in chapter Texturing. The problem is Blender cannot display GIFs and PCXs in 3D viewport and Image Editor. These two graphic formats are the most commonly used for texturing models for Dark Engine. The workaround is simple: convert the GIF file to a new PNG file. If you want PCX then convert it to a new JPG file. Then use your converted JPG or PNG for texturing in Blender. During export via Dark Exporter all references to JPGs will be translated back to PCXs and PNGs to GIFs. Remember to copy only PCXs and GIFs to obj\txt subfolder of Thief installation.
There's one more thing I'd like to describe here. Typical UV mapping requires the material to have a named texture with UV mapping set in Texture Panel. You can omit this step if you want. Texture Panel is essential for rendering in Blender, but not for models created for Dark Engine. You only have to create materials for your model. Then you need to UV unwrap it with U key and load the image in UV/Image editor, adjust the mapping and that's all. You don't need to do anything in Texture Panel. Consider this as a sort of shortcut. It's always better to create models with separate textures.
And this is our textured model in Dark Engine Game Mode:
On this screenshot alpha-transparency is giving an illusion of mirror reflection.
Finished.