A Guide to Computer Graphics Environment: Setting Up A Virtual 3D World
 |  SelfCAD University

Table of contents:
Difference between a Scene and a Viewport
Setting up your world
Restricting objects in 3D
How do we see things?
Image processing
Drawings
Camera Settings

 


 

Computer graphics is an art in which 3D designers and artists create images in a 3D space, and whose final product is a picture. That's why computer graphics can be defined as the rendering technology used for the manipulation and generation of images.

It is quite important to realize that the 3D world that they work in emulates the real world on many fronts. It is not only based on three-dimensional similarities between them, but also on how some of the imagery involved in computer graphics is similar to how we perceive the real world as humans.

It is therefore important for one to know the various elements of the computer graphics and have some knowledge of how to set up and operate its 3D world. This is a necessity for successful 3D modeling and designing.

In this article, we will look at the different aspects related to setting up a virtual 3D world in computer graphics and delve into how they emulate the real world. We will also focus on some of the functions of the camera and the best ways for setting it up for 2D and 3D image processing.

 

THE DIFFERENCE BETWEEN A SCENE AND A VIEWPORT

Scene is a workspace. It's a place where you will create all of your drawings, as well as rendering. You can think about it as a blackboard used in a classroom. In a similar fashion, a Viewport is a place where you will do all of your drawings.

At this point, it's important to point out the differences between them. 2D Graphics don't have Scenes, and the working area (the blackboard) is referred to as a Viewport.

Scene, on the other hand, is a default name given to the area in which 3D modelers design their 3D models.

This is a widely accepted distinction. However, there are still applications that use those terms interchangeably.

 

WHAT IS A SCENE?

Scene is a 3D modeling representation of the world in computer graphics, which in many aspects, emulates the real-world. 3D modelers place all of their models in the Scene, where they will modify and process them.

Demonstration of viewports in the scene

In 3D graphics, the size of your world depends solely on the number of objects in the scene and the distance between them. The more objects you add to it and the further away they are from each other, the bigger the scene will become.

 

WHAT IS A PLANE?

As explained above, the Scene is a place where you will add and modify your models. It can be confusing from a user perspective, especially if you are working with many different objects scattered all over it.

That is why we have Planes in 2D and 3D modeling. Firstly, we set up the plane, and then we place the objects onto it. From a user perspective, the plane appears as 2D, while the world is 3D.

 

SETTING UP YOUR WORLD

Try and visualize a plane, where there are many objects scattered all over. Many of these objects can be placed far away from each other. Something like an airplane which is visible in the sky, but is more than two miles away.

That is why SelfCAD forces you to set up the world first. It just makes things easier when working on a Plane (flat, 2D drawing area). Remember that although you are drawing and working on Planes, everything in your world is visible in 3D. SelfCAD just makes it easier for you to manage this environment.

Customizing our 3D environment

When we compare the world of 3D graphics to the real world, both can be measured using a real measurement system. In both environments, these measurements occur within the 3D space. Another important feature is that the Plane has boundaries that encompass the world in 3D graphics.

 

MEASUREMENT IN 3D COMPUTER GRAPHICS

In the real world, the GPS coordinate system is used as the 3D measurement system of choice. It is a kind of a spherical measuring system (the globe is practically a sphere) where 2D measurement is done using Latitude and Longitude. Elevation forms the third dimension.

3D modeling applications use the Cartesian coordinate system for measuring objects in the X, Y, and Z planes. The Cartesian system is well known as it is used for drawing and measurement in all schools. Rulers used to measure in 2D are also based on the Cartesian coordinate system. The grid we find on a plane is simply an extension of 2D measurement.

Measurements in 3D computer graphics

When measuring in computer graphics, it is important to use precision measurements.

 

HOW DO PLANES WORK IN COMPUTER GRAPHICS

In SelfCAD, you set up your planes by using the Workplace Settings found on the Settings drop-down menu. Once you activate the Workplace Settings, a panel is represented along the left side of the screen where you can configure your world.

  • Size: This is where you set up the size of your world. As the world is 3D, each of the dimensions is going to have the same size.
  • Segment size: This is where you set the size of the segments in the grid. When you view the grid, it consists of an arrangement of squares placed in rows and columns. The dimension of the squares is called the Segment Size. If you decrease the size of the segment, let's say from 50 to 20, the dimension of the squares decreases, but the size of your grid remains unchanged. You are left with more squares per grid, which results in a denser mesh.

 

Workspace settings


 

VIEWPORTS

The software starts with a single Viewport by default, which we will use for the rest of the article. You can, however, display more than one Viewport on the screen at the same time. It is ideal for advanced 3D modeling, where the designer wants to look at the same object from different perspectives. As an example, the designer set one port for the front view, one for a side view, and one for a top view.

Different viewports

 

PLANE SETTINGS

The default plane setting is a single floor plane. In other words, it is a flat plane without any height, but it is possible to have more than one plane visible in the Viewport.

To see the hidden planes, you’ll have to tick the Front/Back and Left/Right options. From the user’s point of view, the back will be closed while the front will be open. Similarly, the left will be closed, and the right will be open.

From a cosmetic point of view, you can customize the appearance of the different planes. This can be done by using different colors as well as changing their level of opacity.

 

ORIENTATION

We know that in the 2D world, the vertical plane is always denoted by the letter Y, while X is used to describe the horizontal plane. This is the acceptable standard in 2D. In 3D, however, even though we always have three planes, the letters used to describe them may vary between the platforms you are using.

The horizontal plane is always described using the letter X. When we consider the computer screen, the vertical plane is given the letter Y. The third dimension, which goes into the screen and gives us the illusion of depth, is given the letter Z.

Let's use a table as an example. The horizontal plane is named by the letter X, and as we move along the depth of the table, we move into the Y direction. So the X and Y correspond to the plane represented by the top surface of the table. If we look at the height of the table, we are focusing on the third dimension, which is represented by the letter Z.

Orientation in 3D space

As mentioned before, the difference in 3D graphics programs lies in the names of the Y and the Z direction, which are oftentimes reversed. It means that some computer systems will have Z referring to the vertical plane, and the letter Y referring to the depth of the model.

In the case of 3D printers, the height is always referred to by the letter Y. It is extremely important from the user’s perspective, as it allows to avoid any confusion. If you use a system where Z represents height, the 3D printing platform will automatically flip the axis around, so that Y will show as the height and Z as the vertical dimension.

 

RESTRICTING OBJECTS IN 3D GRAPHICS

Let us discuss the position of the object on the plane in the 3D graphics world. When we visualize the default plane (the floor), we're thinking about the horizontal plane represented by the X-axis. However, this plane is seen from the vertical position, represented by the Y-axis.

 

The Centre

The center of the planes has the coordinates of X=0, Y=0, and Z=0, which is common across most of the other coordinate systems. As a user, it is important to know how this central point relates to 3D. In 3D, the Centre is also referred to as a point of origin. It's a place where all three of the axes come together at a single point.

A good illustration is in the image below, where the cube is at the center of the workspace. (X=0, Y=0, and Z=0)

Position

 

Horizontal Movement

The system will restrict the movement of the objects to the limits defined when we set up the size of our world. Let’s say we used the size of 700. In this case, the object will be able to move 350 units to the left or 350 units to the right of the Centre. Similarly, it will be allowed to move by the same amount to the top or to the bottom of the Centre. Any attempt to move the object beyond those limits will result in the object snapping back to the edge of the plane.

Another aspect of the Vertical and Horizontal planes is that they can have both positive and negative values, which represent moving the object to the opposite sides on a single axis.

On the horizontal plane, the movement to the left of the Centre is considered negative, and move to the right is considered to be positive. Similarly, the movement to the back of the Centre is considered negative, and the move to the right is considered to be positive.

 

Vertical Movement

In the case of movement in the Vertical plane (the height), objects can only be moved above the Centre because the software will not allow you to move the object below the surface. It means that the lowest position on the Z-axis is 0, and every move above that will be considered to be positive. When you attempt to move the model below that, it will be snapped back to the surface.

 

WHY ADVANCED COMPUTER GRAPHICS TOOLS ARE NECESSARY FOR PLACING AND MOVING OBJECTS

In the previous paragraph, we've discussed that the movement of the object is limited to the size of the Workspace. We've explained that the basic transformations are not able to change the size of the Workspace, as the object will be immediately snapped back to the edge of the plane when you try to move it past it.

That's why we have advanced image processing tools. They are not restricted by those boundaries, and they allow us to process the images to give as a perception of the objects as they are in the real world. Otherwise, we would end up with objects flying around, or even falling out of the scene.

To prevent this from happening, those tools will adjust the size of the Workspace, and some of its other properties, when needed. This way, we will achieve a much more realistic view of the scene, as more objects are added and moved in the scene.

 

HOW DO WE SEE THINGS?

When we look at how we see things from the perspective of our brain, we will notice that most of the stimuli it reacts to come from our eyes. They relay a lot of pictorial information and do some basic image processing along the way.

How do we see things?

The brain does some image processing along the way when the eye looks at an image. Image source: slideshare

The goal of computer graphics is to generate realistic images on the screen. To do this, the software implements some of the processing functions of the human brain to emulate the way we perceive and eventually see images.

 

EMULATION OF BASIC IMAGE PROCESSING

We've said that the computer graphics try to emulate the processing functions of the human brain to make the generated image as realistic as possible. In this section, we will take a look at a few such concepts. The first one is known as the Vanishing Point.

 

Vanishing Point

So what exactly is the Vanishing Point?

It means that when you look at the scene, the object closest to you will appear the largest. The further away from you, the object is, the smaller it will appear to the eye until they eventually disappear in the distance. Hence the term, Vanishing Point. It is there, but you can't see it.

A good example to visualize the Vanishing Point is the set of train tracks. You know that their size is exactly the same, but those closest to you will look much bigger than those away. As you look further down, they will get smaller and closer. Eventually, the tracks at the horizon will become a single point and then disappear from sight.

 

Viewer Frustum

The Viewer Frustum is similar to the Vanishing point, but it looks at the Scene from the point of view of the camera. In essence, when we view an image from the lens of the camera, the area closest to it will appear larger and more detailed. As the objects are further away from the lens, they will appear smaller and less detailed, but the overall number of visible objects will increase.

Once again, we can use the image of the disappearing train track as an example to visualize the Viewer Frustum in computer graphics.

 

Lighting

Lighting is the third concept we will look at in our discussion about how computer graphics emulate the processing functions of the human brain.

The closer the object is to you, the lighter it will appear to be, and the further away it is, the darker it will appear. It is the transition from light to dark as you move further away from the object that is responsible for the perception of depth in the image.

 

Similar effects are added in the processing of the image. The gradient of the color gets darker as you move from one end of the image to the other. It allows us to create a reconstruction of what we call 2,5D image processing, which allows us to add the perception of depth based on the brightness of the color. With the change of the gradient of the color, certain parts of the image will appear to be closer or further away.

It is important to know that this kind of processing takes place only on a single plane. As a result, a 2,5D image cannot be rotated to give a 3D effect.

As a user, you do not need to worry about lighting when doing this type of image processing. The software will take care of the lighting automatically while doing the processing.

 

Projection

Projection is the last concept we will discuss in this section. Projection is a well-known concept not only in 3D graphics but also in drawings of 3D objects on paper. Let's take a model of a table as an example. To make it appear 3D in the drawing, you need to give it a perspective.

The same principle is used when we place a 3D object on the Workspace in SelfCAD or any other computer graphics platform. The object appears 3D on the computer screen because of its perspective. SelfCAD offers two modes for viewing 3D objects.

  1. Perspective – which is the preferred mode for viewing 3D objects.
  2. Orthographic – which is the mode you will use for doing 3D modeling.

Projection: Perspective mode vs Orthographic mode

Spacebar is a useful toggle that allows you to easily switch between the Perspective and Orthographic Mode while modeling.

 

DRAWINGS

Your Workspace is based on the Cartesian Coordinate System. Here, a Scene can have up to six planes, but as discussed previously, only three of them are available at the same time.

While Drawing, on the other hand, you are able to add more planes to the scene. Check out the video below to see how to add more planes to your Workspace.

In addition to the ability to add more planes, you are also able to customize their position by moving them up or down, as well as set their rotation. It is important because while Drawing, the plane serves as a surface for you to draw on.

 

Orthographic View

Let's take a look at the Orthographic view by using a Top to Bottom view of the plane as an example. Top to Bottom view allows you to observe the workspace from the bird's eye POV. If you would want to view the plane from the bottom up, you will have to switch the orientation to Bottom to Top.

To illustrate the Orthographic view, we will draw a rectangle using the Perspective mode. The edges of the rectangle are drawn in a way that covers the edges of the Workspace. Now, pay attention to what happens when the Plane is offset. You know that both of them have the same size, but because of the perspective, the Plane seems smaller than the drawn rectangle as it is further away from the camera. This offset we see in the perspective mode makes it difficult to work with precise measurements.

How perspective mode distorts the Size

 

Once you switch to the Orthographic mode, you will see that the plane, despite its offset, is still aligned to the drawn rectangle. From a user perspective, it allows you to draw copies of original shapes without worry about distorted measurements caused by the offset in the Perspective mode. This process can be made easier by selecting the Snap to Grid option in the Precision Settings.

You can notice the difference between those modes by looking at the Wireframe of the simple cube. In the orthographic view, the rectangles will appear identical to each other despite the distance between them. In the perspective mode, however, the rectangles will look like they differ in size.

This example allows you to see the effect of the distance on the size of the object (near-far view) when viewed in the perspective mode. In orthographic mode, however, this effect is lost.

 

CAMERA SETTINGS

Now we are going to have a look at some of the Camera Settings related to drawing objects on planes.

The default Camera mode is Rotate, which, as its name suggests, allows you to rotate the Plane using your mouse. It allows you to move the Plane around to view your design from different points of view.

It is also possible to change any of the default settings of the camera, such as its position or speed with which it will rotate. You will find the options to do that in the Settings drop-down in the Main Menu.

 

Camera Settings

 

Different Mouse Combinations

You can initiate several shortcuts using different combinations of mouse buttons. For example, keeping the mouse-wheel down and moving the mouse will result in moving the entire plane around. Turning the mouse-wheel by itself, on the other hand, will result in zooming in or out.

 

Locking the camera

There are moments when it's necessary to work on an object without having the plane move around. In SelfCAD, you can easily achieve this with the help of the Camera Lock setting.

 

Moving the plane and object back to its original position.

When you're lost, and you don't know which side is which, you can easily revert to the default camera position with the help of the Home Camera option.

 

ZOOMING INTO CERTAIN LOCATIONS ON AN OBJECT

In SelfCAD, you can zoom in to specific parts of the object. You can zoom to any location of the model, as long as the face faces the camera.

 

Zoom towards the mouse

When you zoom in, the camera will move closer to the plane itself. This movement depends on the location and the origin of the plane within the Scene. However, there is an option to zoom in to the position of the mouse. When selected, the position of the cursor will become the place towards which you will zoom in.

 

Looking inside an object

You can look into the object by continuing to zoom in through the surface until you pass it. This way, you can visualize a specific location of the object and view its surface from the inside.

 

Drawing on a Specific Face

In SelfCAD, you can draw shapes on existing models. To do so, you need to rotate the model so that the Face or Polygon you want to draw on faces the camera. Please note that when you rotate the object, the drawing will not rotate with it, unless both are selected.

 

Reshaping a Drawing

SelfCAD gives you an option to Reshape the drawings as well. To do it, you have to select the edges of the model that you want to reshape and use the tool under the same name. Based on the selected edges, the software will generate paths that can be reshaped into other shapes. When it comes to Reshape, the position of the camera has a vital role in the way the tool will work. Take a look at the following images to see the example.

When you Reshape the drawing while the face it lies on faces the camera, the overall shape will remain intact. But when you Reshape the drawing while the face does not face the camera, the geometry of the object will break.

 

How camera position influences reshape

 


 

Do you have any questions about the article? Have any thoughts that you'd like to share with others? Do you think something should be added or changed? Take part in the discussion in the thread dedicated to this article by clicking on the button down below!

Join the Conversation

 

Haven't tried SelfCAD yet? Register now, and try it out for free!

Try SelfCAD for free