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 2 plugin installed.
Start your Blender 2.6x.
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 set 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 horizontally 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. Make sure you are in Object Mode. Export is possible only in this mode. Click File\Export\Dark Exporter (bin)... 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 that were no materials in the generated E file. The Read from E file section is empty. As a consequence the EDITING E FILE section is also emtpy. It means that model doesn't have any materials applied (at least in my case). Although there was no material detected the model has been properly exported to win.bin file. In the last step it was also copied to the Thief's obj folder.
Let's make new materials. Create Wood material and change its Diffuse color to brown. In the Specular section choose Wardiso shader. It will be translated to FLAT shader in E file.
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. Select the Glass material and scroll down to Custom Properties. Add a new custom property and name it DBL:
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's 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. The Read from E file section displays materials read from the the generated E file. They are given in the following order: material name, spec shader, transparency, self-illumination and double-sidedness. The Blender materials section displays the parameters of the materials created in Blender. They are given in the following order: material name, an adhoc (3DS) material name, spec shader, texture name, texture image name, alpha-transparency, emit, custom property named DBL. The section EDITING E FILE shows the E file's line syntax that will be used to update materials in E file.
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.
And this is our textured model in Dark Engine Game Mode:
On this screenshot alpha-transparency is giving an illusion of mirror reflection.
Finished.