However, it's common to have a main light source shader that encapsulates all usable light parameters. This may seem like a serious limitation for production use. A similar assumption can be made for light source shaders as was made for light sources-that all lights in the scene share the same Likewise, there is no equivalent Cg statement for the concept of the RenderMan light source shader. As the number of lights in the scene increases, expect a significant decrease inĪpplication performance if the Cg program is complex. Note that although this resolves the need for rewriting the Cg program, there is a necessary performance hit from running multiple passes of our program. Program to: // Example Cg shader parameter list with multipass in mind This has the nice side effect of simplifying the parameter list of the Cg Now it is left to the application to manage this information. So it is not necessary to specify the number of lights in the scene for the Cg program. The result of the pass is then added into theįrame buffer. If all the lights have similar parameters, only the current light's parameters are bound to the current render state. The Cg program must be modified if more than ten light sources are needed.Īn alternate approach is to execute the program in a multipass fashion. It's possible to loop over the ten lights, but the process is inflexible. If there are ten lights in the scene, the parameter list might look like this: // Example Cg shader parameter list For example, if all lights in the scene are simple directionals, each light in the parameter list needs at least a Also, each light might have a grouping of similar parameters, but with different values. The number of lights in the scene must be Unfortunately, there is no equivalent statement in Cg. This statement indicates that the following code will be executed for all lights in the scene that satisfy the illuminance condition. Illuminance (P, norm_hair, radians(illum_width)) The single illuminance statement in the RenderMan fur shader code is: // RenderMan illuminance statement More information on this topic can be found in Upstill 1990. Extra information,īeyond the light color and the light direction vector, can be exchanged between the surface and the light through message passing. The illuminance statement lets the surface shader gather samples over all light sources in a scene, at the point being shaded. In RenderMan, light sources are iterated over by the illuminance statement. That's because these RenderMan constructs have no equivalent mapping. An analysis of the results, which covers the differences between the original Cg shaders and their optimizations, as well as the differences between the Cg and RenderMan resultsĪs of this writing, lights and the way they are handled are arguably the largest deviation from the RenderMan specification when writing Cg code.A comparison of vertex and fragment programs, with close attention paid to hardware-specific optimizations (which are necessary for good performance).Frequency-independent issues, particularly handling multiple light sources.The RenderMan fur shader from the movie Stuart Little is used throughout this chapter as an example of converting a RenderMan shader to a Cg program (see Berney and Redd 2000 for a description of the fur shader). For example, Listing 33-1, which contains the fur shader for Stuart Little, is in the listing1 subdirectory for You can find each listing mentioned in this chapter on the book's CD or Web site, in the appropriate subdirectory. The concepts we present are applicable to other shading languages as well. Generate many different forms of shader instructions, including OpenGL ARB_fragment program-compliant code. Using Cg does not limit the scope of the chapter, because the Cg compiler can The hardware shading language used is Cg. This chapter demonstrates that it is possible to convert a Pixar RenderMan surface shader into a hardware shader. In particular, the recent advances of graphics hardware technology and the development of hardware shading languages have offered a recognizable mapping between real-time and production effects. Consequently, visual effects houses are considering real-time gaming techniques for optimized If the rendering time takes hours per frame, it is critical to be able to visualize incremental changes in the least amount of time. Additionally, with the demand for bigger and better effects, the complexity of these shaders increases. Innovative images often leads to long rendering times. Although these shading languages are extremely powerful, the complexity they need in order to produce Since the late 1980s, visual effects houses have used shading languages to generate convincing images for the motion picture industry. Sony Pictures Imageworks 33.1 Introduction Converting Production RenderMan Shaders to Real-Time
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |