OpenGL Modern Graphics Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What are the 4 kinds of spaces are there in opengl ?

1) Object space is the object's vertices relative to the object's origin. In the case of a 1x1x1 cube, your vertices would be: ( 0.5, 0.5, 0.5) (-0.5, 0.5, 0.5) ( 0.5, -0.5, 0.5) (-0.5, -0.5, 0.5) etc. 2) World space is where the object is in your world. If you want this cube to be at (15, 10), you'd create a translation matrix that, when multiplied with each vertex, would center your vertices around (15, 10). For example, the first vertex would become (15.5, 10.5, 0.5). The matrix to go from object to world space is called the "model" matrix. 3) Eye Space (sometimes called Camera space) is the world relative to the location of the viewer. Since this has to be a matrix that each vertex is multiplied by, it's technically the inverse of the camera's orientation. That is, if you want a camera at (0, 0, -10), your "view" matrix has to be a translation of (0, 0, 10). That way all the objects in the world are forward 10 units, making it look like you are backwards 10 units. 4) Projection space is how we apply a correct perspective to a scene (assuming you're not using an orthographic projection). This is almost always represented by a frustum, and this article can explain that better than I can. Essentially you are mapping 3d space onto another skewed space.

Is a GPU designed for task or data parallelism ?

A GPU is designed for data-parallelism, while a CPU is designed for task-parallelism.

What is projection matrix in opengl ?

A computer monitor is a 2D surface. A 3D scene rendered by OpenGL must be projected onto the computer screen as a 2D image. GL_PROJECTION matrix is used for this projection transformation. First, it transforms all vertex data from the eye coordinates to the clip coordinates. Then, these clip coordinates are also transformed to the normalized device coordinates (NDC) by dividing with w component of the clip coordinates.

What is Rasterization in the graphics pipeline ?

After the vertex shader has converged data into dots that form a triangle then the process of Rasterization is the connecting of the dots to form a triangle and filling in the inside with color.

What is the fragment shader in the graphics pipeline ?

After triangle form dots are organized by the vertex shader And after the dots have been connected and the inside filled in via Rasterization Now we grab every pixel inside of the triangle and process on each one to generate a color for each one. This is the fragment shader.

What information does the vertex shader usually need ?

An array of vertices and shader constants

What is the advantage of an Index Array over a vertex buffer ?

An index array stores an index for each vertex in a triangle instead of an x,y location hence saving memory and adding the ability to reference overlapping vertices by the same index.

What's the difference between concurrency and parallelism ?

Concurrency is when two tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. Eg. multitasking on a single-core machine. One core running several threads. Parallelism is when tasks literally run at the same time, eg. on a multicore processor. All cores run simultaneously.

What is used to hide memory-latency on both the CPU and the GPU ?

Context Switching

What is a context in openGL ?

Contexts are localized within a particular process of execution (an application, more or less) on an operating system. A process can create multiple OpenGL contexts. Each context can represent a separate viewable surface, like a window in an application. Each context has its own set of OpenGL Objects, which are independent of those from other contexts. A context's objects can be shared with other contexts. Most OpenGL objects are sharable, including Sync Objects and GLSL Objects. Container Objects are not sharable, nor are Query Objects. A context stores all of the state associated with this instance of OpenGL. It represents the (potentially visible) default framebuffer that rendering commands will draw to when not drawing to a framebuffer object. Think of a context as an object that holds all of OpenGL; when a context is destroyed, OpenGL is destroyed.

What are the different types of memory that a GPU thread can use ?

Data stored in register memory is visible only to the thread that wrote it and lasts only for the lifetime of that thread. Local memory has the same scope rules as register memory, but performs slower. Data stored in shared memory is visible to all threads within that block and lasts for the duration of the block. This is invaluable because this type of memory allows for threads to communicate and share data between one another. Data stored in global memory is visible to all threads within the application (including the host), and lasts for the duration of the host allocation. What is the main design goal of the GPU ? -;- To Hide memory latency.

How is depth testing performed ?

Depth value is used to determine which value is closest to the camera Depth testing is performed using a depth buffer here we can check wich value is closest to the camera.

How should you use draw calls for performance optimization

Draw as much as you can in a single draw call ? It's less expensive to do so. Use instance rendering. Try to render things in a fashion that minimizes state changes.

What happens if a CPU has twice as many threads as cores ?

Each core would process 2 threads each

What does the Model Matrix do in openGL ?

Each object has a position and an orientation "pose." Model matrix stores a 3d transformation of the objects pose relative to its location in world space.

What is eye space in opengl ?

Eye Space (sometimes called Camera space) is the world relative to the location of the viewer.

What information do fragment shaders usually need ?

Fragment shaders often read textures and shader constants (uniform variables)

What different types of binding points are there ?

GL_ARRAY_BUFFER GL_COPY_READ_BUFFER GL_COPY_WRITE_BUFFER GL_ELEMENT_ARRAY_BUFFER GL_PIXEL_PACK_BUFFER GL_PIXEL_UNPACK_BUFFER GL_TEXTURE_BUFFER GL_TRANSFORM_FEEDBACK_BUFFER GL_UNIFORM_BUFFER

Which has more threads per core CPUs or GPUs and why ?

GPUs have more, Because the type of tasks are very different.

What is a computer kernel ?

In computing, a compute kernel (compute shader) is a routine compiled for high throughput accelerators (such as graphics processing units (GPUs), digital signal processors (DSPs) or field-programmable gate arrays (FPGAs)), separate from but used by a main program (typically running on a central processing unit). They are sometimes called compute shaders, sharing execution units with vertex shaders and pixel shaders on GPUs, but are not limited to execution on one class of device, or graphics APIs.[

For performance optimization how should you render objects in terms of depth ?

In front to back order, this makes it so that you don't overwrite things and save resources.

For performance optimization, why is it best to not clear colour buffers unless necessary ?

In rendering scenes it's likely you will overwrite all pixels every frame, if so it's a waste of time to clear them first.

What is memory latency ?

Interferences among requests from different cores may prolong the latency of memory accesses thereby degrading the system performance.

What is task-parallelism ?

Is a form of parallel computing for multiple processors using a technique for distributing execution of processes and threads across different parallel processor nodes. It contrasts to data parallelism. if we are running code on a 2-processor system (CPUs "a" & "b") in a parallel computing environment and we want to do tasks "A" and "B", it is possible to tell CPU "a" to do task "A" and CPU "b" to do task 'B" simultaneously (at the same time), in order to reduce the runtime of the execution.

What is another property that vertices can have ?

It can have vertex attributes. E.g Surface Normal: used for lighting calculations Texture coordinates: for wrapping textures around the model.

What does the projection matrix do to pixels not in it's lens space ?

It clips them, no need to process on things not seen.

How does a single core handle multiple threads ?

It does this by context switching the threads via a scheduling scheme. Hence, two tasks can start, run, and complete in overlapping time periods causing Concurrency.

What are the two types of cores that a CPU can have ?

Logical Core & Physical Core

What is the MVP matrix ?

Model, View and Projection Matrix. MVP multiplies these three matrices. If you compose all three, you can use the one result to map all the way from object space to screen space, making you able to work out what you need to pass on to the next stage of a programmable pipeline from the incoming vertex positions. So: the composed model view projection matrix is often used by shaders to map from the vertices you loaded for each model to the screen. It's not required, there are lots of ways of achieving the same thing, it's just usual because it allows all possible linear transforms. Because of that, a lesser composed version of it was also the norm in ye olde fixed pipeline world.

What happens after the fragment shader in the graphics pipeline ?

Now we know what pixels have what color on a triangle so we write it to an output image.

What is object space in opengl ?

Object space is the object's vertices relative to the object's origin. In the case of a 1x1x1 cube, your vertices would be: ( 0.5, 0.5, 0.5) (-0.5, 0.5, 0.5) ( 0.5, -0.5, 0.5) (-0.5, -0.5, 0.5) What is world space in opengl ? -;- World space is where the object is in your world.

On a CPU each core has it's own scheduler, how does a GPU handle this ?

On the GPU a kernel is executed over and over again using different parameters. A thread is no more than a function-pointer, with some unique constants - a scheduler handles multiple threads at once.

What's an openGL Object ?

OpenGL Objects are structures composed of states and data and are responsible for transmitting data from the CPU to the GPU. OpenGL objects must first be created and bound before they can be used. (Regular objects & Container Objects)

What is the PCI Express bus ?

PCIe (peripheral component interconnect express) is an interface standard for connecting high-speed components. Every desktop PC motherboard has a number of PCIe slots you can use to add GPUs (aka video cards aka graphics cards), RAID cards, Wi-Fi cards or SSD (solid-state drive) add-on cards. The types of PCIe slots available in your PC will depend on your motherboard.

What are different lighting models in opengl ?

Phong Reflection Model Specular Reflection Diffuse Reflection Ambient light

What's the difference between a Logical Core and a Physical core ?

Physical cores are number of physical cores, actual hardware components. Logical cores are the number of physical cores times the number of threads that can run on each core through the use of hyperthreading.

What are some different types of light in openGL ?

Point lights Area lights Spot lights

What is projection space in opengl ?

Projection space is how we apply a correct perspective to a scene (assuming you're not using an orthographic projection). This is almost always represented by a frustum, and this article can explain that better than I can. Essentially you are mapping 3d space onto another skewed space.

Regular Objects vs Container Objects in openGL ?

Regular Objects These type of objects contain data. A list of regular objects are: Buffer Objects Renderbuffer Objects Texture Objects Query Objects Sampler Objects Container Objects As the name implies, these type of objects do not contain any data. Instead they are containers for regular openGL objects. A list of container objects are: Framebuffer Objects Vertex Array Objects Transform Feedback Objects Program Pipeline Objects

What are the two types of objects in openGL ?

Regular Objects and Container Objects.

What is a shader ?

Specialized computer program that runs on the GPU. E.G Vertex Shader & Fragment Shader

What is a uniform variable in openGL ?

Store data that's common to all verticy pixels

What is the difference between Task and Data parallelism ?

Task parallelism makes different CPUs do different tasks. Where as Data parallelism splits shared data and has the CPUs process different parts of it.

What's the texels bottleneck ?

The GPU can only process so many texels per second

What is the vertex shader in the graphics pipeline ?

The GPU gets data from the CPU. Data (1s and 0s) Processing (convert data to a form that the GPU can make sense of it). It does this in parallel via units of data (GPU defined) The processing done in the previous step is convert data into dots that form a triangle. This stage is the vertex shader.

What's the shaders ops bottleneck ?

The GPU shader cores have a maximum number of instructions per second they can perform, so complex shaders will take longer.

The behaviour of openGL Binding Objects depend on what ?

The behavior of a buffer object depends on its binding points. For example, when a buffer object's binding point is GL_ARRAY_BUFFER, it behaves as a Vertex Buffer Object. This type of objects are mainly used to store vertex data of characters. When a buffer object's binding point is set to GL_PIXEL_PACK_BUFFER, it behaves as a Pixel Buffer Object; mainly used to read data from framebuffers. A binding point is also known as targets. As stated above, it allows buffers to be used for different purposes. Buffer objects are also known as A Vertex Buffer Object (VBO) is a Buffer Object.

What is the data transfer bottleneck ?

The bus connecting the GPU and the CPU has a maximum transfer rate which can affect both the draw ops and how much data (vertices, textures etc.) can be transferred.

We send streams of commands to the GPU via what ?

The command processor

What is main memory ?

The main memory in a computer is called Random Access Memory. It is also known as RAM. This is the part of the computer that stores operating system software, software applications and other information for the central processing unit (CPU) to have fast and direct access when needed to perform tasks.

What's the fill rate bottleneck ?

The maximum number of pixels that the GPU can render What are the different types of bottlenecks in openGL ? -;- What is a draw call bottleneck ? There is a maximum number of draw calls the GPU can handle. What is the data transfer bottleneck ? The bus connecting the GPU and the CPU has a maximum transfer rate which can affect both the draw ops and how much data (vertices, textures etc.) can be transferred. What's the shaders ops bottleneck ? The GPU shader cores have a maximum number of instructions per second they can perform, so complex shaders will take longer. What is the vertices bottleneck ? There's a maximum amount of vertices that can be fetched even when they're stored in VRAM. What's the VRAM bandwidth bottleneck ? Video memory also has a maximum transfer rate. What's the texels bottleneck ? The GPU can only process so many texels per second What's the fill rate bottleneck The maximum number of pixels that the GPU can render

What are the most commonly used binding points in openGL ?

The most common binding points are: GL_ARRAy_BUFFER GL_TEXTURE_BUFFER GL_ELEMENT_ARRAY_BUFFER For example, when a buffer object's binding point is GL_ARRAY_BUFFER, it behaves as a Vertex Buffer Object. This type of objects are mainly used to store vertex data of characters. If interested, here is a complete list of Binding points: GL_ARRAY_BUFFER GL_COPY_READ_BUFFER GL_COPY_WRITE_BUFFER GL_ELEMENT_ARRAY_BUFFER GL_PIXEL_PACK_BUFFER GL_PIXEL_UNPACK_BUFFER GL_TEXTURE_BUFFER GL_TRANSFORM_FEEDBACK_BUFFER GL_UNIFORM_BUFFER

What is a draw call bottleneck ?

There is a maximum number of draw calls the GPU can handle.

What is the vertices bottleneck ?

There's a maximum amount of vertices that can be fetched even when they're stored in VRAM.

What is hyperthreading ?

This is a process where a CPU splits each of its physical cores into virtual cores, which are known as threads.

What's the CPU's main design goal ?

To increase processor usage. A CPU-core consists of several modules, which can run in independently - if two threads use different modules, the speed can be (almost) doubled. If the amount of threads is larger than the hardware can handle (2 times the number of cores), the hardware is shared by all threads by the OS - this can slow down all the processes. Hence to increase processor usage CPU's have less threads than GPU's. -- How does a CPU handle memory latency ? -;- Memory latency is the time that it takes to load data from main memory. A CPU solves the problem of memory-latency by having much bigger caches and very large schedulers. A GPU has so many more cores, that this approach does not work.

What is a simulated camera used for ?

To render a convincing 3D screen objects must be placed on a 2D screen via a simulated camera

What is the view matrix in opengl ?

Transforms camera from world to camera coordinates.

What is a VAO ?

Vertex Array Objects A Vertex Array Object (VAO) is an OpenGL object. However, unlike a Buffer Object which contains storage, a VAO does not. Instead, a VAO is a container for Vertex Buffer objects (VBO). Why use a VAO? In the last section, the function glVertexAttribPointer() provided all the necessary information that a shader would need regarding a vertex-attribute. This information answered questions like: What is the data type? Is there any stride? Is the data normalize? What is the offset to the data? Let's say that you need to render 12 different characters each with their own data type, offset, etc. All of this information must be prepared before it is rendered. This is a lot of states to set and a lot of error checking that the driver will have to do. This is where a VAO can help organize all of this information. A VAO is a container that stores all the states needed for rendering. It stores the information of vertex-attribute as well as the buffer object.

How does using VBOs help with performance optimization over vertex arrays ?

Vertex arrays are quick and easy but consumes bus bandwidth because the GPU must read across the PCI express bus to main memory. Using VBOs (Vertex Buffer Objects) allow the GPU to copy vertices into VRAM which the GPU has much vaster access with. Plus, If you're streaming data and need the VBO to use main memory it can do that.

What's the VRAM bandwidth bottleneck ?

Video memory also has a maximum transfer rate.

What does the Command processor do ?

We learnt how the CPU sends command to the CPU, with state changes, instructions and data, but this is codified somehow and must be interpreted. A CP keeps track of states within the GPU, updates host mapped registers and signals interrupts to inform the CPU. In fact, CPs are (afaik) a micro-processors embedded into the GPU capable of doing most of the tasks traditionally handled by software at the driver. Contains an internal memory, can do complex logic, arithmetic operations and so on. Its capable of managing multiple command buffers, keep track of what is sent down into the GPU or update fences once the command stream has reached them. Her first task is decoding the commands in order to feed other components. It's also responsible of reading and writing host memory and managing device memory. Managing states is a complex task and in some cases, in order to maintain integrity, a partial pipeline flush is issued before proceeding. This is the worst case as it can serialize everything. This is a world itself and very vendor specific.

What is a Binding Point in OpenGL ?

When you bind an OpenGL object to the OpenGL Context, you must specified what kind of data the object will transport to the GPU. The type of data that the OpenGL Object transports defines its behavior. A Binding Point specifies the behavior of the OpenGL object. Binding Points, also known as Targets, allows OpenGL objects to be used for different purposes.

When does the command processor come into play ?

You can get your GPU to do something via the command processor after you have ... Set up the shader pipeline, Created a bunch of data objects and filled them with your 3DModels textures and constants. Tell the GPU what data buffers to read from by binding the buffers to various points.

What's the z-/depth-buffer used for ?

ensure that objects closest to the camera are drawn over things that are farther away.

What is a GPU graphics pipeline ?

is a conceptual model that describes what steps a graphics system needs to perform to render a 3D scene to a 2D screen.

What is data-parallelism ?

is a form of parallel computing for multiple processors using a technique for distributing the data across different parallel processor nodes. It contrasts to task parallelism as another form of parallelism. if we are running code on a 2-processor system (CPUs A and B) in a parallel computing environment, and we want to do a task on some data D, it is possible to tell CPU A to do that task on one part of D and CPU B on another part of D simultaneously (at the same time), in order to reduce the runtime of the execution.

What are the two ways of string vertex arrays ?

openGL allows you to use vertex arrays in stored memory however it is highly recomended that you use VRAM (Video Ram) using VBOs. This increases the speed and perfomance.

Now, before an OpenGL object can be used, it must be created and bound to the __ ?

openGL context

What is the openGL viewpoint transform ?

viewport transformation is that it strethes the scene onto the OpenGL window by applying the viewport transformation to that scene.


Set pelajaran terkait

Intro to Communications Chapter 2

View Set

Natural selection and motivation

View Set

ACCOUNTING MULTIPLE CHOICE 7 8 9

View Set

Chapter 5 immune system diseases and disorders

View Set