ashli - advanced shading language interface - home -...

1
ASHLI - Advanced Shading Language Interface Arcot J. Preetham, Avi Bleiweiss ATI Research Silicon Valley Inc, USA INTRODUCTION: 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 Ashli provides the artist a framework for mapping arbitrary complex shaders onto graphics shading hardware, while alleviating resource limitation concerns. More details on Ashli can be found in [1]. Input: Ashli is multi-lingual at its input and operates on a program, destined for compilation. A program is a collection of RenderMan(r) shaders e.g. displacement, surface, light, volume and imager types or OpenGL shaders - vertex and fragment. Output: Incoming shaders are translated to any of DirectX 9.0 Vertex and Pixel Shader Version 2.0 or OpenGL ARB_vertex_program and ARB_fragment_program API's. 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 and sampler registers. Design: 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. Multipassing: 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. Ashli's multipass implementation is based on the technique demonstrated by Chan et al. [2]. ASHLI VIEWER We developed Ashli Viewer to demonstrate Ashli by rendering complex shaders on graphics hardware, at real time rates. Ashli Viewer takes in a scene file that describes the material properties of the geometry and the lights in the scene. The scene description also contains hints such as the range of values applied to appearance runtime parameters, in the form of GUI sliders. The high level shaders in the scene file are compiled to low level target shaders, using Ashli. The formals metadata generated by Ashli are parsed to set up hardware shading state and texture binding. In the case of multiple shader segments or in the presence of imager shaders, intermediate passes are rendered into floating point buffers, which are used as textures in subsequent passes. Ashli Viewer runs on both OpenGL and DirectX API platforms. ACKNOWLEDGEMENTS: We would like to thank Dominik Behr, Mike Huber, Seth Sowerby, Matt Komsthoeft, Derek Whiteman, Raja Koduri & Mark Peercy for helping us with Ashli project. REFERENCES [1] Avi Bleiweiss, Arcot J. Preetham: ASHLI - Advanced Shading Language Interface, Real-Time Shading Course, Siggraph 2003. [2] Eric Chan, Ren Ng, Pradeep Sen, Kekoa Proudfoot, Pat Hanrahan: Efficient Partitioning of Fragment Shaders for Multipass Rendering on Programmable Graphics Hardware, 2002 Graphics Hardware. Apple shader 4 passes (175 instructions) Cartoon shader 1 pass (20 instructions) Flame shader 3 passes (172 instructions) object potato background ramp rotate x -90 rotate z 90 translate z -2.2 light ambientlight.sl common lightcolor common intensity material potato shader potato.sl float fleckfrequency 8 range 0 20 material all_else shader matte.sl float Ka 0.1 light distantlight2.sl vector dir -0.2 -0.5 -1 color lightcolor 1 1 1 float intensity 1 common dir common lightcolor common intensity light distantlight2.sl vector dir 1 1 0 color lightcolor 1 1 1 float intensity 0.4 common dir common lightcolor common intensity Block Diagram Scene File Screenshot (rendering and UI controls) Screenshot (shaders and target programs) RenderMan Shaders Ashli Viewer Scene Parser Render Engine Ashli Scene File Constant and Texture mappings Graphics Hardware API calls Fragment Programs Formals File Formals Parser or OpenGL SL Vertex Programs CONCLUSION: We have shown that arbitrary length complex DCC shaders can be rendered on modern floating point programmable graphics hardware in real time. DOWNLOAD: Ashli Demo can be downloaded from http://www.ati.com/developer/news.html Interactive Demos & Poster Presentations Eurographics, Sep 1-6, 2003; Granada, Spain. Wood shader with shadows 4 passes (189 instructions)

Upload: others

Post on 21-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ASHLI - Advanced Shading Language Interface - Home - AMDdeveloper.amd.com/wordpress/media/2012/10/AshliViewerPoster.pdf1 pass (20 instructions) Flame shader 3 passes (172 instructions)

ASHLI - Advanced Shading Language InterfaceArcot J. Preetham, Avi Bleiweiss

ATI Research Silicon Valley Inc, USA

INTRODUCTION: 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

Ashli provides the artist a framework for mapping arbitrary complex shaders onto graphics shading hardware, while alleviating resource limitation concerns. More details on Ashli can be found in [1].

Input:Ashli is multi-lingual at its input and operates on a program, destined for compilation. A program is a collection of RenderMan(r) shaders e.g. displacement, surface, light, volume and imager types or OpenGL shaders - vertex and fragment.

Output:Incoming shaders are translated to any of DirectX 9.0 Vertex and Pixel Shader Version 2.0 or OpenGL ARB_vertex_program and ARB_fragment_program API's. 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 and sampler registers.

Design: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.

Multipassing: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. Ashli's multipass implementation is based on the technique demonstrated by Chan et al. [2].

ASHLI VIEWER

We developed Ashli Viewer to demonstrate Ashli by rendering complex shaders on graphics hardware, at real time rates. Ashli Viewer takes in a scene file that describes the material properties of the geometry and the lights in the scene. The scene description also contains hints such as the range of values applied to appearance runtime parameters, in the form of GUI sliders. The high level shaders in the scene file are compiled to low level target shaders, using Ashli. The formals metadata generated by Ashli are parsed to set up hardware shading state and texture binding. In the case of multiple shader segments or in the presence of imager shaders, intermediate passes are rendered into floating point buffers, which are used as textures in subsequent passes. Ashli Viewer runs on both OpenGL and DirectX API platforms.

ACKNOWLEDGEMENTS: We would like to thank Dominik Behr, Mike Huber, Seth Sowerby, Matt Komsthoeft, Derek Whiteman, Raja Koduri & Mark Peercy for helping us with Ashli project.

REFERENCES[1] Avi Bleiweiss, Arcot J. Preetham: ASHLI - Advanced Shading Language Interface, Real-Time Shading Course, Siggraph 2003.[2] Eric Chan, Ren Ng, Pradeep Sen, Kekoa Proudfoot, Pat Hanrahan: Efficient Partitioning of Fragment Shaders for Multipass Rendering on Programmable Graphics Hardware, 2002 Graphics Hardware.

Apple shader4 passes (175 instructions)

Cartoon shader1 pass (20 instructions)

Flame shader3 passes (172 instructions)

object potatobackground ramprotate x -90rotate z 90translate z -2.2

light ambientlight.slcommon lightcolorcommon intensity

material potatoshader potato.slfloat fleckfrequency 8 range 0 20

material all_elseshader matte.slfloat Ka 0.1

light distantlight2.slvector dir -0.2 -0.5 -1color lightcolor 1 1 1float intensity 1common dircommon lightcolorcommon intensity

light distantlight2.slvector dir 1 1 0color lightcolor 1 1 1float intensity 0.4common dircommon lightcolorcommon intensity

Block Diagram

Scene File

Screenshot (rendering and UI controls)

Screenshot (shaders and target programs)

RenderMan

Shaders

Ashli Viewer

SceneParser

RenderEngine

Ashli

SceneFile

Constantand Texturemappings

GraphicsHardwareAPI calls

FragmentPrograms

FormalsFile

FormalsParser

or OpenGL SLVertexPrograms

CONCLUSION: We have shown that arbitrary length complex DCC shaders can be rendered on modern floating point programmable graphics hardware in real time.

DOWNLOAD: Ashli Demo can be downloaded from http://www.ati.com/developer/news.html Interactive Demos & Poster PresentationsEurographics, Sep 1-6, 2003; Granada, Spain.

Wood shader with shadows4 passes (189 instructions)