Computer graphics Labs: Blender (2/4) SketchUp model importation

Transcription

Computer graphics Labs: Blender (2/4) SketchUp model importation
Computer graphics Labs: Blender (2/4)
SketchUp model importation and
animation
University of Liège –Department of Aerospace and Mechanical engineering
Designed with Blender 2.66 and SketchUp 8
From SketchUp to Blender
SketchUp model prerequisite (optional)
Before exporting a SketchUp model, two things need to be checked:
Firstly, importing SketchUp ‘components’ into Blender is not possible at the moment.
Therefore components included in the SketchUp model should be burst before
exporting. To be sure there are no more components in the scene, select all objects
[ctrl-a] and make sure the ‘burst’ option is not available anymore in the context menu
(right click). If it is not the case, burst the model as many times as possible.
Secondly, because faces are duplicated when exporting, it is needed, whenever
possible, to make sure the same colour (or texture) is applied to both faces.
Alternatively, do not apply any colour on the non visible face where the default colour
should be kept.
Exporting the model (optional)
The SketchUp model is then exported to (File->Export->3D Model…) in COLLADA format.
A ‘.dae’ file is then created and possibly accompanied by a folder named the same. This
folder contains the textures that were used in the SketchUp model. It is crucial to keep it with
the file for Blender to be able to import these textures.
The export result is gathered the archive folder piece.zip (available on the class web page)
that include the file piece.dae.
Importing the model
For importing the COLLADA model into Blender:
1. Unzip the archive piece.zip into your working folder.
2. Launch Blender and erase [x] the default cube.
3. In the File Menu, choose: Import->COLLADA (.dae).
4. Then navigate up to the file piece.dae, select it and click on ‘Import COLLADA’.
Adaptating the model for a Blender Render
Scaling
Importing into Blender a model created in SketchUp
sometimes generates a model whose dimensions are illsuited to Blender. This normally does not occur with the
file piece.dar. Yet, if the object dimensions grandly
exceed the camera lens, it is better to scale it in order to
prevent further problems.
1. The ‘Outliner’ allows the display of all the objects
contained in the file. The resulting situation is
presented in the adjacent illustration.
The ‘Outliner’ allows the rapid identification of
the objects that have been imported from the
SketchUp model.
2. To carry out a multiple selection in the ‘Outliner’,
click right on the object you want to be added to
the selection and choose ‘select’. This way you can
2
select all objects whose names are beginning with ‘SkecthUp’.
3. Then move the mouse cursor in the 3D window. Click [s] to activate the scaling mode
and click ‘0.1’ (the scaling factor) and then click [Enter] to validate.
Adding camera and lamps
1. Switch to the wire mode by clicking [z] and switch to orthogonal projection by
clicking [5].
2. Move the default camera and the lamp; add an additional lamp to get the following
situation:
Top view
Front view
3. Activate ‘Ray Shadow’ for the lamp you just have created to cast shadows. This
option is available in the tab ‘Shadow’ from the panel ‘Object Data’
in the
Properties window.
4. Select the camera and switch to the panel ‘Object Data’
of your camera.
o To have a bigger part of the scene visible in the render, adjust the parameter
‘Focal Length’ in the tab ‘Lens’.
5. If you want to launch a render now, you will see a result of bad quality and noised.
This is caused by the duplicated SketchUp-imported faces that are disturbing Blender
shadows render calculations.
3
Erasing Face Duplications
Face duplications are caused by SketchUp creating, for all surfaces, a front and a rear face.
This allows SketchUp to apply a different material on each face of the surface. Two cases are
possible:
Either the material is applied on both faces. In this case, vertices can be deleted from
either faces (‘Remove Double’).
Or it was not possible to apply the same material on both faces. It is thus needed to
select the material and to erase vertices corresponding to default SketchUp materials.
Identical Materials
In the SketchUp model provided for this session, so is it with walls, floor and ceiling.
In order to delete superfluous vertices from these objects, follow these steps:
1. Select the object and switch in ‘Edit Mode’ [Tab].
2. Select all vertices [a].
3. Click on ‘Remove Doubles’ under ‘Remove’ from the left panel in the view window.
4. In order to correct the normals, click ‘Recalculate’ under ‘Normals’.
Follow these four steps for each object: floor, ceiling and walls.
Different Materials
Contrary to the walls, the faces of both cubes in the room are doubled and are ‘covered’ with
a different material on each face. It is the case when one of the faces was unreachable when
modelling under SketchUp. Knowing that the default (white) material is then applied on
internal vertices of the object, we will be able to select these vertices using their material to
erase these same vertices.
1. Select the object.
2. Switch to ‘Edit Mode’ and then make sure no mesh element is selected.
3. In the tab ‘Materials’
of the Properties window, you may see that the object is
linked to two materials. Select the white material in this tab.
4. Click on ‘Select’ in order to select vertices related to the white material.
5. Move again the mouse cursor in the 3D window and delete [x] the selected vertices.
Upon completion of these steps for both cubes, the render may be recalculated. It then should
not be noised anymore.
4
Animation Creation
Basic Camera Animation
We will now begin to create an animation, in which the camera will rotate on a vertical axis.
To this aim, we use the ‘Graph Editor’ that is located in the ‘Window Type’ menu on the
extreme left header of each window. This window allows visualizing the parameters evolution
of an object (position…) over time (time is represented by an image number). The curve
editor functions the same way as the 3D window:
Right clicking allows selecting a curve’s control dots.
Clicking and using the mouse wheel allows moving.
[ctrl+click mouse wheel] allows zooming.
[Home] adjust the window to all curves.
[g] allows moving the selected entity.
[ctrl+left click] allows adding dots to the curve.
For creating the animation:
1. Add a window (or take an existing window) and select ‘Graph Editor’ as a type.
2. Then select the camera and put it in its wished start position (in the direction of the
lamp that is situated to its left for example).
3. Then click [i] and select ‘Rotation’ in the popping menu. The result is the adding of
three curves to the rotation of the camera.
4. Then switch to image #100 by using the box indicating the current image in the
‘Timeline’ header window at the bottom of the screen.
5. Put the camera in its end position, for instance, with a 90° angle to right from the start
position in order to sweep the whole room.
6. Click again [i] and select ‘Rotation’ to insert a new dot in the curves editor. The
evolution curve of the rotation angle is automatically interpolated (by a default Bézier
curve).
7. It is now only left to define images for the start and the end of the animation. Get back
to the ‘Timeline’ window header and insert the index of the first (1) and last (100)
image respectively in the ‘Start’ and ‘End’ boxes.
8. That animation can now be tested by clicking [alt-a] or by using control buttons from
the ‘Timeline’ header window.
9. In order for the render not to be too long, set the output at 25% in the tab ‘Dimensions’
from the ‘Render’ panel .
10. Before launching the render, select the
output format of the animation in the tab
‘Output’ in the ‘Render’ panel from the
Properties window. By default, the
animation is saved as a series of images. To
get a video from it, AVI JPEG is to be
trusted most of the time.
o The file is put in the directory
specified under the tab title. Each format change needs a render to be effective.
11. Finally, click ‘Animation’ under the tab ‘Render’ located up the panel with the same
name or use the shortcut [Ctrl-F12].
5
Trajectory Follow-Up
Blender also allows defining an object trajectory (such as the camera) using a curve (for
example, a Bézier curve) directly defined in the 3D window.
Creating the trajectory
1. Select in the top view and insert a Bézier curve (Add->Curve->Bezier).
2. Switch to the ‘Edit Mode’ and modify it the obtained curve. It is allowed to add dots
to the curve by selecting one of its endpoints, then, while clicking [Ctrl], click left on
the location you want.
3. Exit the ‘Edit Mode’ and put the curve on the desired level; add then a new camera
(Add->Camera).
4. In order for the camera to follow the path we have just created, we will add a
constraint.
o Select the camera and activate the ‘Object Constraint’ panel
from the
Properties window.
o Click on ‘Add Constraint’ and select ‘Follow Path’ in the column
‘Relationship’.
o A new tab related to the constraint appears. In the field ‘Target’, select the
Bézier curve.
o Click the box ‘Follow Curve’ for the camera orientation to follow the curve.
o The tab ‘Forward’ informs of the
camera axis that will remain
tangent to the curve (and oriented
in the same direction as the
latter). Select ‘X’ or ‘-X’ for the
camera to remain perpendicular
to the curve or ‘-Z’ for the
camera to be tangent to the curve.
o Finally, the ‘Up’ tab informs of
the camera axis that will be
oriented upwards. Select ‘Y’.
If at this stage the camera is not located on the curve, switch to the visualization
window and activate the Properties panel [n]. Then, select the camera and define its
coordinates as 0 (position and rotation).
5. Likewise, it is now needed to define the position of the camera (on the curve) for at
least two images (key-images).
o Select the curve and activate the panel ‘Object Data’
.
o Switch to the tab ‘Path Animation’. The ‘Frame’ box value is, by default, set at
100. This box value represents the length of the curve. You may leave the
default value.
6
o The field ‘Evaluation Time’ informs of the camera’s current position on the
curve. This field value may vary between 0 (curve start) and the ‘Frame’ field
value (curve end).
 Set yourself at image 1 and set ‘Evaluation Time’ at 0.
 With the mouse cursor on the box ‘Evaluation Time’, click [i] to
introduce the first key-image.
 Then, set yourself at image 100 and set ‘Evaluation Time’ at 100 to set
the camera at the end of the curve.
 Click again [i] on the ‘Evaluation Time’ field in order to insert a second
key-image.
6. A curve has been added to the window ‘Graph Editor’. Only curves related to the
object selected in the 3D window are visible in this window.
o The default interpolation between key-images is a Bézier curve. In order to get
a linear interpolation, click [a] (sometimes you need to click twice) in order to
select all dots on the curve; then, in the menu ‘Key’ (‘Graph Editor’ window
header), choose ‘Interpolation Mode->Linear’.
7. Finally, in order to make the camera active, get back to the 3D visualization window
and select the camera. In the visualization window header, choose
‘View->Cameras->Set Active Object as Camera’.
o The animation can then be tested by switching to the Camera View [0] and by
clicking [alt-a]
o It is also possible to tilt the camera downwards while modifying the ‘Rotation’
value according to X in the tab ‘Transform’ in the Properties panel from the
Visualization window [n].
o If the result is satisfactory, then calculate the render [Ctrl-F12].
7

Documents pareils