sales@scenomics.com +1 650 396 9674

Simple Document Structure

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 Visual Shader, Visual Resources, and Execute Workload.

This is a picture of the graph.

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:

  • Program. Linked to the vertex and fragment shader source code on disk. You can move the mouse over the <Program> in the application to see the sources file to which it is connected. The document is automatically updated when you make changes to your shader code. This node's child nodes are also automatically updated when you make changes to your shader code and execute the Shader app's document build command..
  • uniform mat4x4 modelViewMatrix. A <Float32MatrixNode> that captures the model view matrix from the rendering device. Typically used by the vertex shader to transform vertex shader primitive information to viewspace. For example, you can multiply the normal by the model view matrix to compute the normal in viewspace.
  • uniform mat4x4 modelViewProjectionMatrix. A <Float32MatrixNode> that captures the model view projection matrix from the rendering device. Typically this is used to multiply position attributes to compute screenspace positions.

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:

  • Uniforms. This is a <UniformPaletteNode> that stores public uniforms. GLSL has no concept of public or private uniforms, but we separate uniforms by their location in the document to provide a hint that that you should be careful when modifying certain uniforms. This node's child nodes are automatically updated when you make changes to your shader code and execute the Shader app's document build command.
  • uniform vec4 tint_color. A <ColorNode> that sets an RGBA color as a shader uniform. You can change the value of the <ColorNode> and the new value is automatically downloaded again to the GPU.
  • Materials. A <MaterialPaletteNode> stores a list of <Material> nodes used by a <Mesh>. Typically, only a single <Material> is used, but multiple <Materials> are supported.
  • Material. A <Material> stores a connection to a <Program>, <MaterialPaletteNode>, and <SamplerPaletteNode>. These resources are bound to the GPU when the <Mesh> that uses the <Material> is rendered.
  • Textures. A <TexturePaletteNode> stores a list of <Texture> nodes used by various <SamplerNodes>.
  • IPF_8888_ARGB. A <Texture> refers to a texture file on the hard disk. Scenome supports the most common OpenGL texture formats, including all floating point formats, and all 8-bit, 16-bit, and 32-bit signed/unsigned formats. You can load textures from disk or create new textures in any of the supported formats.
  • Samplers. A <SamplerPaletteNode> stores a list of <SamplerNodes> used to bind samplers to the rendering device. This node's child nodes are automatically updated when you make changes to your shader code and execute the Shader app's document build command.
  • uniform sampler2D diffuse_texture. A <SamplerNode> that binds a texture to the rendering device. This <SamplerNode> is connected to the <Texture> node named IPF_8888_ARGB.
  • Mesh. A <Mesh> that provides a surface onto which we can render results on screen. You'll notice also that vertex attributes are defined below the <Mesh>. These are automatically generated and match the vertex attributes defined in the vertex shader. This node's child nodes are automatically updated when you make changes to your shader code.
  • position. An <AddChannelModifier> that implements per-vertex position attributes. This is automatically updated when you make changes to a vertex shader.
  • texcoord. An <AddChannelModifier> that implements per-vertex texture coordinate attributes. This is automatically updated when you make changes to a vertex shader.
  • normal. An <AddChannelModifier> that implements per-vertex normal attributes. This is automatically updated when you make changes to a vertex shader.
  • color. An <AddChannelModifier> that implements per-vertex color attributes. This is automatically updated when you make changes to a vertex shader.
  • RectangleGeometryModifier. A <RectangleGeometryModifier> that implements a sheet of polygons onto which the shader is rendered.
  • CalculateSmoothNormals. A <CalculateNormalsModifier> that generates hard or smooth vertex normals. Also used to generate tangent-space normals if the mesh has the necessary vertex attributes.

This section is complete. Return to tutorials.