Release Notes for Version 2.8

From C4 Engine Wiki
Jump to navigation Jump to search

Release date: April 17, 2012

Core Engine

  • The config file variables.cfg is now named engine.cfg. This change was made because the file can now store more information than just the values of the system variables.


  • The velocity-depth-gradient buffer has been given the new name "structure buffer", and there is a new option in the Graphics Manager called kRenderOptionStructureEffects. If either kRenderOptionStructureEffects or kRenderOptionMotionBlur is present, then the structure buffer is available for use by shaders and by post-processing.
  • There is a new shader process called Delta Depth that can be used to obtain the scaled difference between the linear depth of the pixel being shaded and the linear depth stored in the structure buffer, clamped to [0,1]. This is useful for implementing things like soft particles.
  • There is a new shader process called Linear Ramp that remaps a range of a given width centered around a specific value to the range [0,1] and saturates.
  • There are new shader processes called Paint Texcoord and Paint Texture that can be used to sample from the paint space associated with the object being rendered. (See description of paint spaces below.)
  • A new flag called "Enable per-sample shading" has been added to materials. On hardware that supports it, this turns on the ability to run the fragment shader for each sample position, which can be used to antialias edges produced by the alpha test. If "Enable per-sample shading" and "Use alpha multisample coverage" are both enabled (and the hardware supports sample shading), then alpha multisample coverage is disabled.
  • Support for the WGL_EXT_swap_control_tear extension has been implemented. If the display flag kDisplayRefreshSync (renamed from kDisplayVerticalSync) is set, then framebuffer swapping is synchronized with the monitor's refresh cycle. If the display flag kDisplaySyncTear is set in addition, then the synchronization only occurs when the frame rate is high enough to beat the next refresh, and otherwise, an unsynchronized swap takes place immediately after a frame is finished rendering.

World Manager

  • The visibility hierarchy and transform hierarchy have been decoupled. The transform tree still exists in the same form that it always has and corresponds to the node/subnode relationships. The visibility system now uses a new DAG structure on a hierarchical grid with fixed cell sizes inside each zone. Nodes are inserted into this DAG automatically by the engine.
  • The infinite zone now has a special bounding box that is used to define the maximum extents of the visibility graph with that zone. This box should be resized in worlds with large outdoor areas in the infinite zone so that the box encloses all static nodes other than terrain and water. The default box size is 1×1×1, but the benefits of the visibility graph don't kick in until it's at least 16 m wide in either the x or y directions. Nodes outside the box will still be visible, but they won't be part of the visibility DAG. Subzones are not affected by the infinite zone's bounding box.
  • A new feature called "paint spaces" has been implemented, and these allow 2D painting canvases to be placed in a world. Each painting canvas holds a 1-, 2-, or 4-channel texture map, and this texture is projected onto all of the geometries that are associated with the paint space. A paint space has its own texture coordinate system that is independent of any geometry. The texture coordinates and texture map itself are accessed through the new Paint Texcoord and Paint Texture shader processes. Paint spaces can be used to hand paint details onto geometries for a multitude of purposes. (See description of painting tools below.)
  • The ReferenceMarker class has been renamed to Instance, and it is now a top-level node type instead of a subtype of marker.
  • A new modifier called "Replace Material" has been added to the engine. When this is assigned to an instance, it indicates that the material should be replaced for the named node in the instanced world or for all geometry nodes if no name is given. A material object can then be set for the instance node itself in order to specify what material gets applied to the affected geometries in the instanced world.
  • A new modifier called "Move Connector" has been added to the engine. This modifier takes an incoming connection attached to an instance node and redirects it to a named node in the instanced world.
  • Occlusion spaces and occlusion portals have been enhanced so that they can cull objects that may not be completely obscured by the occluder, but for which the unoccluded parts are outside the view frustum.
  • If both stencil shadows and shadow maps are enabled for a geometry node, and the geometry is rendered into the shadow map for a particular light source, then the geometry will no longer cast a stencil shadow for the same light source.
  • There is a new flag for sound sources that indicates that a sound should start playing from a random position each time it becomes audible. This works with looping, non-streamed sources, and it's useful in places where the same sound can be heard from multiple objects that are close together.
  • A new setting has been added to remote portals that allows you to specify a focal length multiplier for the camera used to render the scene through the portal. Values higher than 1.0 have a magnifying effect.
  • Impostors are now rendered with corners clipped off where possible to reduce dead fill. This results in a significant speed increase in scenes that make heavy use of impostors. An impostor's texture maps must be regenerated in order to calculate the clipping data. Corner clipping can be disabled for the top and/or bottom edges of an impostor in the impostor property settings used to generate the texture maps.
  • Node connectors now have keys that are strings up to 15 bytes in length, and the keys can contain any characters except '$', '%', and '&', which are reserved for use by the engine. Nodes can advertise built-in connectors, and keys for those always begin with a '%' character. Connectors no longer carry information about what type of node they are allowed to connect to.
  • Inter-zone sound flow analysis has been improved significantly in this version.
  • A new function called QueryProximity() has been added to the World class. This function enumerates all geometry nodes and rigid bodies that intersect a given sphere and calls a user-supplied callback function. The QueryProximity() function replaces all previously existing node enumeration functions.
  • The World::QueryWorld() function has been renamed to QueryCollision().


  • Particle systems can now specify the kParticleSystemSoftDepth flag to enable soft geometry intersections.
  • Quad effects can now have soft geometry intersections enabled in their node settings.


  • It is now possible to specify that the convex hull of a geometry be used for collision detection instead of the exact triangle mesh. This can be set under the Collision tab in the Node Info window. Using the convex hull produces much more stable collision detection for objects with small details, and it is much faster for all mesh geometries.

Interface Manager

  • A new PaintWidget class has been added. It allows interactive painting on a canvas inside a rectangular viewport, and it exports functions for changing brush size, color, and fuzziness from scripts.
  • The ImageWidget class now lets you specify a secondary texture image, and it modulates the primary image. All subclasses of ImageWidget can also use this functionality, and it is particularly useful for masking camera widgets and movie widgets so they can have any shape you want.
  • The last visited directory for each type of resource opened with the file picker is now persistent and remembered in subsequent runs of the engine. This information is stored in the user's engine.cfg file as a series of visit commands.
  • File pickers now allow multiple files to be selected. This is enabled by setting the kFilePickerMultipleSelection flag when the file picker is constructed. The new FilePicker::GetFileNameCount() function can be used to determine how many files are selected, and the existing FilePicker::GetFileName() function now takes a file index as a parameter.


  • The execution model for scripts has been improved in this version. It is faster and more robust in cases where complex looping and branching structures are used.

System Utilities

  • The data serialization system has been largely redesigned, and it no longer needs to call the Pack() function to determine the size of the data that will be serialized, but only to perform the actual serialization. Also, new functions called BeginSection(), EndSection(), BeginChunk(), and EndChunk() have been added to the Packer class to assist in the measurement of data sizes that are written to the output stream.
  • The Packable::UnpackChunkList() function template no longer takes a pointer to a callback function as its last parameter. Instead, this function always calls the UnpackChunk() function belonging to the class corresponding to the template parameter.
  • The term "cookie" is now used throughout the engine in reference to a user-defined pointer that is passed to callback functions.

Math Library

  • A new Antivector4D class has been added to the engine, and it is now used to represent all planes.


World Editor

  • A bounding box is now displayed in the perspective viewport around the selected node that currently has the gizmo. (Tab and Shift-Tab can be used to move the gizmo to different selected nodes.) Clicking in a face of the bounding box with the Move tool lets you drag the node along the direction perpendicular to that face. Clicking on an edge of the bounding box with the Rotate tool lets you rotate the node about the axis parallel to that edge through the center of the box.
  • A new orbit camera tool has been implemented, and it works in the perspective viewport. The orbit camera tool orbits the camera about the center of the selected node that currently has the gizmo. If the Control key is pressed when you left-click in the viewport, then the orbit tool takes effect until you release the mouse button no matter what other tool might be currently selected. If there is no selection, then the center of the orbit is the world-space origin.
  • A new Paint page has been added to the editor, and it provides tools for painting into the texture maps held by paint spaces. The Paint page contains tools for setting brush color, strength, radius, and fuzziness as well as a channel mask and a popup menu with paint-related commands. The paintbrush tool lets you draw directly onto geometries in the perspective viewport, and this has the effect of altering the texture image belonging to the paint space associated with those geometries. The visual appearance of the paint texture depends on how it is used in the material shaders assigned to the geometries.
  • A world preview is now displayed when browsing world resources to be specified for a node setting. This is particularly convenient in the settings for the instance node so that you can see each prefab as you're browsing through your Data directory. The preview window adds an infinite light source to the world and sets the ambient light to 50%. You can move the camera by clicking and dragging inside the preview.
  • A sound preview is now available when browsing sound (.wav) resources to be specified for a node or object setting. Play and stop buttons appear whenever a sound file is selected.
  • Multiple worlds can now be simultaneously selected in the Worlds page. If more than one world is selected, then one of them is chosen at random each time you click in the scene to place an instance.
  • A new command called Paste Subnodes has been added to the Edit menu. This command is enabled when exactly one node is selected, and it pastes everything as subnodes of the selected node.
  • Changes made in the Node Info window can now be undone. This includes settings under all tabs as well as changes made in the Script Editor or Panel Editor.
  • The settings under the Collision tab in the Node Info window have been reversed so that you specify what kinds of collisions are allowed instead of what kinds of collisions are excluded.
  • When a material is imported from a .mtl file, it's name is now automatically set to the file name of the imported material resource, without the extension.
  • The Connectors pane in the Node Info window has been changed to display a list of built-in connectors available for a node in addition to the list of custom connectors that can be added by the user.
  • A title, such as "Top", "Left", "Perspective", or "Scene Graph", is now displayed in each viewport. These can currently be toggled off using the same button in the Grid page that toggles off the axes display.

Script Editor

  • Output ports have been added to the method boxes in the Script Editor, and new fibers are now created by clicking in an output port and dragging to another method box. The separate fiber tool that previously existed has been removed.
  • After a new method is placed in a script, the current tool automatically switches back to the select/move tool.

Shader Editor

  • Output ports have been added to the process boxes in the Shader Editor, and new routes are now created by clicking in an output port and dragging to another process box. The separate route tool that previously existed has been removed.
  • After a new process is placed in a shader, the current tool automatically switches back to the select/move tool.

Texture Tool

  • There is now a dialog for generating terrain texture palettes. It can be opened by selecting "Generate Terrain Palette..." from the C4 Menu or by typing texpal with no parameters in the Command Console.
  • The time-consuming operations in the texture importer now get distributed to all available processors, and many textures can be imported n times faster with n cores. This applies to horizon map generation, ambient occlusion channel generation, alpha test bleeding, and S3TC compression.

Collada Importer

  • The Collada import dialog now has a box where a scale factor can be entered.