Open Gl Shading Language, Development

Open Gl Shading Language, Development
Open Gl Shading Language, Development

ebook > Development
Open Gl Shading Language

Category: Development
Language: English
FileType: CHM
File size: 2983 KB
For just about as long as there has been graphics hardware, there has been programmable graphics hardware. Over the years, building flexibility into graphics hardware designs has been a necessary way of life for hardware developers. Graphics APIs continue to evolve, and because a hardware design can take two years or more from start to finish, the only way to guarantee a hardware product that can support the then-current graphics APIs at its release is to build in some degree of programmability from the very beginning. Until recently, the realm of programming graphics hardware belonged to just a few people, mainly researchers and graphics hardware driver developers. Research into programmable graphics hardware has been taking place for many years, but the point of this research has not been to produce viable hardware and software for application developers and end users. The graphics hardware driver developers have focused on the immediate task of providing support for the important graphics APIs of the time: PHIGS, PEX, Iris GL, OpenGL, Direct3D, and so on. Until recently, none of these APIs exposed the programmability of the underlying hardware, so application developers have been forced into using the fixed functionality provided by traditional graphics APIs. Hardware companies have not exposed the programmable underpinnings of their products because there is a high cost of educating and supporting customers to use low-level, device-specific interfaces and because these interfaces typically change quite radically with each new generation of graphics hardware. Application developers who use such a device-specific interface to a piece of graphics hardware face the daunting task of updating their software for each new generation of hardware that comes along. And forget about supporting the application on hardware from multiple vendors! As we move into the 21 century, some of these fundamental tenets about graphics hardware are being challenged. Application developers are pushing the envelope as never before and demanding a variety of new features in hardware in order to create more and more sophisticated onscreen effects. As a result, new graphics hardware designs are more programmable than ever before. Standard graphics APIs have been challenged to keep up with the pace of hardware innovation. For OpenGL, the result has been a spate of extensions to the core API as hardware vendors struggle to support a range of interesting new features that their customers are demanding. So we are standing today at a crossroads for the graphics industry. A paradigm shift is occurring, one that is taking us from the world of rigid, fixed functionality graphics hardware and graphics APIs to a brave new world where the visual processing unit, or VPU (i e , graphics hardware), is as important as the central processing unit, or CPU. The VPU will be optimized for processing dynamic media such as 3D graphics and video. Highly parallel processing of floating point data will be the primary task for VPUs, and the flexibility of the VPU will mean that it can also be used to process data other than a stream of traditional graphics commands. Applications can take advantage of the capabilities of both the CPU and the VPU, utilizing the strengths of each to perform the task at hand optimally. This book describes how graphics hardware programmability is exposed through a high-level language in the leading cross-platform 3D graphics API: OpenGL. This language, the OpenGL Shading Language, allows applications to take total control over the most important stages of the graphics processing pipeline. No longer restricted to the graphics rendering algorithms and formulas chosen by hardware designers and frozen in silicon, software developers are beginning to use this programmability to create stunning effects in real-time. Intended Audience The primary audience for this book is application programmers that are interested in writing shaders. This book is intended to be used as both a tutorial and a reference book by people interested in learning to write shaders with the OpenGL Shading Language. Some will use the book in one fashion and some in the other. It is hoped that the organization will be amenable to both uses. It is not expected that most people will read the book in sequential order from back to front. Readers do not need previous knowledge of OpenGL in order to absorb the material in this book, but it is very helpful. A brief review of OpenGL is included, but this book does not attempt to be a tutorial or reference book for OpenGL. Anyone attempting to develop an OpenGL application that uses shaders should be armed with OpenGL programming documentation in addition to this book. Computer graphics has a mathematical basis, therefore some knowledge of algebra and trigonometry will help readers understand and appreciate some of the details presented. With the advent of programmable graphics hardware, key parts of the graphics processing pipeline are once again under the control of software developers. In order to develop shaders successfully in this environment, it is imperative that developers understand the mathematical basis of computer graphics. About This Book This book has three main parts. Chapters 1 through 8 are aimed at teaching the reader about the OpenGL Shading Language and how to use it. This part of the book covers details of the language and details of the OpenGL commands that are used to create and manipulate shaders. In order to provide the reader with a basis for writing shaders, Chapters 9 through 16 contain a gallery of shader examples and some explanation of the underlying algorithms. This part of the book is intended to be used as a basis for the reader’s shader development and as a springboard to inspire new ideas. Finally, Chapter 17 contains a comparison with other notable commercial shading languages, and Appendices A and B contain reference material for the language and the API entry points that support it. The chapters are arranged to suit the needs of the reader who is least familiar with OpenGL and shading languages. Certain chapters can be skipped by readers who are more familiar with both topics. People don’t necessarily read technical books from front to back, and this book is designed to have somewhat compartmentalized chapters in order to allow such usage. Chapter 1 contains a review of the fundamentals of the OpenGL API. Readers already familiar with OpenGL may skip to Chapter 2. Chapter 2 provides an introduction to the OpenGL Shading Language and the OpenGL entry points that have been added to support it. If you want to know what the OpenGL Shading Language is all about and you have time to read only one chapter of this book, this is the one to read. Chapter 3 thoroughly describes the OpenGL Shading Language. This material is organized to present the details of a programming language. This section will be useful as a reference section after readers have developed a general understanding of the language. Chapter 4 discusses how the newly defined programmable parts of the rendering pipeline interact with each other and with OpenGL’s fixed functionality. This discussion includes descriptions of the built-in variables defined in the OpenGL Shading Language. Chapter 5 describes the built-in functions that are part of the OpenGL Shading Language. This section will also be useful as a reference section after readers have developed an understanding of the language. Chapter 6 presents and discusses a fairly simple shader example. People who learn best by diving in and studying a real example will benefit from the discussion in this chapter. Chapter 7 describes the entry points that have been added to OpenGL to support the creation and manipulation of shaders. This material will need to be understood by application programmers who want to use shaders in their application. Chapter 8 presents some general advice on shader development and describes the shader development process. It also describes tools that are currently available to aid the shader development process. Chapter 9 begins a series of chapters that present and discuss shaders with a common characteristic. In this chapter, shaders that duplicate some of the fixed functionality of the OpenGL pipeline are presented. Chapter 10 presents a few shaders that are based on the capability to store data in and retrieve data from texture maps. Chapter 11 is devoted to shaders that are procedural in nature (effects are computed algorithmically rather than being based on information stored in textures). Chapter 12 describes noise and the effects that can be achieved by using it properly. Chapter 13 contains examples of how shaders can be used to create rendering effects that vary over time. Chapter 14 contains a discussion of the aliasing problem and how shaders can be written to reduce the effects of aliasing. Chapter 15 illustrates shaders that are used to achieve effects other than photorealism. Such effects include technical illustration, sketching or hatching effects, and other stylized rendering. Chapter 16 presents several shaders that are used to modify images as they are being drawn with OpenGL. Chapter 17 compares the OpenGL Shading Language with other notable commercial shading languages. Appendix A contains the language grammar that more clearly specifies the OpenGL Shading Language. Appendix B contains reference pages for the API entry points that are related to the OpenGL Shading Language. About the Shader Examples The shaders contained in this book are primarily short programs designed to illustrate the capabilities of the OpenGL Shading Language. None of the example shaders should be presumed to illustrate the “best” way of achieving a particular effect. (Indeed, the “best” way to implement certain effects may have yet to be discovered through the power and flexibility of programmable graphics hardware ) Performance improvements for each shader are possible for any given hardware target. For most of the shaders, image quality may be improved by taking greater care to reduce or .
Free ebooks/book downloading links are not available in public, use the ebook code below for requesting this ebook.




This ebook code is: 13192173442