Search This Blog

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.









Monday 12 October 2020

BASIC OPERATIONS IN BLENDER

13/10/2020

 

BLENDER WINDOWS ICON

The icon of  these main windows are as shown in the image below.

 BASIC OPERATION IN BLENDER

ADDING OR DELETING OBJECTS

Here we shall try to add some objects and delete them. Objects are some geometric figures like a Plane, Cube, Sphere, Cylinder, Cone etc.
To begin with, click (RMB) on the cube displayed in the middle of the 3D window. Once it is selected an orange coloured outline will appear around the Cube. Next hold down the Shift key and then  press X key. A window will appear with "OK ?" and Delete Shift X. Click on the blue button to delete the Cube.

This is the standard procedure to delete any object. Select the object by clicking the RMB, once the object is selected, press Shift+X and click on the blue button.

To add an object to the 3D window, click within   the 3D window. The 3D cursor will move to the point where you clicked(LMB). Try this out a few times. Next press Shift+A, you will see a list of objects like Plane,Cube, UVSphere, Cylinder  etc appear. Click on any object name and the object will be added to the 3D window.

Try out this procedure for adding a few more objects in the 3D screen.

At any point of time,  a list of all the objects in the 3D window will be shown in the Outliner window, which is  at the top right corner of the display.

To select  all the objects in the 3D window press "A " key. All the objects will have an orange outline around it. You may delete all the objects.



SELECTING OBJECTS.

To select a particular object, position the cursor on the object and click RMB. To select all objects hit "A" key. Two other ways to select objects are  Box select and Circle Select. To use box select, keep the cursor in the 3D window, hit "B" key. Hold the LMB and draw a box to enclose the objects you want to select. To use Circle select, in a similar way, hit "C" key. A circle will appear. Re-size it by scrolling the MMB(Middle Mouse Button) to enclose the desired objects, then click LMB.


DIFFERENT VIEWS

One way of classing view type is the direction from which you view an object. Here we normally talk about Top view,Front view and (Right) side view.To change to different views, use the Number pad keys. Hit 7 for top view, number 1 for front view and number 3 for side view.

Another way of classifying view type is as Orthographic and Perspective view.In Orthographic view, all objects  appear at the same scale,irrespective of distance or depth. A pair of  railway line would appear as two parallel lines. In perspective view ,objects at a distance appear smaller. It adds depth to the view. In perspective, as in real life, the railway lines may look like they are getting smaller and closer as we see, more farther away. To change between the two views use number key 5. It toggles between the two views.

The current view type is displayed at the top left corner of the 3D window.



BASIC BLENDER VOCABULARY

OBJECT

Any 2D, 3D geometric figure is called as an object. As mentioned earlier, Plane, Cube,UVSphere ..... all these are objects. Here Camera, Light  everything is an object. It is like a character in a play. You work on it to make it do what ever you want.

OBJECT AND EDIT MODE.

We normally work  with both objects and meshes. Consider a Cube. If we want to move  the Cube from point A to point B, we select it and drag it to where ever we want and leave it there. If you want to change the shape of the cube, either you want to change it into a rectangular cube, or you want to distort it into into an irregular shape, we will  work in the Edit mode.

Object and  Edit mode is displayed at the bottom of the 3D window as shown below.



 


To change between the the two modes , hit the Tab key. It toggles between the two modes.

CENTRE OF AN OBJECT

In Blender all objects have a geometric centre. Its location and angle of rotation is specified with reference to this  centre and the 3D origin.

3D AXES IN BLENDER

In Blender we work on any object in object or edit mode with respect to the geometric origin (0,0,0) for locating an object. Its angle of rotation is with respect to the x,y,z axis. These three axis are shown in Red, Green and Blue colour respectively.The orientation of the x,y and z axis at any instant is shown at the bottom left corner of the 3D window.

 

GRAB, ROTATE AND SCALE (G, R,S - Keyboard shortcut)

To move an object from point A to B, first select it by clicking on it with RMB. Next hit "G" key to grab it. Move the mouse. The object will move in the direction of the mouse movement. Where ever you want to position the object click  the LMB.  

To rotate an object, select it by clicking RMB. Hit "R" key to rotate. Rotate  the handle with double arrow heads by moving the mouse. The object will rotate. At the desired rotated angle, click the LMB.

 To Scale  an object, select it by clicking RMB. Hit "S" key to scale. Pull   the handle with double arrow heads. The object will scale up or down to grow bigger or smaller. At the desired size, click the LMB.

To move,Rotate or Scale an object, it can be done to a specified distance,angle or size.First select the object and hit G to grab the object.

To move an object by 3 units along X axis - hit x then 3 and Enter key.
To move an object by 3 units along Z axis - hit z then 3 and Enter key.

To rotate an object  90 degrees,around x axis,    hit R then X then 90 and then Enter key.
To rotate an object  120 degrees,around y axis ,hit R then Y then 120 and then Enter key.

To scale an object  2 units along x axis ,hit S then X then 2 and then Enter key.
To scale an object  3 units along z axis ,hit S then Z then 3 and then Enter key.

NOTE: In Blender, for any feature to be used, the cursor must be within the particular window. Let us say you want to move an object from point A to point B. Then the cursor should be first clicked within the  3D window.


NUMBER PANEL

 
When you are working with an object in 3D window, we can get access to the current position of the object with respect to the x,y,z axis. Further you can also access the object's angle of rotation with respect to the x,y,z axis, its scale and dimension in Blender units. To activate the Number panel, hit the N key.To close it, hit the N key again. It toggles between the display / hide mode for the Number panel.


BLENDER KEYBOARD SHORTCUTS AND MOUSE CLICKS

 
Blender has defined numerous key board shortcuts which would help us to speed up our work. We need to quickly learn and use such shortcuts regularly. A few of these shortcuts and mouse clicks are listed below.

- Object/Edit mode               Tab key (Toggle)
- Add object                          Shift+A
- Select/Deselect all objects A (Toggle)
- Grab an object                   G
- Scale object                        S
- Rotate object                      R
- Number panel                    N (Toggle)
- Tool panel                           T (Toggle)

MOUSE CLICKS

Left mouse button clicked               LMB

Right Mouse button  clicked           RMB

Middle mouse button clicked          MMB



Saturday 10 October 2020

INTRODUCTION

 BLENDER

    I am writing this blog to share the different aspects I come to know about Blender, as I use it, to explore and learn its various features.
   
Blender is a full featured free software package under the open GPL,which can be run on Windows, Linux or Mac Operating system.It is a 3D development package.
    The primary motivation to write this blog springs from my deep desire, to share the rich features of Blender with the young at heart and empower them to explore a wide range of opportunities to build their career in the CG field,while enjoying the whole learning process every single day. Blender may be learnt as  an hobby activity too, which would provides immense opportunities to explore your creative potentials.
     Blender  can be used for Modelling,Texturing,Rendering,Animation, Composting, Video editing and Game Development. Anybody interested in Computer Graphics can learn Blender which offers a rich set of tools which are comparable to the commercially available packages like Photo Shop , Maya and 3D Max.
      Blender has features to support  content development for the Advertisement industry, still/animated graphics for Websites, motion graphics, 2D/3D visualization of any product or data,character and scene development or Game Development.
     Development of Blender was started in 1988   by Ton Roosendaal as NeoGeo in Netherlands where it quickly grew up to become the largest animation studio. In 1995 this complete software was re-written which was the first version of Blender. From then it has under gone multiple revision and evolved to version 2.9 as on date.Blender Foundation is based at Netherlands which is the head quarters from where the basic development of Blender is done and coordinated. 
     Blender is supported by a wide community of users spread world wide, both novice and professionals and developed by the members of the Blender foundation and independent developers. Learning Blender at the entry level and advanced level is supported by a range of materials available on the web. Tutorials, Blogs, websites videos and interaction with other users in professional sharing networks like Github , Stackoverflow, reddit facilitate the learning process. Many popular websites provide online learning courses for Blender starting at the entry level and covering advanced levels. A quick search on the web would yield abundant results and open the door to you into a world of fun, excitement and  growth.
     This blog is based on Blender version 2.79b and it would touch upon Blender from different angles.However, the basic concepts you learn here would work in the earlier or later version of Blender like blender 2.83 or Blender 2.9, but for some minor variations.A few of the basic  modules  are listed below:
 
1  How to learn Blender ?
2. Downloading and installing Blender.
2a Hardware requirement.
3. Starting Blender, its opening screen and their description.
4. Basic Blender vocabulary.
5. Basic operations in Blender.
6. Basic keyboard shortcuts and Mouse operations.
7. Sample Blender files.
8. Use of a particular feature in Blender.
9. Blender Tips.
 

HOW TO LEARN BLENDER ?

    The basic mindset to learn Blender is to have a sense of curiosity and fun. Blender, today is a professional grade software. The opening screen of Blender would be daunting. You would feel that it is highly complicated and confusing.Its user interface has many windows,hundred of buttons and options with multiple levels of drop down menus and settings.A simple strategy to gain control in working with Blender is to enlarge your circle of learning, step by step,gradually. Biting more than you can chew at one go doesn't work. It may quickly turn you off.

   One additional approach to  learn and Master Blender is to have a "Never say die" attitude. What ever may be the level of difficulty, never give up. If you have failed a dozen times, still do not give up. Try again. Persistence only will pay. If you are faint hearted, this is not for you. Just quit. If you are read for the long haul and ready for an extended grind, a pot of gold awaits you at the end of the tunnel. So good luck ! Make a choice!
    Search for a way to understand and learn the particular task on hand. The first place to look for help is the web. Hundreds of tutorials and videos are there to help you find your way. As  you work your way forward, pause to think and analyze where you are erring. Blind effort is meaningless. Effort with focus and clarity in thought and action will speed up the learning process. A great strategy to speed up  learning Blender is to team up with like minded individuals with whom you can share your learning and queries. Form a collaborative network. This  approach would prove to be a win-win approach.  

      It is important to remember that hundreds of individuals on the web are ready to share and assist you in the learning process. All that you need to do is seek help and knowledge.

STARTING BLENDER AND ITS OPENING SCREEN

STARTING BLENDER

1. If you are working on Windows and have Blender installed, click on the Blender short cut on your Desktop,to launch Blender. The other approach would be to go to start->Program Menu  and click on the Blender icon.
2. If you are working on Linux,open the Terminal Emulator, change directory  to Blender version like 2.79 or 2.83 , depending on the version installed on your computer.Next enter "blender" and hit the Enter key in the command prompt.


OPENING SCREEN

    When you launch Blender, it opens with multiple  windows which are placed adjacent to each other on the  display screen.   

    The main working window  is in the centre, with an object like a cube or monkey placed in the middle.This is the 3D WINDOW .This is the largest window visible on the display screen. The opening screen will be displayed as shown below.


    On the right top corner is the OUTLINER WINDOW which lists the objects in the 3D window. When you launch Blender this window would show a list of a cube/monkey, a camera and a light.


 

   
Below the Outliner window is the PROPERTIES WINDOW which has multiple buttons, drop down menus and options. This window is basically used to set the material or texture of an object, edit object properties, set modifiers. When the object(Cube) in the 3D window is selected, buttons for Render, Render layer,Scene, World,Object,Constraints,Modifiers, Data,Particles and Physics are displayed in the Properties window. Hovering the cursor on any button would display its name, indicating its functionality.

 



  
 At the top is the INFORMATION WINDOW.It has links like File, Render,Help etc on the menu bar. This window  displays the codes generated for any blender operation you perform. 



 

  
 At the bottom is the TIME LINE WINDOW, which is used for animation.

 



    
As mentioned earlier these window as explained above are placed adjacent to each other. The line between two windows is the dividing line. Hovering the cursor on any dividing line would display a two sided arrow. Pulling the arrow head to  left/right or up/down would help resize  any of these windows.
























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...