The support for floating point computation and the exposure of shading functionality in a standardized API form have made graphics hardware a viable workflow solution to an artist involved in digital content creation (DCC). Nevertheless, there still remains a significant interface void between the abstract shading description an artist is used to and the low level shading constructs the hardware expects. We have developed Ashli, an advanced shading language interface tool, with the primary motivation to bridge the interface gap fore mentioned.Ashli provides the artist a framework for mapping arbitrary complex shaders onto graphics shading hardware, while alleviating resource limitation concerns.
Ashli is multi-lingual at its input and supports a reasonable subset of the RenderMan ®, DirectX (HLSL) and OpenGL (GLSL) languages. It operates on a program entity, which is a collection of shaders, destined for compilation. A RenderMan® program is a combination of any of displacement, surface, light, volume and imager shader types. HLSL and GLSL programs are composed of vertex and pixel (fragment) shaders.
Incoming shaders are compiled to any of DirectX 9.0 Shader Models 2.0 and 3.0, and OpenGL ARB_vertex_program and ARB_fragment_program API’s. Optionally, Ashli emits metafile in the Microsoft FX format, which encapsulates hardware shader segments and techniques. In addition, Ashli generates a formals text metadata structure that specifies the mapping of runtime appearance parameters onto hardware shader resources, such as input, constant, sampler and output registers.
Ashli embeds traditional complier technology with a front end and a back end component. Ashli folds all shader instances in a program into one, while optimally unrolling lighting constructs. The folded shader is then distributed onto graphics hardware processors – vertex and pixel. A simplification process converts all original input expressions to a native instruction set, to closely match the target low level language. Constant folding and dead code elimination is part of Ashli’s optimization. Code generation is the final stage with the goal of reducing usage of temporary registers and dependant texture accesses.
Often times, a complex high level shader may not fit the scarce graphics hardware resources. Exceeding the number of any of input, constant, temporary or sampler register or reaching instruction space limits is considered an unrecoverable compile error. Ashli automatically breaks the complex shader into many smaller segments (passes), where each segment uses up resources within the prescribed hardware limits.
figure1.jpg – Snapshot of Ashli Viewer
showing the list of programs,
RenderMan® shader and target
figure2.jpg – Snapshot of a rendered
scene in window mode with the
controls for adjusting the properties
of the wood material.