Products ::
Leadwerks Engine :: Materials & Shaders

Real-time surface rendering has come a long ways since the days of plain diffuse textures and lightmaps. Per-pixel lighting, reflection and refraction effects, and even GPU ray tracing are now possible, thanks to the programmable rendering pipeline. Of course, this added flexibility comes at a cost of increased complexity. Convincing materials are a combination of both good artwork and skilled programming. Leadwerks Engine includes a library of advanced shader effects an artist can choose from, as well as a flexible framework with which new effects can be added.



Editor
The Leadwerks Engine SDK includes a real-time material editor. Edit shaders in an external text editor, then press the compile button to instantly visualize the results. Or choose from our library of effects include normal mapping, specular reflection, cube mapping, parallax occlusion mapping, and more.




Shaders
Each material can have two shaders. The rendering shader is used for rendering the material on screen. The shadow shader is used when shadow maps are rendered. The shadow shader is usually a simplified version of the rendering shader. Most of the time, a fragment (pixel) shader is not used, since shadowmaps only store depth information. An exception is the case of plant and tree materials, where an alpha map is used to discard parts of the shadow. Shaders in Leadwerks Engine are written in standard GL Shading Language (GLSL), with one important addition, the Include keyword, which can be used to include code from another file.

Advanced Effects
We provide examples of reflection, refraction, soft particles, water, and other render-to-texture effects.

Asset Management
All media assets are automatically instanced and managed by the engine. When the user calls LoadMesh("mymesh.gmf") twice, an instance of the reference object is automatically returned and rendered with fast GPU batching. The moment a mesh, model, texture, shader, or material are no longer referenced by the user or any other objects (i.e. a material applied to a mesh) the asset will be deleted from memory. The abstract file system allows the user to load any kind of file without knowing exactly where in the game directory it exists. This is done by specifying the "abstract" file protocol.

For example, the following two lines will both return instances of the same material:

LoadMaterial( "meshes\vehicles\car01.mat" );
LoadMaterial( "abstract::car01.mat" );


Related Lessons:
Read the latest thoughts and ideas from the Leadwerks dev team, and learn about new features and technical details of our technology.

From here you can access our community enhanced documentation center. Constantly updated, this guide features a command reference, video tutorials and hundreds of examples.

This is the place to discuss anything related to Leadwerks technology, showcase your productions and chat with fellow developers.