Shaders

From Terragen Documentation from Planetside Software
Revision as of 21:34, 8 October 2018 by BFlasher (talk | contribs)
Jump to: navigation, search

Shaders are a familiar concept in the computer graphics industry and are used in many other 3D applications. Fundamentally, a shader applies color and texture to a surface. In computer graphics terminology, a “shader” is the set of instructions that dictate how a particular surface will be shaded, including aspects like diffuse color, luminosity, specularity and reflectivity, transparency, displacement, and much more. Shaders often act on input from other elements of the scene such as light sources, determining the final color of the surface by combining lighting effects with base surface properties.

In Terragen, all scene elements are depicted as “nodes,” and virtually any node that applies to a surface is a shader. Shader nodes are of two primary types in Terragen: “compound nodes” and "function nodes." The term “compound node” refers to shader nodes like the power fractal which encompass a great deal of functionality and internal complexity in a single node interface. While you won't see the term “compound node” used to refer to any specific node in the Terragen interface, it is a useful term to refer to nodes which are not function nodes and which have greater encapsulated functionality.

Function nodes, on the other hand, are the most basic building blocks of a shader, often times comprised of individual simplistic math operations such as add, subtract, sine, and cosine. Experienced shader writers and those who have a firm grasp of how mathematics applies to computer graphics can use these individual functional components to build whole networks, with complex interactions that comprise surface shaders capable of producing unique and powerful effects. Function nodes are the building blocks that those who are experienced writing shaders in other applications may find most familiar, however Terragen provides so-called compound nodes for the most often-used and important effects like simple surface shading with altitude control, or image mapping. As a beginner or intermediate Terragen user, you will seldom have need to use function nodes. This capability is provided for those with unique requirements or who need more specific control over their shader output and who have the appropriate knowledge and experience to effectively build shaders from scratch.

A shader is a program or set of instructions used in 3D computer graphics to determine the final surface properties of an object or image. This can include arbitrarily complex descriptions of light absorption and diffusion, texture mapping, reflection and refraction, shadowing, surface displacement and post-processing effects. In Terragen 2 shaders are used to construct and modify almost every element of a scene.

Literally, to change the position of something. In graphics terminology to displace a surface is to modify its geometric (3D) structure using reference data of some kind. For example, a grayscale image might be taken as input, with black areas indicating no displacement of the surface, and white indicating maximum displacement. In Terragen 2 displacement is used to create all terrain by taking heightfield or procedural data as input and using it to displace the normally flat sphere of the planet.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.