Get Frame Number

From Terragen Documentation from Planetside Software
Jump to: navigation, search
Get Frame Number



Overview[edit]

Provides the current frame number of the current Render State. Usually this is simply the current frame number, but in future there may be shaders which modify this on the fly for special effects or new renderer capabilities to allow sub-frame values. The input connection is not used by this node (consistent with all Get nodes).


Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Get frame number nodes in a project.
  • Enable: When checked, the node is active, and when unchecked the node is ignored.


Fun with Get Frame Number[edit]

Here’s a fun way to animate cloud layers using the Get Frame Number node. We’ll use the node to drive a warp shader assigned to the Density shader input of a cloud layer. Let’s start by adding a cloud layer to the default Terragen project.

  • Click the “Atmosphere” button on the top toolbar.
  • Click the “Add Cloud Layer” button at the top of the Atmosphere Node List, and select “Mid-level: Generic”.
    Node Network view - Step 01.


Now we’ll construct the node network that feeds into the warp shader which is responsible for manipulating the clouds.

  • Click once in an empty area of the Node Network pane to focus the program’s attention there. A dotted yellow line will become visible around the Node Network pane.
  • Press the “Tab” key or “N” key to open the Quick Node Palette window.
  • Start typing the words “Get frame number” and the closest match in the Node list will be highlighted.
  • With “Get frame number” highlighted, press the “Enter” key to add it to the project.
  • Repeat this process and add a “Vector displacement shader” node and a “Warp input shader” node to the project.
  • Drag a connection line from the “Output” of the Get frame number node, to the “Vector function” of the Vector displacement shader node.
  • Double-click on the Vector displacement shader node to open its dialog window.
  • Set the “X function multiplier” value to “8”, the “Y function multiplier” value to “0”, and the “Z function multiplier” value to “40”. These values control both the direction and how quickly the clouds move, and are in metres.
  • Check the “Reverse functionparameter to make the clouds move in the opposite direction.
  • Drag a connection line from the “Output” of the Vector displacement shader node to the “Warper” input of the Warp input shader node.
  • Drag a connection line from the “Output” of the Density fractal node to the “Main input” of the Warp input shader node.
  • Finally, drag a connection line from the “Output” of the Warp input shader node to the “Density shader” input of the cloud layer.
    Node Network view - Step 02.

    Get frame number node driving warp shader to animate clouds.


In this example, we’ve used large values within the Vector displacement shader node to exaggerate how far the clouds move each frame. When you need to be more precise, for example moving the clouds 1 metre per second, you can divide the frame number by the number of frames per second.

  • Add a “Divide scalar” node and a “Constant scalar” node to the project.
  • Drag a connection line from the “Output” of the Get frame number node to the “Main input” of the Divide scalar node.
  • Drag a connection line from the “Output” of the Divide scalar node to the “Vector function” input of the Vector displacement shader node.
  • Double-click on the Constant scalar node to open its dialog window.
  • Change the “Name” to something descriptive like “Constant scalar 24FPS”.
  • Set the “Scalar” value to “24”, for 24 frames per second, or “30” for 30 frames per second, etc.
  • Drag a connection line from the “Output” of the Constant scalar node to “Input 2” of the Divide scalar node.
    Node Network view - Step 03.



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.

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.

In a graphical user interface (GUI) on a computer a toolbar is a row, column, or block of onscreen buttons or icons that, when clicked, activate certain functions of the program.

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 parameter is an individual setting in a node parameter view which controls some aspect of the node.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.