GLSL Nuts and bolts.


92 views
Uploaded on:
Category: Product / Service
Description
GLSL Nuts and bolts GLSL Essentials I GPU developments What is a GPU The OpenGL Design Pipeline Necessities for GLSL II Code Shaders in GLSL OpenGL Shading dialect Vertex processor Piece processor III Illustration utilizing GLSL Code Visual I GPU advancement a) What's a GPU ?
Transcripts
Slide 1

GLSL Basics

Slide 2

GLSL Basics I GPU advancements What is a GPU The OpenGL Graphics Pipeline Requirements for GLSL II Code Shaders in GLSL OpenGL Shading dialect Vertex processor Fragment processor III Example utilizing GLSL Code Visual

Slide 3

I GPU development a) What’s a GPU ? GPU = Graphics Processing Unit ≠ CPU = Central Processing Unit GPU : devoted illustrations rendering gadget A GPU executes various representation primitive operations in a manner that makes running them much speedier than attracting specifically to the screen with the host CPU. CPU

Slide 4

Performance Evolution :

Slide 5

Early Hardware History 1996 : 3DFX Voodoo This was the first PC business GPU 1999 : Nvidia GeForce 256 The card included equipment support for Transform and Lighiting. Not programable

Slide 6

Hardware History 2000 Card(s) available: GeForce 2, Radeon 128, WildCat , and Oxygen GVX1 These cards did not utilize any programmability inside of their pipeline. There were no vertex and pixel shaders or even composition shaders. The main automatically believe was the register combiners. Multi-texturing and added substance mixing were utilized to make cunning impacts and remarkable materials.

Slide 7

2001 Card(s) available: GeForce 3 With GeForce 3, NVIDIA brought programmability into the vertex preparing pipeline, permitting designers to compose straightforward \'settled length\' vertex projects utilizing pseudo-constructing agent style code. Pixel preparing was additionally enhanced with the composition shader , permitting more control over surfaces. Designers could now add, adjust, supplant, and decal operations between composition units, and also extrapolate or consolidate with consistent shading

Slide 8

2002 Card(s) available: GeForce 4 NVIDIA\'s GeForce 4 arrangement had awesome upgrades in both the vertex and the pixel stages. It was currently conceivable to compose longer vertex projects, permitting the formation of more mind boggling vertex shaders.

Slide 9

2003 Card(s) available: GeForce FX, Radeon 9500/9800, and WildCat VP The GeForce FX and Radeon 9500 cards presented "genuine" pixel and vertex shaders, which could utilize variable lengths and conditionals. Larger amount dialects were likewise presented around the same time, supplanting the asm - based ancestors. All stages inside of the pixel and vertex pipeline were presently completely programmable (with a couple of impediments).

Slide 10

2003 Continued With the formation of GLSL, design cards could exploit an abnormal state dialect for shaders. With a decent compiler, circles and branches could be reenacted inside of equipment that locally didn\'t bolster them. Numerous capacities were likewise presented, making a standard library, and subroutines were included; GLSL pushed the equipment as far as possible.

Slide 11

2003 Continued 3Dlabs dispatched their WildCat VP cards, which took into consideration "genuine" vertex and part (pixel) shaders with circles and expanding, even in piece shaders. These were the first cards to completely bolster the OpenGL Shading Language (GLSL).

Slide 12

2003 Continued Until now, all vertex and pixel writing computer programs was done utilizing a fundamental asm - based dialect called " ARB_fp " (for piece programs) or " ARB_vp " (for vertex programs). Projects written in this dialect were direct, with no type of stream control or information structure. There were no sub-schedules and no standard library (containing basic capacities). It essentially prepared number-crunching operations and surface get to, and nothing more.

Slide 13

2004 Card(s) available: WildCat Realizm , GeForce 6, and ATI x800 cards These cards are the most recent era of programmable illustrations equipment. They bolster a higher subset of GLSL, including direct surface access from vertex shaders, substantial project bolster, equipment based commotion era, variable-length exhibits, backhanded indexing, composition ward perusing, sub-schedules, and a standard library for the most widely recognized capacities (like spot, cross, standardize , sin, cos , tan, log, sqrt , length, reflect, refract, dFdx , dFdy , and so forth.). They can likewise utilize an extensive rundown of inherent variables to get to numerous OpenGL states (like gl_LightSource [n].position, gl_TexCoord [n], gl_ModelViewMatrix , gl_ProjectionInverseMatrix , and so forth.). Information structures are upheld also through C-like structs .

Slide 14

2004 Card(s) available: WildCat Realizm , GeForce 6, and ATI x800 cards These cards are the most recent era of programmable representation equipment. They bolster a higher subset of GLSL, including direct composition access from vertex shaders, vast project bolster, equipment based clamor era, variable-length clusters, aberrant indexing, surface ward perusing, sub-schedules, and a standard library for the most widely recognized capacities (like speck, cross, standardize , sin, cos , tan, log, sqrt , length, reflect, refract, dFdx , dFdy , and so on.). They can likewise utilize a not insignificant rundown of inherent variables to get to numerous OpenGL states (like gl_LightSource [n].position, gl_TexCoord [n], gl_ModelViewMatrix , gl_ProjectionInverseMatrix , and so forth.). Information structures are upheld also through C-like structs .

Slide 15

Enter the Nvidia GeForce 8800 Contains full backing for DirectX 10 and Opengl 2.0 Fully brought together shader center powerfully assigns preparing energy to geometry, vertex, material science, or pixel shading operations, conveying up to 2x the gaming execution of earlier era GPUs. From our point of view it does practically anything we need (for now at any rate)

Slide 16

Fixed Methods These settled techniques permitted the software engineer to show numerous essential lighting models and impacts, similar to light mapping, reflections, and shadows (dependably on a for each vertex premise) utilizing multi-texturing and different passes. This was finished by basically reproducing the quantity of vertices sent to the realistic card (two passes = x2 vertices, four passes = x4 vertices, and so forth.), yet it finished there.

Slide 17

Fixed Pipeline Continued Fragment: During the rasterization arrange, the pipeline breaks primitives into pixel-sized lumps called parts. A section is a bit of a primitive that may inevitably impact a pixel( that which is really composed to the shading cushion) after it is profundity tried, alpha tried, mixed, consolidated with a composition and joined with different parts. The altered section stage took care of errands, for example, add qualities (hues and surface directions), composition access, composition application (environment mapping and shape mapping), haze, and all other per-part calculations.

Slide 18

b) The OpenGL Graphics Pipeline

Slide 20

What are shaders ? Shaders substitute parts of the illustrations pipeline The Transform and lighting stage is presently programmable utilizing Vertex Shaders Pixel (or piece) shaders projects substitute the Color and Pixel directions stage

Slide 21

c) Requirements for GLSL Hardware Requirement : Shaders are accessible since the GeForce 3 and Radeon 8500 with OpenGL 1.4 However, to utilize all spã©cifications of OpenGL 2.0, a GeForce 5(FX) or a Radeon 9500 is profoundly suggested. Programming Requirement : To code in GLSL, a C supervisor is important : Visual C++, CodeBlocks, DevC++ … You require additionnal libraries : Glut and Glew bundles give every single principle capacity Be certain your design card drivers are up and coming

Slide 22

II Code Shaders in GLSL an) OpenGL Shading dialect GLSL = OpenGL Shading Language 3 primary Shading Language HLSL, utilizes Direct3D API, made in Microsoft GLSL, utilizes OpenGL API. Cg, NVidia Shading Language, Independant

Slide 23

Transform and Lighting (T&L) Custom change, lighting, and cleaning

Slide 24

An uncommon T&L shader? Custom toon style lighting

Slide 25

Implement rapid knock mapping Per-vertex set up for per-pixel knock mapping

Slide 26

Dynamic transforming Character transforming & shadow volume projection

Slide 27

Dynamic cross section twisting Dynamic removals of surfaces by items

Slide 28

What should be possible in a vertex shader ? Complete control of change and lighting HW Complex vertex operations quickened in HW Custom vertex lighting Custom cleaning and mixing Custom surface direction era Custom composition lattice operations Custom vertex calculations of your decision Offloading vertex calculations arranges for CPU More material science, recreation, and AI conceivable.

Slide 29

GLSL ( OpenGL Shading Language ), otherwise called GLslang , is an abnormal state shading dialect taking into account the C programming dialect . It was made by the OpenGL ARB to give engineers more straightforward control of the design pipeline without needing to utilize low level computing construct or equipment particular dialects. OpenGL 2.0 is currently accessible.

Slide 30

GLSL Originally acquainted as an expansion with OpenGL 1.4, the OpenGL ARB formally included GLSL into the OpenGL 2.0 center. OpenGL 2.0 is the first significant modification to OpenGL since the production of OpenGL 1.0 in 1992. A few advantages of utilizing GLSL are: Cross stage similarity on numerous working frameworks, including Linux , Mac OS and Windows . The capacity to compose shaders that can be utilized on any equipment vendor’s representation card that backings the OpenGL Shading Language. Every equipment merchant incorporates the GLSL compiler in their driver, in this manner permitting every seller to make code streamlined for their specific illustrations card’s building design.

Slide 31

GLSL Data Types Data sorts The OpenGL Shading Language Specification characterizes 22 fundamental information sorts. Some are the same as utilized as a part of the C programming dialect, while others are particular to representation handling. void – utilized for capacities that don\'t give back a worth bool – contingent sort, qualities may be either genuine or false int – a marked whole number buoy – a gliding point number vec2 – a 2 segment skimming point vector ,v ec3, vec4 bvec2 – a 2 part Boolean vec

Recommended
View more...