NOTE: this tutorial is obsolete now, Go here if you want better and easier result.
Hi all :jester:
this is my promised tutorial for rendering in Blender.
CHANGELOG:
27/05/2007 - A package with all the cars converted into .blend files is now available, click here to download it, and skip the third paragraph in the tutorial.
06/03/2007 - the tutorial is merged in one post, it's easier for me to edit it now (thanks to admins )
WARNINGS:
----------------------------------------------------------------
1. TUTORIAL OBJECTIVES
Hi all :jester:
this is my promised tutorial for rendering in Blender.
CHANGELOG:
27/05/2007 - A package with all the cars converted into .blend files is now available, click here to download it, and skip the third paragraph in the tutorial.
06/03/2007 - the tutorial is merged in one post, it's easier for me to edit it now (thanks to admins )
WARNINGS:
- I have doubts about alpha texture channel activation in this tutorial, I think I missed some steps. Just PM me if it's true
- This tutorial was written under 2.42a version of Blender, .obj importation within Blender 2.43 crashes, so the current best solution to import .obj file is to keep a 2.42a Blender installation for importing .obj files. 2.42a and 2.43 installed on the same computer work fine, there's no conflict if they don't share the same directories. Of course an ultimate solution consists to write only one script which imports cmx files directly into Blender and uses its interface...
----------------------------------------------------------------
- tutorial objectives
- prerequisites
- the import processus
- arranging the model
- First render
- Fixing problems
- High quality render
- Precision tweaks, advanced materials, scene environment
1. TUTORIAL OBJECTIVES
So you want to render your great skin(s) but you don't want to buy the very expensive 3dsmax+brazil (or illegally download it ) or simply want to use the cool free open source Blender software? You made a good choice2. PREREQUISITES
Blender and the rendering engine Yafray are powerful enough to get impressive results just like 3dsmax. They are powerful enough to make LFS renders anyway. So, in this tutorial I will try to be explicit enough to be understood by the true noob, however I highly recommend to be familiar with Blender and Yafray interface and functions.
I will not teach you anything how to manipulate image files; It's a Blender "how to" only.
Unfortunately, English is not my mother language, so I may do mistakes in this text. Feel free to send me private messages if I write something like a 2 year old child. Of course, this tutorial is not finished and will be enhanced. I'm opened to suggestions and questions
The software part: Of course you need:3. THE IMPORT PROCESSUSNote that I don't send direct links to the files, they can change without notice, and I want you to take the time to visit the sites and learn about what you are downloading.
- Blender 3D production software
- LFS CMX Viewer, which contains cmx file we will import in Blender
- Yafray rendering engine
- Tomdemuer's cmx2obj script (optional), which makes us able to import LFS cars in Blender. But if you choose to download the blend files package, you don't need this, and you can skip the third paragraph of the tutorial about the conversion processus.
- The .blend files package containing all the already converted cars if you have problem with conversion, or just not want to convert them.
The mental part: I said in the previous chapter that this tutorial can speak to true noobs, but in order to understand easier, I recommend to do "RTFM":I insist you should understand the Yafray's functions, since a good render calculation can take 1-2 hours. So be careful about it.
I know that Blender's interface is not intuitive, but it's not its goal. Keyboard shortcuts are used most of the time, and production is easy and fast. Only one thing to do to success: learn it. In my case I read the entire manual before creating my first models. Tutorials are not very helpful, it's more comfortable to know what we are talking about.
Now the interesting part. First of all, install Blender, Yafray and LFS viewer. It should not be difficult. Installation paths are not important, install them where you want.4. ARRANGING THE MODEL
Setup Blender
Execute Blender. If you are familiar with Blender and Yafray, skip this paragraph. If you run Blender for the first time, you should see a cube in the center of the weird interface. It's the default scene. Simply select the cube by clicking it with the right mouse button (sorry I lost this default scene I can't post a screenshot). The cube must be highlighted. Next press "Suppr" keyboard key to erase it. Confirm "erase selected object". Now the scene is empty. The final easy step, press "Ctrl+U" keys to save the scene as the user default scene which appear every time you start Blender.
The conversion script
Now we will use the Tomdemuer's script to convert cmx files to obj files. This is a script written in python language, a great language easy to learn and IMHO easier and better than basic. But you don't have to learn python. Since it's a python script, you need a python interpreter to run it. Fortunately Blender integrates an interpreter, we will use it. Open blender and open the "Text editor window" in "window type" selector.
Next open the script file (stored anywhere on your computer). And look at the parameters. This is the tricky part, first of all python language uses Unix style slashes for filepaths ("/" instead of micro$oft's "\") yeah python language is multi-platform. Now setup the lines:When all is OK, you can run the script by pressing "Alt+P" keys. Don't expect any reaction, just check if the files are correctly created. Note that the script convert one file only. Repeat the operations for each car you want to convert.
- filePath = enter the path where LFS viewer's "cmx" folder containing the cmx files is located, in other word, enter the "data" folder filepath, BECAUSE this script will locate the "cmx" folder automatically. Don't forget to enter the paths between " characters, and to enter "/" slashes instead of "\" anti-slashes.
- fileToLoad = enter the cmx file's filename you want to convert. If the file is called FZR - FZ50 GTR.cmx, then enter "FZR - FZ50 GTR" (the filename without the extension). In the script, there a line #fileToLoad = "FOX - Formula XR", it's only a comment line, it does not affect the script at all, you can erase it if you think it's useless for you.
- outputDir = the destination directory where the .obj and .mtl files will be stored after conversion. I personally like to create a dedicated folder for these files to avoid a mess.
- outputFileName = the .obj and .mtl filenames, enter what you want whithout the file extension.
Import the file
Ok now click "File>New", confirm "Erase all", and then "File>Import>Wavefront (.obj)"
Locate the converted file you want to import and click "Import a Wavefront OBJ" to open it. A new box appears, check the same buttons as the next screenshot:
Be careful: your mouse must not exit the box area, otherwise it will disappear and you must redo the import procedure . Yeah, it's boring me too.. Blender's interface weak point... Click OK and:
:woohoo:
Immediately save your .blend file.
Currently we have an basic model, it lacks of texture and material.
Now we will prepare the textures. The LFS models use dds texture images and one jpeg file (your skin). However, nor Blender or Yafray support .dds file format. So, do this boring operation:5. FIRST RENDER
Convert with your favorite image manipulation program all the .dds files located in "dds" folder of LFS Viewer or LFS the-game, to .tga files in a dedicated folder to be easily exploitable with Blender. Why .tga files? because:
So to keep good quality and alpha blending, .tga is IMO the best choice.
I can't tell you how to convert these files, personally, I use Photoshop with nvidia's dds plugin, and used a script to convert all the files in one operation. There's many other methods and many other softwares.
Next step is applying textures. Here are some basics commands:Now check if you are in "Object mode", "Shading" and "Material" buttons selected.
- select an object with right mouse button
- rotate the view by moving the mouse while mouse wheel button is pressed
- translate the view by moving the mouse while mouse wheel button and "Shift" key are pressed
Select a body part, the hood for example, and check if the material's name is "DEFAULT". We will apply your skin on the body. Click "Add new" button, replace "TE:Tex.001" by "TE:myskin". It's important to name the different elements to avoid confusions. Click on the "Texture button" just on the right of "Material button", or press "F6" key. We just entered in the texture definition panel, and are about to edit "myskin" texture. In "Texture type" rollout, select "Image", and in the just appeared panel, click on "Load image" button. It should not be difficult. Now located your skin, a .jpg file. Once your skin is loaded, you should see it in the preview panel. Ok the image texture is loaded, now it's time to apply it correctly on the body mesh. Return to the "Material" panel (press "F5" key), and select the "Map input" tab
Check "UV" Button to activate the correct texture coordinates, and enter the value "-1" in "sizeX" and "sizeY", because the conversion script invert all the UV texture coordinates.. I already tried to fix the problem but my coding skills are not enough powerful . Anyway it doesn't matter, we just want to render the car.
The body part is now textured, I suggest to separate it from the other parts since we can't directly see if a mesh is textured. So keep the body selected, press "m" key. A little box should appear with 20 little squares. Select the second and "OK". We just moved the body object into the second layer of the scene. If you want to make appear it back, toggle the second layer by clicking on it while pressing "shift" key.
The next is similar than the body mesh, except the loaded texture. Each part has its one (remember the .dds files you converted earlier) So select another part, and check the material's name. The body material's name was "DEFAULT", but the other parts material's name is the texture file's name it must use.
So in my example, if I select the roof of the LX4 in the 3D view, I see "MA:LX_interior1" in the material's name. OK I add a new texture, rename it "LX_interior1", edit it (by pressing "F6"), select "Image" in "Image type" rollout, and load "LX_interior1.tga". Next, is exactly the same than the body part, I return to "Material" (F5), check UV button, enter "-1" in "sizeX" and "sizeY", and finally move the mesh in the second layer. Great, if you understood everything until now, repeat the same operation for the remaining untextured parts, but Be Advised: some meshes can share the same material, don't reload a texture if everything is already done for this part (eg: seats, mirrors, interior parts), just move it in the second layer.
- About the "(null)" material: it's a pure black material, don't add a texture for it, just set the diffuse color to black.
- About windows and glass-equipped parts: these parts don"t need a texture, just move it in the second layer.
- About textures with alpha channel: click on "Use Alpha" button just above "Load image" button. I hope you saved alpha channel of your .tga files when you converted the .dds ones. What is Alpha? it defines transparency of the image texture. It is useful to see through holes of radiator grids for example.
Well, we are far to have all the conditions to make a great render, but I think now it would be interesting to see what we have done.6. FIXING PROBLEMS
What we will do now:Setup the lamp
- setup a lamp
- setup a camera
- setup the world
- setup the rendering engine
- surprise
We need to add a lamp to see something in the dark :dopey:, and to add shading to the model.
Click on the menu View>View properties. A box should appear in the 3D View. Setup the 3D cursor coordinates to X=0, Y=0, Z=10. check if the 3D cursor is actually 10m above the ground.
Next press "Numpad7" key to set the 3D View to "Top view". Now the conditions to add a lamp are good, the lamp will be added at the cursor position and in a ground-parallel orientation.
Click on Add>Lamp>Area. Setup the "Size", "Energy", and "Dist" values like the next screenshot:
The lamp is now set up
Setup the camera
Close the "View properties" box, click anywhere in the 3D View and click on Add>Camera. We need to see what the camera is watching. Right click on the bottom 3Dview border, select split areas, and click on the 3D view. A new window must appear.
Click on View>Camera on the new 3D view menu
Next press the "N" key to make appear the "Transform properties" box. The camera should be selected, next enter "RotX: 90", "RotY:0", "RotZ:0", in order to set the camera in a good basic position.
Setup the camera properties just like the above screenshot (lens, clipping and show).
Activate the transformation gizmo by clicking on the hand icon, and set the local mode on. You can translate and rotate the camera by click'n'drag on the gizmo axis. Try to get a correct cadrage (is this word correct?)
If you can't see the car in the camera view when the camera is pointed to it, adjust the clipping values, the car must be in the camera distance range.
Setup the world
Yafray uses the world color to create an ambient light. Click on the "Shading" button, then the "World" one, and set the left color to white. That's all!
Setup the rendering engine
Click on the scene button
- In the "Output tab, select "Render window" in the rollout, and toggle the spawn position to center.
- In the "Render tab", select "Yafray" rendering engine, unpress "OSA" button
- In the "Yafray" tab, unpress "xml" button, "auto AA" button, and set "AA passes" value to zero.
- In the Yafray GI tab, select "Full" method, "Low" quality, and press "Cache" button.
Now save your work (Ctrl+W)
Are you ready? press the big yellow button called "Render" in the "Render tab...
Surprise
:wtf2: :vomit:
Yeah it's ugly, Yafray doesn't seem to be powerful, but all the settings are low, and we don't need to make a 10 hours calculated render to see what is wrong with our model.
First of all, the most shocking is the tire colour, I don't like white tires, you too. Next there's a problem with rims, we must unify the rims element into one object with its own rim material.
We can see that there are some white parts, it's actually a texture problem, we can correct it easily.
Finally the glasses are not transparent.
We can conclude we still have a lot of work :yipee:
Fix the rims7. HIGH QUALITY RENDER
Select all the wheels and move them in the first layer (maintain "Shift" key to perform a multi-selection).
We need to separate the rim part from the tire part. Select a rim, enter in "Edit mode" (press "Tab" key), toggle "Face selection mode", and select all the faces that should be the rim.
There's several method to select:Rotate the view to check if you selected all the rim's faces. When done, press "P" key and confirm "Separate>Selected".
- the traditional right click, maintain shift for multi-selection
- press the "B" key once to activate the box selection method, it's the same than selecting files in explorer by clicking and draging a box over them.
- press the "B" key twice to activate the circle-zone selector (my favorite). Every face under it will be added to selection when you click. Right-click to exit this mode, and use the mousewheel to change the circle size, middle click to unselect.
Now the rim part is separated from tire part.
Repeat the same procedure for the other wheels and don't hesitate to move the finished parts in another layer.
We must define a new material for the rims. Select one rim part and activate "Material panel". Click on the small material selector icon on the left of material's name then click "Add new". Rename this new material to "Rims", change the diffuse color to a light grey one, and clear the image texture currently used.
The material is now set up, you need to select each rim parts in the 3D view, and use the material selector icon to choose the "Rims" material you created.
Fix the tires
Select a tire. In the "Material" tab, choose a very dark grey color for the diffuse color, and "multiply" in the "Texture blending mode" in the "Map to" tab.
Now we have dark grey tires, with the tire black sculptures only added.
Fix the white parts
Easy, open the concerned texture in your image editor. In my example, it is "LX_interior1.tga", and repaint the little black square's interior with a very dark grey color, not black, to keep better shading results.
Return to Blender, select one of the white part, press "F6" to edit its texture definition, and press the "Reload" button to refresh the texture in Blender. The texture preview shows now the black painted small square.
Fix the glasses
Select a window in 3D view, activate the "Material button".
In the "Mirror transp" tab, press "Ray mirror" and "Ray transp". Adjust "rayMir" value to 0.2, "frsOfs" value to 1, "IOR" to 1.
In the "Material tab, select a more realistic diffuse color for car glass, and a whate mirror color. Set Alpha value to 0.1. Admire the result in the preview panel.
Assign this material to all glass parts if your car is equipped.
Save your work and press "F12" key to render again:
OK it starts to look like a car.
Huh? you want to make a better looking render now? ok, configure rendering engine like this:
8. PRECISION TWEAKS, ADVANCED MATERIALS, SCENE ENVIRONMENT
Then select the area lamp, press "F5", and enter the "Samples" value to 3 in "Yafray: Shadow and Photons". If you have a multi-thread capable computer, set the number of thread you have in the "Render" tab.
Save your work, get you ready (and your computer) to a LONG render calculation. You are advised.
What are you waiting for to press the big yellow button?
-------------------------------------------------
:woohoo:
Press "F3" key to save your render image.
It's the most interesting chapter of rendering, now we touch "the art". That's the problem, it's an art. I can't teach you directly with this tutorial how to create a great render, actually I can't. I'm currently working on materials, lightning and scene environment to create my killer renders. In fact I think render techniques should be more personal than preformatted. You are free to do what you want, creating pure white scene for your car, a beach scene, a race scene, sunset scene in the desert, on the moon... You can also choose the material you want, modify the rims, the headlights, tail lights, car shape... But I'm not against the idea to create a thread in this forum to share your tips and tricks, your materials and scenes, many of us just want to see his skins in a render.Rendering with Blender Tutorial by Bogey Jammer