Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shading Languages GeForce3, DirectX 8 Michael Oswald.

Similar presentations


Presentation on theme: "Shading Languages GeForce3, DirectX 8 Michael Oswald."— Presentation transcript:

1 Shading Languages GeForce3, DirectX 8 Michael Oswald

2 2 / 26 Shading Languages

3 GeForce3, DirectX 8 Michael Oswald

4 4 / 26 Shading Languages n Different approaches: u RenderMan n pure Software-solution u ISL n Interactive n Compiles ISL to OpenGL n Can be speed up by hardware u PixelFlow n Hardware-implementation n pfman generates C++-Code for OpenGL u GeForce3 n Own assembly-language for vertex- and pixel- shaders

5 Michael Oswald 5 / 26 DirectX 8.0 n Common Rendering-Pipeline Transform & Lighting RasterizationDisplay GenerationTraversal

6 Michael Oswald 6 / 26 DirectX 8.0 n DirectX8 Pipeline Transform & Lighting RasterizationDisplay GenerationTraversal Vertex- Shader Pixel-Shader

7 Michael Oswald 7 / 26 Vertex Shaders n Small assembler-programs executed per vertex n One input vertex generates one output vertex n No topological information u no edge, face, no neighbour-vertex information n Dynamically loadable

8 Michael Oswald 8 / 26 Vertex Shaders Vertex Attributes Vertex Program Vertex Output

9 Michael Oswald 9 / 26 Vertex Shaders Vertex Attributes Vertex Program Vertex Output 16x4 registers e.g. position, normals, lightvector, colors, densities, weights, velocities...

10 Michael Oswald 10 / 26 Vertex Shaders Vertex Attributes Vertex Program Vertex Output Program Parameters Temporary Registers A0 128 instructions 96x4 registers 12x4 registers

11 Michael Oswald 11 / 26 Vertex Shaders Vertex Attributes Vertex Program Vertex Output Program Parameters Temporary Registers A0 15x4 registers homogeneous clip space position, diffuse and specular color, up to 4 texture coordinates, fog value, point size

12 Michael Oswald 12 / 26 Vertex Shaders Language n Operand Modifiers: u Negation, „Swizzeling“, „Smearing“, Masking n Common commands u MOV, ADD, MUL, MIN, MAX n Special calculation-commands u MAD „multiply and add“  RCP „reciprocal“ of scalar-value 1/x  RCS „reciprocal square root“ 1/sqrt(x)

13 Michael Oswald 13 / 26 Vertex Shaders Language u EXP, LOG (accurate to ~11 Bits) n Vector calculations u DP33-Component dot-product u DP44-Component dot-product n Conditionals u SGESet greater or equal u SLTSet less than

14 Michael Oswald 14 / 26 Vertex Shaders Language n Lighting u LIT:calculates ambient, diffuse and specular lighting coefficients n Distance-vector u DSTcalculates a „distance attenuation“ vector (1, d, d², 1/d)

15 Michael Oswald 15 / 26 Vertex Shader Language n Macros: EXP, FRC, LOGfull precision but slow M3x2, M3x3, M3x4, M4x3, M4x4full matrix- multiplication n No branches! u Use SGE, SLT and multiply and accumulate

16 Michael Oswald 16 / 26 Pixel Shaders Pixel Hpos d0d1 TC0TC1TC2TC3 Pixel ALU color

17 Michael Oswald 17 / 26 Pixel Shaders Pixel t3 t2 t0 Hpos d0d1 TC0TC1TC2TC3 Pixel ALU t1 Stage3 Stage0 Stage2 Stage1 Texture Stages color texture

18 Michael Oswald 18 / 26 Pixel Shaders Pixel c0 t3 t2 t0 r1 c1 c2 c3 c7 c4... Hpos d0d1 TC0TC1TC2TC3 r0 Pixel ALU t1 Stage3 Stage0 Stage2 Stage1 Texture Stages temp color textureconstant

19 Michael Oswald 19 / 26 Pixel Shader Language n Define Constants: u DEF c#, x, y, z, w n Blending-Operations: u MOV, ADD, SUB,MUL, MAD, DP3 u CND D, R0.a, S1, S2 u LRP D, factor, S1, S2

20 Michael Oswald 20 / 26 Pixel Shader Language n Argument Modifiers u Alpha replicate, Invert, Negate, Bias, Signed Scale n Instruction Modifiers u Double Result, Quadruple Result, Halve Result, Saturate  Saturation can be used together with scaling: dp3_x2_sat r1, r0_bx2, t0_bx2

21 Michael Oswald 21 / 26 Pixel Shader Language n Texture Adressing Operations u Simple color-fetch: tex u Bump Env Map: texbem, texbeml u Turn coord into color: texcoord tDest u Kill Pixel: texkill

22 Michael Oswald 22 / 26 Pixel Shader Language n Matrix Calculation Operations texm3x2pad, texm3x2tex texm3x3pad, texm3x3spec, texm3x3vspec, texm3x3tex n Dependent texture-lookup texreg2ar texreg2gb

23 Michael Oswald 23 / 26 Vertex + Pixel Shader

24 Michael Oswald 24 / 26 Vertex + Pixel Shader

25 Michael Oswald 25 / 26 What to expect... n Extensive use of shading languages n More flexibility n More space for textures, matrices... n Faster Hardware n New bus-systems n Realtime Ray-Tracing?

26 Michael Oswald 26 / 26 The End


Download ppt "Shading Languages GeForce3, DirectX 8 Michael Oswald."

Similar presentations


Ads by Google