API Reference
Complete API reference for Rawteous Impostors. Programmatic control and runtime access to all impostor functionality.
Getting Started
Add the RawteousImpostors component to any GameObject and configure it programmatically.
Basic Setup
using RawteousImpostors.Runtime;
using UnityEngine;
// Add component to GameObject
RawteousImpostors impostor = gameObject.AddComponent<RawteousImpostors>();
// Set source object
impostor.sourceObject = myGameObject;
// Configure settings
impostor.textureResolution = 512;
impostor.captureAngles = 8;
impostor.captureElevations = 3;
// Generate impostor
impostor.Regenerate();
Generation with Progress Tracking
Note: Impostor generation is expensive and typically done at edit-time. Use this method when you need to generate impostors programmatically with progress callbacks.
// Generate with coroutine for progress tracking
IEnumerator GenerateWithProgress()
{
var coroutine = impostor.RegenerateCoroutine((progress) => {
Debug.Log($"Progress: {progress * 100}%");
});
yield return coroutine;
}
RawteousImpostors
Main component class. Attach to any GameObject to convert it into an impostor billboard.
Properties
| Property | Type | Description |
|---|---|---|
settings |
RawteousImpostorsSettings |
All configuration options. Access all inspector settings programmatically. |
sourceObject |
GameObject |
The GameObject to generate impostor from. Can be a scene object or prefab asset. |
textureResolution |
int |
Resolution of each tile in the atlas (8-1024, power of 2). |
captureAngles |
int |
Number of horizontal azimuth angles to capture (4-128). |
captureElevations |
int |
Number of vertical elevation angles to capture (1-33). |
showGizmos |
bool |
Show gizmos in scene view displaying capture positions and angles. |
ImpostorTextureRT |
RenderTexture |
Main impostor texture atlas (read-only). |
NormalMapTextureRT |
RenderTexture |
Normal map texture atlas (read-only). |
PBRMapTextureRT |
RenderTexture |
PBR map texture atlas containing metallic, smoothness, AO, depth (read-only). |
EmissionMapTextureRT |
RenderTexture |
Emission map texture atlas (read-only). |
AtlasCols |
int |
Number of columns in the atlas grid (read-only). |
AtlasRows |
int |
Number of rows in the atlas grid (read-only). |
AtlasWidth |
int |
Total width of the atlas texture in pixels (read-only). |
AtlasHeight |
int |
Total height of the atlas texture in pixels (read-only). |
AtlasTileSize |
int |
Size of each tile in pixels (read-only). |
Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
Regenerate() |
bool skipQueue = false |
void |
Regenerate the impostor from scratch. In editor, queues for batch processing. Otherwise executes immediately. |
RegenerateCoroutine() |
System.Action<float> onProgress = null |
IEnumerator |
Regenerate with progress callback. Use when generating programmatically with progress tracking. |
GetBillboardMaterial() |
Material |
Get the billboard material. Returns null if not generated yet. Editor-only. | |
GetBillboardMesh() |
BillboardMesh |
Get the BillboardMesh component. Returns null if not generated yet. Editor-only. | |
GetEffectiveTextureResolution() |
int |
Get the effective texture resolution. Returns auto-calculated value if autoResolution is enabled, otherwise returns textureResolution. | |
UpdateMaterialPropertiesImmediate() |
void |
Update billboard material properties immediately. Editor-only. | |
UpdateSinglePropertyImmediate() |
string propertyName |
void |
Update a single material property by name. Editor-only. |
UpdateLODGroupAssignment() |
void |
Update LOD Group assignment. Adds or removes impostor from source object's LOD Group based on joinLODGroup setting. | |
SetCastEnabled() |
bool enabled |
void |
Enable or disable cast mesh generation for shadow casting. |
GetCastEnabled() |
bool |
Get whether cast mesh generation is enabled. | |
SetCastParameters() |
float threshold, float dilation, float pointReduction |
void |
Set cast mesh generation parameters. |
GetCastParameters() |
out float threshold, out float dilation, out float pointReduction |
void |
Get current cast mesh generation parameters. |
CalculateCaptureParameterHash() |
int |
Calculate hash of capture parameters. Used to detect when regeneration is needed. | |
AreCaptureParametersDirty() |
bool |
Check if capture parameters have changed since last generation. |
RawteousImpostorsSettings
Configuration class containing all impostor settings. Access via impostor.settings.
Key Properties
| Property | Type | Description |
|---|---|---|
sourceObject |
GameObject |
The GameObject to generate impostor from. |
leader |
GameObject |
Optional leader object. When set, this impostor follows the leader's settings. |
impostorMode |
ImpostorMode |
Rendering mode: TextureBased or SmoothBlending. |
blendingMode |
BlendingMode |
Blending quality: Linear, Smoothstep, Barycentric, Spherical, CatmullRom, Bicubic, AIInterpolation. |
billboardType |
BillboardType |
Billboard rotation type: Cylindrical, Spherical, or ScreenAligned. |
stepRotation |
bool |
Enable step rotation for retro sprite-like snapping. |
textureResolution |
int |
Resolution of each tile (8-1024, power of 2). |
autoResolution |
bool |
Automatically calculate resolution from bounding box size. |
maxAutoResolution |
int |
Maximum resolution when autoResolution is enabled (8-2048). |
captureDistribution |
CaptureDistribution |
Distribution mode: Grid, Fibonacci, Octahedron, or HemiOctahedron. |
captureAngles |
int |
Number of horizontal azimuth angles (4-128). Only applies in Grid mode. |
captureElevations |
int |
Number of vertical elevation angles (1-33). Only applies in Grid mode. |
hemisphereOnly |
bool |
Capture only top hemisphere. Only applies in Grid mode. |
fibonacciPoints |
int |
Number of Fibonacci points (4-1024). Only applies in Fibonacci mode. |
octahedronResolution |
int |
Octahedron grid resolution (4-32). Only applies in Octahedron/HemiOctahedron modes. |
poleScaling |
float |
Pole scaling factor (10-80). Only applies in Grid mode. |
horizontalArchLimit |
float |
Horizontal arch limit in degrees (10-360). Only applies in Grid mode. |
superSamplingMultiplier |
int |
Super-sampling multiplier (0-4). 0 = disabled, higher = better quality. |
downscalingFilter |
int |
Downscaling filter: 0 = Bilinear, 1 = Lanczos, 2 = CatmullRom. |
useFXAA |
bool |
Enable FXAA anti-aliasing. |
captureFrameReduction |
float |
Capture padding (0-1). Expands billboard mesh vertices outward. |
editBounds |
bool |
Enable bounds editing mode in scene view. |
useEditBounds |
bool |
Use custom edited bounds instead of auto-calculated. |
customBoundsCenter |
Vector3 |
Custom bounds sphere center (world space). |
customBoundsRadius |
float |
Custom bounds sphere radius (0.01-100). |
orthographicSize |
float |
Orthographic camera size for capture (0.1-10). |
gamma |
float |
Gamma adjustment (0.1-3.0). |
saturation |
float |
Saturation adjustment (0-2). |
hue |
float |
Hue shift in degrees (-180 to 180). |
emissionStrength |
float |
Emission strength (0-2). |
translucencyStrength |
float |
Translucency strength (0-32). |
invertThickness |
bool |
Invert thickness map calculation. |
sharpenStrength |
float |
Post-sharpen strength (0-10). |
denoiseStrength |
float |
Post-denoise strength (0-1). |
denoisePasses |
int |
Number of denoise passes (1-32). |
captureLightsAsEmissive |
bool |
Capture lights inside prefab as emissive. |
depthTest |
bool |
Enable depth testing for billboard. |
depthWrite |
bool |
Enable depth writing for billboard. |
alphaBlend |
bool |
Enable alpha blending for transparent billboard. |
alphaTest |
bool |
Enable alpha test (hard cutout) for billboard. |
alphaThreshold |
float |
Alpha threshold for alpha test (0-1). |
unfilteredPixels |
bool |
Use point filtering instead of bilinear for pixel-perfect rendering. |
joinLODGroup |
bool |
Automatically join source object's LOD Group. |
lodPercentage |
float |
Screen height threshold for LOD level (0.01-1). |
maxLODAdditions |
int |
Maximum number of LOD additions (1-5). |
regenerationMode |
RegenerationMode |
When to automatically regenerate: OnMouseUp, Off, OnChange, or RealTime. |
showGizmos |
bool |
Show gizmos in scene view. |
Methods
| Method | Returns | Description |
|---|---|---|
Validate() |
void |
Validate and clamp all settings to valid ranges. |
GetEffectiveCaptureDistribution() |
CaptureDistribution |
Get the effective capture distribution (handles deprecated fibonacciMode). |
Enums
ImpostorMode
| Value | Description |
|---|---|
TextureBased |
Standard texture-based impostor with instant angle switching. |
SmoothBlending |
Smooth blending between tiles for smoother rotation. |
BlendingMode
| Value | Description |
|---|---|
Linear |
Standard bilinear blending (fastest). |
Smoothstep |
Smoother curves for blending. |
Barycentric |
3-tile weighting for blending. |
Spherical |
Best for normals, spherical interpolation. |
CatmullRom |
Smooth interpolation with Catmull-Rom splines. |
Bicubic |
High quality bicubic interpolation. |
AIInterpolation |
AI-powered blending. |
BillboardType
| Value | Description |
|---|---|
Cylindrical |
Y-axis locked rotation (best for trees). |
Spherical |
Full 3D facing (best for bushes). |
ScreenAligned |
Camera-aligned, no edge rotation (best for rocks). |
CaptureDistribution
| Value | Description |
|---|---|
Grid |
Standard latitude/longitude grid arrangement. |
Fibonacci |
Uniform sphere distribution using Fibonacci spiral. |
Octahedron |
Continuous octahedron mapping. |
HemiOctahedron |
Top hemisphere octahedron mapping. |
RegenerationMode
| Value | Description |
|---|---|
OnMouseUp |
Update when you release slider (recommended). |
Off |
Manual regeneration only. |
OnChange |
Instant updates on every change (can lag). |
RealTime |
Live preview (smooth but resource-intensive). |
Usage Examples
Programmatic Impostor Generation
using UnityEngine;
using RawteousImpostors.Runtime;
public class ImpostorManager : MonoBehaviour
{
public void ConvertToImpostor(GameObject target)
{
var impostor = target.AddComponent<RawteousImpostors>();
impostor.sourceObject = target;
impostor.settings.textureResolution = 256;
impostor.settings.captureAngles = 6;
impostor.settings.captureElevations = 3;
impostor.settings.impostorMode = ImpostorMode.TextureBased;
impostor.settings.billboardType = BillboardType.Cylindrical;
impostor.Regenerate();
}
}
Accessing Generated Textures
// After regeneration, access the textures
RenderTexture albedoAtlas = impostor.ImpostorTextureRT;
RenderTexture normalAtlas = impostor.NormalMapTextureRT;
RenderTexture pbrAtlas = impostor.PBRMapTextureRT;
RenderTexture emissionAtlas = impostor.EmissionMapTextureRT;
// Get atlas dimensions
int cols = impostor.AtlasCols;
int rows = impostor.AtlasRows;
int tileSize = impostor.AtlasTileSize;
Coroutine-Based Generation with Progress
IEnumerator GenerateWithProgress(RawteousImpostors impostor)
{
yield return impostor.RegenerateCoroutine((progress) => {
Debug.Log($"Generation progress: {progress * 100:F1}%");
});
Debug.Log("Generation complete!");
}
Configuring Distribution Modes
// Grid distribution (default)
impostor.settings.captureDistribution = CaptureDistribution.Grid;
impostor.settings.captureAngles = 8;
impostor.settings.captureElevations = 3;
impostor.settings.hemisphereOnly = true;
// Fibonacci distribution
impostor.settings.captureDistribution = CaptureDistribution.Fibonacci;
impostor.settings.fibonacciPoints = 64;
// Octahedron distribution
impostor.settings.captureDistribution = CaptureDistribution.Octahedron;
impostor.settings.octahedronResolution = 8;
Leader-Follower Pattern
// Set up leader
RawteousImpostors leader = leaderObject.GetComponent<RawteousImpostors>();
leader.settings.textureResolution = 512;
leader.settings.captureAngles = 8;
// Set up followers
foreach (GameObject followerObj in followerObjects)
{
var follower = followerObj.GetComponent<RawteousImpostors>();
follower.settings.leader = leaderObject;
// Follower will automatically sync settings from leader
}