Simple Document Structure

You need one of the following products to complete this exercise: Scenome® Platform Binaries

This section describes common document layout and structures you'll encounter throughout these exercises. You can skip this section and move on to the exercises if you wish.

It's important to know that you don't create these resources manually. Most of these resources are created by the application when you create a new file. Additional resources, such as uniforms, uniform buffers, or shader buffers, are automatically created when you modify your GLSL source code and execute the Shader app's document build command. Most of the time you only need to edit nodes and specify the values you want to use. Sometimes you will create new textures or load textures from disk.

The general philosophy of Scenome is that work should be automated wherever possible.

Overview

Sometimes a simple shader document is just what you need. You can use the basic shader documents that you create to implement vertex, tessellation, geometry, and fragment shaders.

This document was created with the File » New Shader command and is basically a very simple vertex and fragment shader. You notice sections for Includes, Locals, Visual Shader, Visual Resources, and Execute Workload.

This is a picture of the graph.

Includes

In the Includes section, it's possible to include content from other documents. Most of the time, this is handled automatically when you are using the Shader application. However there may be times when you wish to import content from another document.

This is a picture of the includes section of the document.

Options are:

Locals

In the Locals section, it's possible to declare local variables. You might use local variables to store a value that will be used by a shader, but not necessarily set as a shader constant. Or you might declare a local variable and then use its value to drive events that modify other nodes in the document.

This is a picture of the locals section of the document.

Options are:

Visual Shader

In the Visual Shader section, we connect the <Program> node to the vertex and fragment shader source code. Private uniforms (uniforms that you should not modify) are found below the <Program>. In this case you can see uniform mat4x4 modelViewMatrix, and uniform mat4x4 modelViewProjectionMatrix, which are used to render the mesh. The Visual Shader section separates the <Program> from resources so that you can define multiple sets of resources used by one <Program>.

This is a picture of the visual shader section of the document.

Options are:

Visual Resources

In the Visual Shader section, we specify resources used to render a <Mesh>. <Mesh> nodes are most often used to provide a surface to render the results of shaders. This section also includes public uniforms, materials, textures, and samplers. This structure is used to help keep your document nicely organized.

This is a picture of the visual resources section of the document.

Options are:

Execute Workload

Drawing and workload execution is specified in the Execute Workload section. In this example, you can see a <NodeLink> to a <Mesh> node. This causes the <Mesh> to be rendered, which renders the <Mesh> object's <Material> nodes. This in turn invokes rendering of the <Program>, the <SamplerNode> objects and so forth.

This is a picture of the execute workload section of the document.

Options are: