ESL - Extensible Shading Language

Homepage - Examples - MyShader.esl


Introduction

ESL (pronounced like �easel�, the artists� platform) is a high level shading language, with a graph based / object-oriented design intended to solve the problems of large scale shader development. It combines a clean programming language with a flexible graph structure to allow game programmers, artists and engine developers to have more control over their shaders while focusing their attention on what makes each particular material shine.

Current generation shading languages lack the kind of internal structural flexibility needed to create different versions, combinations and LODs of materials based on a material graph outline. For this many game engines and editors implement their own shader builder which takes their high level material representations and wrangles it into HLSL using specialized code. ESL replaces this complex proprietary system with a clean programmable compiler style solution which lets the developers write classes in a simple object-oriented shading language, the artists connect these objects in an intuitive fashion (or easily export them from Maya/Max), and then the game engine manages the compiler which translates these two into HLSL or another directly usable shading language. The key is an object oriented shading language with a clean high-level structure which easily compiles out so that the resulting shader is just as efficient as if written directly in HLSL without nice classes. In this way you get an extremely easy to create and evolve shader builder with tons of compiler optimizations which would takes ages to write into your own builder.

Language Doc

The language doc gives both overviews and details on the primary features included in ESL. This includes the design, implementation and philosophy behind each item. Because the ESL language is more of an extension to HLSL rather than a completely new language, the document only covers those features which are not present in HLSL or C#.

Examples

Here are a few examples of what you can easily do in ESL. For more examples, check out the examples page.

This is roughly the simplest shader you can write in ESL, it just multiplies the vertex position by the projection matrix and declares a float4 constant which is passed out as the pixel color. Keep in mind that ESL's syntax was designed as a hybrid between HLSL and C#.Full description here.

class HelloShader adds IMaterial
      <description="A very simple shader.">
{
      app float4x4 ProjMatrix : PROJECTION_MATRIX;
      user attrib float4 RawPosition : POSITION <uitype="position_model">;
      user float4 AmbientColor <uitype="color">;
 
      float4 ProjectedPosition = mul( RawPosition, ProjMatrix );
      override float4 FinalPosition = ProjectedPosition;
      override float4 FinalColor = AmbientColor;
}

 



ESL is a fundamentally graph based language, shown to the right is an object graph which generates the shader seen above. This graph was created in the ESL_Designer visual editor and impliments a refracted screen oriented texture which fades into reflected reflected environment map for points which reflect at a strong angle. This is somewhat similar to the water shader in Half-Life 2. The point is that this complex effect could be quickly created from a number of small and easy to impliment classes.

Full description here, and see the classes which make up this material here.

More Examples

Download

ESL.zip

REQUIRES: .Net 1.1, DirectX 9.0c, and "DirectX for Managed Code". If FxViewer crashes when you try to open it, it probably means you don't have "DirectX for Managed Code". I've prepared a small installer for it, just un-zip and run dxsetup.exe, assuming you already have .Net 1.1 and DirectX 9.0c

This download contains:

ESL_Designer - An easy-to-use visual graph editor which uses the classes defined in an ESL file to generate a valid material and then exports it as an Fx shader (i.e. includes the ESL compiler). Most of the examples from the examples page are also included and can be loaded up and edited in the designer.

FxViewer - An example DirectX application which reads the Fx shader outputted by ESL_Designer and renders an object with that shader. It is an only very slightly modified DirectX SDK sample, intended to show that ESL can be used 'under-the-hood' very easily.

Also includes: ESL.doc, System.esl and MyShader.esl

PLEASE feel free to modify the classes in MyShader.esl by adding new ones or modifying the ones in there. Any changes you make to this file will show up in the designer and command line compiler. The internal compiler includes pretty good syntax and compiler errors (with name, line and column) and so you shouldn't have a hard time writing new code.

NOTE: This package does contain some of the example media from the DirectX SDK. Because this is not a publicly exposed webpage yet, I think that is okay for now.

Screen shot of ESL_Designer:

About

ESL was designed and implimented by Lewey Geselowitz (me). Please keep in mind that this is still just a prototype so if you have any questions, suggestions or thoughts I would love to hear them. Feel free to contact me at lewey@ufl.edu.

 

 

Copyright 2006 Lewey Geselowitz