Get Normal

From Terragen Documentation from Planetside Software
Revision as of 06:25, 2 May 2011 by Matt (talk | contribs) (Get Normal)
Jump to: navigation, search

Get Normal[edit]

Get Normal

Provides the surface Normal (or a reasonable equivalent), in world space, of the current Render State. The Render State is affected by any shaders which were called before this function is called, among other things.

Normal is usually the most recently calculated surface normal at the current point on the surface being rendered or sampled, but other may be modified by other shaders, e.g. Redirect Shader.

When used in the context of displacement, for example in a function network that feeds a displacement shader, Normal depends on where the node is connected with respect to Compute Terrain and Compute Normal, and may also depend on other displacement shaders. Initially the normal is derived from the undisplaced surface being rendered. On imported objects such as OBJs or TGOs, normals are often provided by the object file and (optionally) interpolated to give a smooth surface for displacement and shading. On terrains these are initially set to the normal at the point on the flat planet from which the terrain was displaced, but may be updated by Compute Terrain or Compute Normal nodes to provide a more detailed representation of the surface relief.

When used in the context of providing colour and lighting to a surface, for example in a function network that feeds a shader's colour or luminosity, Normal is always the "final normal" after all displacement and includes micro-polygon details. By the time a shader's colour and lighting is calculated, all displacements for that point have been performed and the renderer has already recalculated the normal for the micro-polygon or surface point.

When sampling an atmosphere shader, Normal is usually set to the local "Up" vector with respect to the planet to which the atmosphere shader is attached.

For some shading uses it may be better to use Get Normal in Texture, because that often provides a value that is consistent between displacement and colour contexts, but Get Normal provides more detail for colour and lighting.

The Input connection is not used by this node.

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

A vector is a set of three scalars, normally representing X, Y and Z coordinates. It also commonly represents rotation, where the values are pitch, heading and bank.

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.