Accelerating Real-Time Graphics with High Level Shading Languages
Total Page:16
File Type:pdf, Size:1020Kb
2003:306 CIV MASTER’S THESIS Accelerating Real-Time Graphics with High Level Shading Languages EMIL PERSSON MASTER OF SCIENCE PROGRAMME Department of Computer Science and Electrical Engineering Division of Media Technology 2003:306 CIV • ISSN: 1402 - 1617 • ISRN: LTU - EX - - 03/306 - - SE Contents CONTENTS ..............................................................................................................................2 ABSTRACT ..............................................................................................................................4 GOALS ......................................................................................................................................5 ACKNOWLEDGEMENTS .....................................................................................................6 PREFACE.................................................................................................................................7 BASIC REA L-TIME GRAPHICS CONCEPTS...................................................................................7 Hardware rendering paradigm ..........................................................................................7 Common graphics terms.....................................................................................................8 High level shading languages ............................................................................................9 INTRODUCTION ........................................................................................................................9 HISTORY AND TRENDS ...........................................................................................................10 Converging of gaming and professional sectors..............................................................10 Converging of hardware and software rendering............................................................11 Programmability...............................................................................................................12 BUFFER HANDLING WITH GL_ARB_VERTEX_BUFFER_OBJECT.......................15 BACKGROUND .......................................................................................................................15 INTERFACE ............................................................................................................................16 TEST-CASE.............................................................................................................................17 BENCHMARKS........................................................................................................................19 EVALUATION OF THE DRIVER IMPLEMENTATION....................................................................20 HIGH LEVEL SHADING IN OPENGL 2.0........................................................................22 BACKGROUND .......................................................................................................................22 PORTING FROM DX9 HLSL TO OPEN GL 2 GLSLANG ............................................................23 Wood.................................................................................................................................23 Ivory..................................................................................................................................26 Velvet................................................................................................................................26 Marble ..............................................................................................................................27 Granite..............................................................................................................................28 Stratum.............................................................................................................................28 Saturn ...............................................................................................................................29 Veined marble...................................................................................................................29 Depth of field....................................................................................................................30 PORTING FROM RENDERMAN TO OPEN GL 2 GLSLANG..........................................................32 Brushed metal...................................................................................................................32 Flame................................................................................................................................33 EVALUATION OF THE OPEN GL HIGH LEVEL SHADING LANGUAGE .........................................33 Direct shader to hardware mapping ................................................................................34 Hardware abstraction ......................................................................................................34 Hardware limits................................................................................................................35 Language..........................................................................................................................36 ASHLI......................................................................................................................................37 INTRODUCTION ......................................................................................................................37 RenderMan .......................................................................................................................37 2 THE INTERFACE .....................................................................................................................37 State of the interface.........................................................................................................38 Evaluation of the interface...............................................................................................38 THE GAME DEVELOPER’S PERSPECTIVE..................................................................................39 ShaderMan .......................................................................................................................39 THE FUTURE ..........................................................................................................................40 HIGH LEVEL SHADING WITH RENDERMONKEY....................................................41 INTRODUCTION ......................................................................................................................41 RenderMonkey..................................................................................................................41 The work...........................................................................................................................42 MATERIALS ...........................................................................................................................43 Wood.................................................................................................................................44 Fabric ...............................................................................................................................45 Glass.................................................................................................................................45 TECHNIQUES FOR INDUSTRIAL USE........................................................................................47 Image classification with the Hough transform ...............................................................47 Volume visualization ........................................................................................................49 TECHNIQUES FOR THE GA MING INDUSTRY.............................................................................51 Volumetric lighting...........................................................................................................51 Sky rendering....................................................................................................................53 Fire ...................................................................................................................................54 Electric flash.....................................................................................................................55 Particle systems................................................................................................................56 Water ................................................................................................................................58 CINEMATIC RENDERING.........................................................................................................60 Glow .................................................................................................................................60 Soft shadows.....................................................................................................................62 POSTPROCESSING...................................................................................................................66 HSI-RGB transformation..................................................................................................66 Edge detection..................................................................................................................69