Panda3D Manual: Cg Shader Tutorial
<<prev | top | next>> |
## Cg Shader Tutorials Panda has the ability to process shaders written in the Cg shader language. In this tutorial series, you will learn how to write shaders for Panda in Cg. While there are panda specific things in this tutorial you should be able to learn how to write Cg shaders that can be used in other engines. ## Pre-requisites You should be able to write a simple math program in C/C++ or C#. Do not underestimate this. If you start writing your own shaders without any prior knowledge about a C like language it is as hard as starting to write a Panda3D application without knowing anything about Python. Some resources you might want to look at: C Programming Wikibook C# Programming Wikibook You should have a solid grasp of Panda basics. Read the hello world tutorial and understand the "Solar System" sample that comes with the panda distribution. You should also have a good understanding of how the scene graph works. If you're interested in writing a shadow mapping shader, it helps to have a solid understanding of how the depth buffer works. Read the first chapter from NVIDIA's Cg Tutorial. You do not have to understand it fully, but at least you know who invented Cg and what it is for. The NVIDIA and ATI developer sites also have plenty of useful information about shaders. You should also have the List of Possible Shader Inputs page handy. ## Tutorials Baseline Panda application The Simplest Possible Shader. So simple that its useless. The simplest possible useful shader. Applying colors to the model as defined in the model file. Applying colors with the vertex and fragment shaders. Pass information between the vertex and fragment shader. Passing inputs to the shader and controlling it from Panda Applying one texture to your models, disregarding colors. Applying two textures to your models. Explaining details about diffuse lighting. Per vertex diffuse lighting with shaders. The concept of spaces is introduced here. Per pixel lighting with one point light. Normalization problems that may arise are explained here. Per pixel lighting with multiple point lights and attenuation.
<<prev | top | next>> |