Search This Blog

Showing posts with label CG. Show all posts
Showing posts with label CG. Show all posts

Saturday 24 April 2021

TO ADD DIFFERENT COLOURS TO EACH CUBE FACE.

 TO ADD DIFFERENT COLORS TO EACH CUBE FACE


Version : Blender version 2.79

Steps:
1. Open a new Blender file. You will find the default cube at the centre of the 3D axes.
2. Go to the Properties panel and then click on Materials button.Click on the + button to the right of the  box with a blue band. A blue colored band will shift one line below a grey colored default material icon.
3. Below the blue colored window, click on the button with a sign, "+ NEW". A preview window with Diffuse and Specular color settings will appear. Select a color, say, Red. Name the material as red.
4. Next go to the + button to the right of the blue colored band.Then click on "+ NEW" button another color and rename the material as, say, Yellow.
5. Repeat the process for four more colors.
6. To apply Red color to a face of the cube, select the Cube, go to edit, face select mode and select a face. In the properties panel, under materials, to the left of "+ NEW" button you will find a round disc icon with two arrows pointing up and down. Click on this button and select the Red color and click on assign. Red colour will be applied to the face selected.
7. Repeat these steps for another five colors.
8. You will see the different colors on the face of the Cube.

TO COPY AND PASTE KEY FRAMES

 TO COPY AND PASTE KEY FRAMES


Delete the Cube and add a Monkey. Go to frame one set up a key frame. Do changes in  location and rotation settings. Go to frame 125 and set up another keyframe. Now if you want to copy the key frame at frame 1 and paste it at frame 250 follow the following steps.

To copy/paste keyframes for the same object,go to the Dope sheet, press "A" key to de-select all action points (yellow squares). Then select the action points which corresponds to the key frame you want to copy by right clicking each action point while holding down the "Shift" key.Once you have selected all the desired points  press Ctrl+C to copy, go to the key frame where you want to paste then press Ctrl+V. Save the file.Run animation to check for the desired result.


Sunday 21 March 2021

TO SHIFT ORIGIN OF AN OBJECT TO ANY POINT

 

Origin of an object can be shifted  to any point on the object or outside it.

 

TO SHIFT ORIGIN OF AN OBJECT TO ANY POINT ON THE OBJECT

 Follow the steps given below:

1 Select the object and go to edit mode by pressing Tab key.

2. If all the vertices are selected, press  "A" key to de select all vertices.

3. Click on the desired vertex on which the Origin needs to be positioned and go to Mesh-> Snap->Cursor to selection.

4. Press Tab key to go to object mode. Now press Object->Transform-> Origin to 3D Cursor.

TO SHIFT ORIGIN OF AN OBJECT TO ANY POINT OUTSIDE THE OBJECT.

1. Let us consider a Cube for this example.

2. Select Cube and press Tab key to go to  Edit mode. 

3. Select all the vertices, including the ones hidden from your direct view.

4. Assume that we want the Origin to be 3 Blender units away from the geometric Centre of the cubes. Press G-> X-> 3 and hit Enter key.

 

Tuesday 23 February 2021

IMAGE BASED LIGHTING (IBL)

  This learning material for Image Based Lighting (IBL) is written as applicable to Blender Version 2.79b. Image based lighting setup  is done using cycles node, with render Engine set to Cycles. Download and keep an HDRI image ready for use as the background Image.


Now the steps are as follows:

1. Set up a basic scene with a Cube  as the main object and a plane below it to serve as the ground. Add material and texture to both the Cube and Plane using cycles nodes. 

2. Change the lamp to Sun and set  strength to 3. Rotate it to direct its light ray on to the Cube.

3. Set the Camera and hit  0 (zero) key in Number pad to go to camera view. Adjust its position and direction to get desires view. 

4. In the properties Panel in the right, select World settings. Go to surface panel and for Surface select Background. 

5. Split the 3D window into three windows. Two at the top and the third one below. The top left window may be used to see the rendered view(Shift+Z), the top right window to see the 3d view and the window opened below may be used as a Node editor. 

6. In the Node Editor window, select World  for World setting. 

7. Add three nodes -  Environment texture, Background node and World Output node from left to right. Connect Color in Environment Node to Color in Background Node and from Background   here to Surface in World Output Node. Now the background would turn to a pink Color in the Rendered view, which indicates that all your node setting are ready for IBL. 

8. In the Environment Texture Node go to Open File option and open the HDRI image file. Now you will be able to see the image on the HDRI image file as the background in your scene. To see the rendered scene, hit Shift+Z in the top left window which we had opened for seeing the rended output.

9. If you want see the rendered image in full screen, first click inside the top left window and then press Shift + Space Bar. To go back to previous view hit Shift+Space bar key again. It toggles between the two view modes.


Thursday 3 December 2020

ANIMATION

 ANIMATION-2

ADDITIONAL FEATURES


 Here we shall learn about some additional  features of animation in Blender. When we want to animate a character(say a Cube), apart from changing its location, its angle of rotation and size(scaling) can also be animated. Again combinations like location and rotation, location and size,rotation and size or all three location-rotation-scale can be varied. Further these changes can be effected on all three axes - X,Y and Z.
 Further not only the objects in Blender like the Cube, Cylinder,Cone, UVSphere can be animated, the Camera and Lights can also be animated .  Further, the different shades of colour of an object or the brightness level can also be animated.  
 If there are more than one object in the 3D Screen, when we animate, we must set key frames for each Object. Again when the movement of the object is complex, (when we make a robot to walk like a man) then the number of keyframes would also increase very fast. This can be a very daunting task. To simplify the keyframing process and to speed it up, we can use Auto keyframing.


BLENDER ANIMATION

 ANIMATION 1 -INTRO

The word "Animation" is derived from the word "Animate" , which means to make an object come alive or to move like a living being. Cartoon characters are a good example of animation where the characters are made to walk, jump,slide,laugh or do  any other motion.


ANIMATION CONCEPT

Let us understand the basic concept of animation. Look at the image of an arrow facing upwards in Fig-1. 


                                                      Fig-1


We want this arrow to smoothly turn to the horizontal position as shown in Fig-2.


 Fig-2

To animate this arrow, we draw images of the arrow at in-between positions as shown in Fig-3.


                                                                         Fig-3

 The whole set of image, from beginning to end,  would then be as shown below in Fig-4.



                                               Fig-4


When we animate these images the computer will generate images for all in-between positions and show all the images in  sequence. The arrow will appear to turn smoothly from Vertical to Horizontal position as shown in the video, whose link is given below:

https://drive.google.com/file/d/1krmBTsjkgH9fgMNc59FPzZn7MZxIsxkb/view?usp=sharing


 In animation, one basic idea we must know is that when a sequence of images are run quickly at a minimum rate of 24 images per second the human eye sees the image movement  as a continues movement. This   idea is used in all animation, videos and movies.

 In Blender each of this image, where some change is made, is called  a Keyframe. We must set the key frames in Blender. In the Arrow animation example we discussed above, we have set four keyframes.  When we animate, Blender generates all the intermediate frames.

Now we shall learn to animate a Cube in Blender. The steps are given below:

1. Open Blender and then a new file and add an object(Cube)  at x,y location(0,0) in the Top view(Press Numpad 7).
2. In the Timeline window as shown below, set the frame number to 1.


2. Position the cursor in 3D window and press "I" key. In the "Insert keyframe Menu" panel which opens, select "Location".

 


 

An yellow line will appear in the Timeline window which indicates that a key frame is inserted.



3. Next set the frame number to 125 in the Timeline window as shown below. 

 


In the 3D window move the cube to x,y location (5,5). Hit "I" key, then select Location in the "Insert Keyframe Menu" panel. An yellow line will appear in the time line window which indicates that a key frame is inserted at frame 125.




4. Next set the frame number to 250 in the Timeline window as shown below.

 


In the 3D window move the cube to x,y location (10,10). Hit "I" key, then select Location in the "Insert Keyframe Menu" panel. An yellow line will appear in the time line window which indicates that a key frame is inserted at frame 250.
5. Now set the frame number to 1 by pressing |<< key in the TimeLine window. This can also be done by entering 1 in the window as shown in the image above. To play the animation, press > key.
6. Save the Blender file.





Wednesday 25 November 2020

UNITS IN BLENDER

 UNITS IN BLENDER(Blender Version : 2.79b)

 Units of measure in  Blender are as default set as Blender units. When we open the default screen and then press "N" key to open the properties window where we can see the dimension of the default cube is 2 units along all X,Y and Z axis. These units are defined as Blender units which serves as a general  unit of measure to set dimensions of any object or to compare their dimensions.
 

 Measuring units in Blender can also be set as mm(millimetre), cm(centimetre), m(metre) or as inch, feet, yard etc. To set the units with these units, the procedure is as follows:

 In the Properties window click on the "scene" BUTTON.(the third button from the left). You will see the drop down panel with heading "Units" and the button marked "None" which  would be highlighted with Blue colour. Click on Metric. Now move to 3D window and make sure you have added an object(let us say a Cube). Now hit "N" key to open the panel which would display the location, scale and dimension of the cube. Under Dimension, enter 10cm for x,y, and z dimension. The background  grid would change accordingly and the unit as  cm will be displayed at the top left corner of the 3D window.

 If you select the option "Imperial", then you can set the unit as inches or feet.


Tuesday 24 November 2020

BOOLEAN MODIFIER

 BOOLEAN MODIFIER

 Boolean Modifier can be used to do the following three operations on an object- ie, union, intersect or difference.
 

  When we apply  an union operation then the end result is the combined shape of the two objects. Intersection is the the shape of the two objects where they commonly intersect. In case of difference, it the shape of the second object is removed from the first object. As an example if you consider a cube and a cylinder. when you do an union operation it will be the combined shape of the two objects. If you do intersection then it will be length of the cylinder which is intersecting with the cube will be the result. In case of difference the end result will be a cube in which the volume up to which the cylinder intersects with the cube is removed as if a hole is drilled in the cube body.

 To apply the Boolean Modifier, the steps are as follows: In the 3D window, add a Cube scale it 3 time along the X and Y axis. Add a cylinder and scale it 5 times along Z axis only.
To do the union operation, locate the Cube a convenient location, the position the cylinder on the Cube such that about 3 units length of the cylinder is inserted into the Cube.

 Now go to the Properties window and click on the spanner icon to open  the Add Modifier drop down menu. Click on "Add Modifier" . Under Generate heading,click on Boolean, under operation select Union. Select the Cube in the 3D panel, under Object click inside the window where you see an ink dropper icon. Select the cylinder. Then click on the Apply
button. Click on the cylinder to select it and drag it away. You will the Cube and cylinder joined as a single object.

 Follow the same procedure for intersect or difference. Corresponding to this operation the setting under "Operation" should be selected as Intersect or Difference.Then click on Apply. After the operation move the cylinder away to see the end result.

NOTE: When you are positioning the two object in the 3D window, under "View Port shading"  select wire frame. This will give wire frame view of both the objects.This view option is preferable over the solid view option.

 

Monday 23 November 2020

ARRAY MODIFIER

 TO CREATE MULTIPLE OBJECTS OF THE SAME TYPE(BLENDER 2.79b)

 If you want to create, let us say 10 cubes of the same size , placed side by side with some spacing between the cubes Array modifier can be used.
 

  First open the 3D window and a cube.To active the Array modifier, go to the Properties window and clip on the spanner icon.A window with a  heading "Add Modifier" will appear. It has a drop down menu with a number of modifier options. Under the Generate heading click on "Array" to open the Array modifier option. In the window which opens, set count to 10 and under the Relative option, against x axis set it to 1.1 . Then click on Apply button to create an Array of 10 cubes.

 You can try out different settings by varying the count setting, and offset settings. Similarly set the offset along Y or Z axis and  see the result.For more details on Array modifier, see some video tutorial on the subject.

 Once the array is created, go to edit mode and hit "P" key and then click on Separate  by loose parts. Then go to object mode,select all the cubes and click on Ctrl+Shift+Alt+C to move the origin to the centre of each cube. Now each cube can be moved separately. Before you did this, all the cubes would move together.

Array modifier can be used to create a row of cubes(any object), which we may define as 1X5 for a row of 5 cubes in one row. Two dimension layout of cubes can also be created, which we may define as 5x5 and three dimension can be defined as 5x5x5.

To create a 2D array of say 5x5, first create an array of 5 cubes. Select all the 5 cubes, again open Array modifier set the count to 5 and the offset against y axis as 1.1 and click on Apply button.

To create a 3D array, select all the 25 cubes created above, set count to 5 and the offset against Z axis to 1.1 and click on Apply button.



Wednesday 11 November 2020

COMMANDS FOR SPECIFIC TASKS

 12/11/2020

KEYBOARD/MOUSE COMMANDS FOR SPECIFIC TASKS

1. To insert a key frame while animating, set the location, rotation and scaling for the object as desired. In the Timeline window enter the frame number which you want to be key framed,then click in the 3D window  and press the I key to insert a keyframe. In the menu which appears, click on location,rotation,scale or any combination of these commands. A yellow line will appear in the Timeline window which indicates that a key frame is added.

2. To delete a key frame, select  the yellow line of the frame  desired, in the Time line window.Click in the 3D window, then hold down Alt key and click on I  key.

3. To select different short cuts for view,in object mode,  click on the view  on the control bar. A menu list will appear. Select the option desired.For example to get quad view hit Ctrl+Alt+Q.

4. To loop cut an object, go to edit mode (press Tab key), position the cursor on the edge where you want to make a loop cut, then press Ctrl+R. A pink line will appear. Drag it with the mouse and leave it where you want to make loop cut  and LMB. The pink line will change into yellow.

5. To add an edge between two vertices, select the vertices  and press F key. An edge will be added.

6. To create a face between three or more vertices, select the vertices and press F key. A face will be created between these vertices.

7. To select a circle on any object, go to edit mode. On the required circle, select an edge, then click on "Select" option  in the control bar near the edit mode button, then in the menu which appears click on Edge loop.

8. To unwrap a mesh,split the 3D window into two. Change one window to UV/Image editor window.  In 3D window,go to edit mode, select the complete object. All the vertices and edges should be selected.  The hit U key and then select  Smart UV project. The unwrapped mesh will will be displayed in the UV/Image Editor window.

9. To position an object at 0,0,0 location, select the object in object mode and then press Alt+G. To set the rotation of an object to  zero degree along all three axes-x,y &z.select the object in object mode and press Alt+R.

10. To apply a material to multiple objects. Assume that you have three object- A Cube an UVSphere and a Cylinder. Add a material to the Cube. To add the same material to the other two objects, select the UVSphere and the Cylinder and lastly the Cube,then click on object menu, then on  Make Link option and then on Materials option.


11. The same procedure as explained above(10 above) can be used to link animation data to different objects.

12. To move an object along the X,Y or Z axis: To move along the X axis, position the cursor on the Red arrow and click LMB and drag the Red arrow. The object will move in the X direction. Similarly to move an object along the Z axis, click on the Blue arrow, hold the LMB down and then drag up or down.

13. To scale an object along the X and Y axis, press S to scale then Shift+Z then  1.5 and hit Enter key. The object will be scaled 1.5 times its current size along the X and Y axis.


Thursday 29 October 2020

SCRIPT TO DELETE ALL OBJECTS IN 3D WINDOW

Script to delete all objects in 3D window:


import bpy


bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.delete(use_global=False)

BPY SCRIPT TO ADD A CUBE AND A MATERIAL TO IT

The following script can be used  to add  a cube and a material to it:

 

import bpy

bpy.ops.mesh.primitive_cube_add(location=(0,0,0))
obj_matl=bpy.data.materials.new("obj_clr")
obj_matl.diffuse_color=(1,0,0)
mesh=bpy.context.object.data
mesh.materials.append(obj_matl)

Friday 16 October 2020

GETTING YOUR FEET WET

 EDIT MODE

Open a new 3D window, change to front view by clicking on "1" key (in number pad), hit Shift+C to move the cursor to the 3D origin. Press Shift+A to add an object, then go to Mesh and then click on Cube. A cube object will be added. Press Tab key to go to edit mode, press "A" key to deselect all.

To select a vertex click RMB on it. If you  want to select another vertex also, hold the Shift key down and then keep the cursor on the second vertex and then press RMB.

If you want to select an edge, first click on the edge select button in the horizontal panel in the bottom.It is positioned to the right of the edit mode  button. Then position the cursor on the edge you want to select and press RMB.

TO select a face, first select the face select option then select the face in a similar way.



SAVING FILE IN BLENDER

In Blender, the file you are working on must be saved when ever some substantial change is done in your file. Blender DOES NOT auto-save your file. Choose the proper directory where your Blender files are saved. Blender files are saved with the extension ".blend".


DUPLICATING AN OBJECT

To duplicate an object, select the object in object mode, press Shift+D.Then move the mouse, the duplicated object will move in the direction of the mouse movement. Click LMB to confirm the location of the duplicate  object.


STEPS FOR PROPER WORK FLOW

When you want to create a simple object (like a metallic bowl)  or a more complex one,it is worthwhile to spend some time to plan your steps to achieve the desired result. Working as you think would not help you move forward in a focused manner. "Set a target . Achieve it" This would be a better approach.

 
Basic steps for a proper work flow are listed below. You may adapt it to your specific needs:

1. Make a pencil sketch of the model you want to create.
2. Think of the tools in Blender which you would use to design your model.
3. Create the mesh of your model.
4. Add material.
5. Add texture..
6. Add light.
7. Set world horizon colour, if you want.
8. Position camera to get a good view of your model.
9. Render the image.
10.Save results.


CAMERA VIEW

If you want to set the camera position to a desired view which you have already got on your 3D screen, press Ctrl+Alt+0 (Zero key on Number pad).

 

EXTRUDING IN BLENDER

To extrude a set of vertices, select them using Box select option, then press "E" key then "z" key to extrude along z axis. Once you have extruded to desired length, click LMB to confirm.


Wednesday 14 October 2020

EDIT MODE IN BLENDER

 14/10/2020

EDIT MODE

An object in Blender in the edit mode is defined by its vertices, edges and faces. If we consider a square plane, it has four vertices at the four corners,four lines(called as edges in Blender) connecting these four vertices and a  surface (called face in Blender) which stretches between the four edges.

Similarly if we consider a Cube it has 8 vertices, 12 edges and 6 faces. These details of the plane and cube are shown in the image below:





An UVSphere in edit mode would like this:




Thus we may conclude that all objects are constructed using vertices,edges and faces. The same  process is used for making both simple mesh like a cube or to construct more complex shapes which may go up to construct a human body shape or a complex machine part like a bolt, a gear wheel.

A bolt in mesh mode is shown below:



WORKING IN EDIT MODE

To work in edit mode, first open a 3D window in Blender, and add an object like a Cube.Hit Tab key go to edit mode.In edit mode you will see all the vertices,edges and faces. When these vertices,edges and faces are not selected they would appear in black colour. Hit "A" key to select all. Now you will see all the vertices,edges and faces in yellow colour.
You can toggle "A" key to select/deselect all objects in the 3D window.

In edit mode we can work with vertices, edges and faces in a detailed manner to design  any desired shape. A number of tools are available to work in edit mode.

Look at the image below which shows the horizontal panel in edit mode. To the right of the button marked "Global" you will see four square buttons. The first one has a point(vertex) in orange colour, clicking on this enables vertex-select mode. The second button has a vertical line(edge) in orange colour,clicking on which will enable edge select mode, similarly the third button  is used to enable face select mode. The fourth button shows four vertices and edges in the foreground and four vertices  in the background. This button,when clicked on, enables selection of vertices in both foreground and background.



Another way to select  a particular set of vertices and edges is to use the Box or Circle mode, which is activated by pressing "B" or "C" key. This method  is explained earlier under the sub-head "SELECTING OBJECTS".

Once one or more vertex/edge are selected we can delete them,move(translate) them or extrude them or rotate them to create a modified mesh.

After we finish our work in edit mode the modified mesh can be seen as an object in the  object mode(Press Tab key).

TOOL PANEL

Both in object mode and edit mode the Tool panel can be activated by pressing "T" key with the cursor within the 3D window. The Tool panel will be positioned along the left side of the 3D window. Different operations like translate, rotate, extrude and delete can be applied to the object selected in either mode. Side tab with label "Tools", "Create", "Relations, "Animation" are also shown.You may explore using these tools one by one.

NOTE: In Blender, it may be noted that there is always more than one way to do any operation like adding an object,editing, translating,rotating or scaling it.









TO MIRROR ARMATURE BONES ON X AXIS 1. Assume that we are making a human rig in standing position. 2. Set the view to front view. 3. Create t...