User Tools

Site Tools


The SpeedTree SDK includes a sample shadow system to detail how our classes and shaders may be made to interact with a typical cascaded shadow map system. The SRT Exporter includes an option for generating a set of shaders optimized for use with a depth-only pre-pass or shadow casting. Note that this will result in a near doubling of the number of shaders that have to generated and loaded.

The depth-only shaders are designed to be used with the same VB/vertex-decl as the lit shaders, but the order of vertex attributes are set such that the subset of attributes needed for depth-only rendering are at the front of the vertex decl, possibly helping to reduce the number of fetches necessary per vertex. Because there are so many effects available, making the vertex declarations very fluid from tree-to-tree and LOD-to-LOD, there is no gaurantee of single fetches per vertex.

The shadow-casting shaders generated by the Compiler can still be used with most shadow-mapping approaches.

Forward Rendering

Our example forward rendering shadow system is in place to i) enable rapid prototyping of real-time shadow maps, ii) demonstrate that SpeedTree can work in a completely dynamic lighting environment, and iii) work out the problems associated with rendering geometry using shadow maps so that integrations may go more smoothly. Our shadow system can be decoupled from the shaders very easily and we expect this will happen in every SpeedTree/engine integration.

Note: SpeedTree has a user interpolant system if you find that your shadow system needs to pass extra data into the pixel shaders.

Deferred Rendering

The only way the SpeedTree pipeline and SDK can assist with shadows in a deferred system is by generating appropriate shadow-casting shaders. The rest of the shadow system is independent of the shaders generated by the SpeedTree pipeline.