Unity Products:Amplify Impostors/Manual

From Amplify Creations Wiki
Jump to: navigation, search

Product Page - Manual - Roadmap

Description

Amplify Impostors is a small but powerful tool that allows the creation of different types of Impostors, which are substitutes of complex high polycount objects made from flat and simple polygons, that render a fake version of the original object (hence the name). Much like traditional sprites, they usually consist of a single flat quad polygon or simple polygonal shapes and, like classic billboards, always face the camera. Think of them as a camera facing cardboard version of the object you want to render. The common purpose of using such technique is to be able to represent far distant objects with a very low polycount, for instance, trees, bushes, rocks, ruins, buildings, props, etc.

There are various ways these impostors can be created, each with their own advantages and disadvantages. This tool intends to provide the most useful and popular techniques while making the process of creating them as simple as possible.

Installation

  1. Open AmplifyImpostors.unitypackage
  2. After Unity loads it will display the "Importing package" window, select All and click Import

Quick Start Instructions

  1. Select a game object in the scene or a prefab in your project
  2. In the inspector window search for and add the "Amplify Impostor" component
  3. Press "Bake Impostor" and select where you want to save the impostor files

Current Features

Impostor Types

Three pre-baked Impostor types are currently supported

(Real mesh on the left, impostor on the right)

SphericalExample.gif Spherical.png
  • Spherical: Takes multiple shots in a typical latitude-longitude format. The shader is simpler and faster and the impostor looks mostly okay from close distances, but popping between frames is fairly noticeable. This can be mitigated somewhat by increasing the axis frame count at expense of resolution.
OctahedronExample.gif Octahedron.png
  • Octahedron: Takes multiple shots in a icosphere format. This is done to guarantee a fixed neighbor count of three, so that at any given position relative to the camera we can blend the nearest three frames. This has the benefit of removing popping between frames. On the other hand the shader complexity is higher and, when looking at closes distances, the blending becomes too obvious with noticeable ghosting artifacts.
HemiOctahedronExample.gif HemiOctahedron.png
  • HemiOctahedron: The hemi variant is similar to regular octahedron, with the difference on taking the same amount of shots but only from the upper hemisphere of the object, effectively doubling the precision of the blending. The downside though is that, by not baking the lower hemisphere, it produces incorrect results when looking from below. This approach is typically used only if you know the object will always be viewed from above (ie: top-down cameras).

Realtime Rendering

Each one of these pre-baked solutions render surface component maps in order to support realtime lighting. This comes with support for:

  • Forward and Deferred rendering
  • Dynamic Lights and Shadows
  • Depth writing for object intersections
  • Global Illumination
  • Lightmaps
  • GPU instancing
  • Dithering cross fade

Others

  • Custom Packed Maps: Render up to 4 maps and a custom material.
    • Albedo (RGB) | Alpha Mask (A)
    • Specular (RGB) | Smoothness (A)
    • Object Normals (RGB) | Depth (A)
    • Emission (RGB) | Ambient Occlusion (A)
  • Custom Shape Editor: Automatically generates a custom shape to remove most of the transparent areas of the impostor to reduce overdraw. Also supports manual editing.

The Inspector

The inspector for the impostor is divided in two main sections, one is to setup its basic definitions and the other gives access to more advanced bake settings.

Here's the main inspector:

SimpleInspector.png
  • Impostor Asset: This is a reference to the asset that will hold most of the impostor data so if you have multiple impostor of the same object this data will be shared among them. This asset is created automatically for you with the create or bake button but you can also right-click in the project folder and create an empty one.
  • LOD Group: This a reference for a LOD Group in case it exists. This allows to automatically setup the impostor in the given LOD Group. The inspector will try to fill this reference for you when you add the component.
  • References: These are the references to the renderers that will be used to bake the impostor. You can limit what you bake to the impostor by changing these references accordingly. The inspector will try to fill this reference for you when you add the component.
  • Plus Button: Open the file browser and creates an impostor asset and automatically assigns it to the component. Doing this also makes the baking settings available.
  • Bake Impostor: Bakes the impostor using the current data asset and given path.

When an impostor asset is assigned to the component you can configure the advance bake settings:

ExtraOptions.png
  • Bake Type: Technique used for both baking and rendering the impostor. Three different techniques are currently supported with more coming in the future. See Impostor Types.
  • Texture Size: The texture size in pixels for the final baked images. Higher resolution images provides better results at closer ranges, but are heavier in both storage and runtime. Big texture sizes are rarely necessary considering the purpose of the impostor is being rendered at far distances. Various presets are offered and, if a custom resolution is necessary, press the lock icon at the right to allow for custom size fields.
  • Axis Frames: The amount frames per axis. For instance, a value of 16 represents a total 256 different shots for a single impostor (16 x 16 = 256). For spherical impostors it's possible to have different number of frames per axis by pressing the lock button at the right.
  • Pixel Bleeding: The bleeding size in pixels. Bleeding/padding expands the edge pixels of the individual shots to avoid rendering artifacts caused by mipmapping. A value of 32 means the image will expand to every direction by 32 pixels.
  • Rendering Maps: Allows to individually turn on/off the rendering of the baked maps. Useful if you need to re-bake only one map.
  • LOD Insert Mode: A rule of how the impostor will be automatically included in the LOD Group. This is only available on first bake and it will automatically change the renderers in the References field appropriately.
    • Do Nothing: Does nothing.
    • Replace Culled: Replaces the culled part of LOD Group to an impostor. Uses Last LOD as reference.
    • Replace Last: Replaces the last LOD of LOD Group to an impostor. Uses the previous LOD as reference.
    • Replace All Except First: Replaces all LODs of LOD Group to an impostor except the first. Uses the first LOD as reference.
    • Replace Specific: Replaces the target index LOD of LOD Group to an impostor. Uses the previous LOD as reference.
    • Replace After Specific: Replaces all LODs after the target index LOD of LOD Group to an impostor. Uses that LOD as reference.
    • Insert After: Inserts a new LOD as an impostor after the target index LOD. Uses that LOD as reference.
  • LOD Target Index: It's the index target for the insert mode. Only available if the current insert mode supports changing the target.

Billboard Mesh

The baker uses unity's built in shape editor to find a good approximation of the shape in place. This approximation might still need improvements in terms of polycount and shape, so some additional options are provided to better control it. Usually there's no need to touch these settings, but there might exist some odd cases where even the manual mode is necessary for some finer adjustments.

MaxVerts.gif
  • Max Vertices [4,16]: By defining a maximum number of vertices it ensures whatever the previous two operators do, the final created amount does not exceed it. If that happens, each vertex that contribute with the smallest area to the shape will be removed until the specified value is met.
OutlineTol.gif
  • Outline Tolerance [0,1]: This parameter allows the final shape to more tightly fit the object by increasing its number or vertices. A tolerance of 0 will make sure the generated shape encapsulates the entire object, even if it means a more loose and simplified mesh, while a value of 1 will try to fit the shape as close as possible with a reasonable number of vertices.
NormalScale.gif
  • Normal Scale [0,1]: This scales the vertices out according to the shape normals. If the shape touches the preview quad borders, they get clamped and vertices are eliminated if necessary. A quick way to produce a quad is to max this value out.
ManualMesh.gif
  • In the manual mode you can still use the automatic tools but you can further tweak each vertex position individually.

Global Preferences

Some behaviors of the inspector and resulting bakes can be changed globally. You can find these settings in Edit > Preferences > Impostors.

GlobalPreferences.png
  • New Impostor Default Path: At the first bake, and if not set, the editor will suggest a relative folder when the object is a prefab or an instance of one. It will then remember the path for every subsequent bake. You can change the proposed folder here by using a relative valid path. If you want to keep all your impostors at the same place and don't be bothered again, you can also set them in a global folder by changing the option to Global, you can then use the right browse button.
  • Texture Importer Settings: When rebaking the impostor with a different texture resolution you can change how the inspector behaves here (options are self-explanatory):
    • Ask if resolution is different
    • Don't ask, always change
    • Don't ask, never change
  • Create LODGroup if not present: Setting this ON will automatically create a hierarchy with LOD Groups and setup the original object with the impostor in it. Only works if original object doesn't already has a LOD Group.
  • Suffixes: By default the files generated share the same name as the original object with an added suffix, you can change the suffixes here.

FAQ

Q: Does this replaces LODs?

A: Mainly no. Don't think of this as a replacement of regular LODs since impostors look progressively worse at close range, but more as an extension of it by replacing the last LOD level. For close to medium ranges you still want to use regular LOD meshes.


Q: Does it support unity LOD groups?

A: Yes, and also supports cross-fading. Just make sure to bake an impostor that matches the previous LOD level object for the best match when transitioning between the LOD levels.


Q: Why are impostor shadows so weird? Especially up-close.

A: It's partially due to the blending done between the frames which doesn't always match the binary nature of shadows, and also the differences in the depth between what lights "see" and what the camera renders. We'll try to improve this in the future, in the meanwhile you can try to refine how the shadow looks by changing the "Shadow Bias" in the light settings and/or in the impostor material property.


Q: Does it supports Anti-Aliasing?

A: Mostly. Just like regular sprites MSAA is not supported because it only helps the edges of geometry, but other screen space solutions do work, like FXAA or TXAA.


Q: Does it support Image Effects?

A: In most cases it should. There might be some precision issues if the effect is depth dependent, like SSAO, but for the most part it should work properly.


Q: Does it support metallic and specular pipelines?

A: Yes. Currently the baker generates a specular map regardless of the input materials. This ensures both pipelines are supported, as metallic maps are transformed into specular ones. In the future we intend to allow custom map bakes and shaders to support baking for both pipelines, so that metallic maps are no longer transformed into specular.


Q: Does it support skinned mesh objects?

A: No. It does however support animation of objects like moving, rotating and scaling, but not animated skinned meshes like characters. We do plan to provide a realtime baking variant that allows for animated objects to be rendered as impostors at some specified rate.


Q: Does it support SpeedTree assets?

A: Yes, and also supports hue variation. By default hue variation is off but you can turn it on in the impostor material.


Q: What can I do to improve the quality at close range?

A: Unfortunately the only thing you can do right now is to increase the texture resolution. This usually isn't enough to properly render an impostor at close range since other artifacts start to become obvious. Please notice that impostors are NOT intended to be rendered at close range, they are not a substitute for "real meshes", but rather an improvement of performance when rendering them from afar. So it's recommended that you use resolutions that are good enough for long distances. 2k maps are usually okay for that, and for mobile you can even get away with 1k maps.

Technical Considerations

Note that currently only shaders exposing a Deferred path are supported for baking, such as Unity Standard shaders. However, the Impostors created can be used in both Forward and Deferred modes. Also, while performance and quality of impostors will be continually improved, currently, Octahedron impostors have an issue where the impostor vanishes when looking directly from below.