API Reference
Complete API reference for Rawteous Impostors. Programmatic control and runtime access to all impostor functionality.
Getting Started
Add the Rawteous component to any GameObject and configure it programmatically.
Basic Setup
using Rawteous.Runtime;
using UnityEngine;
// Add component to GameObject
Rawteous impostor = gameObject.AddComponent<Rawteous>();
// 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;
}
Rawteous
Main component class. Attach to any GameObject to convert it into an impostor billboard.
Properties
| Property | Type | Description |
|---|---|---|
settings |
RawteousSettings |
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-2048, power of 2). |
captureAngles |
int |
Number of horizontal azimuth angles to capture (4-256). |
captureElevations |
int |
Number of vertical elevation angles to capture (1-37). |
showGizmos |
bool |
Show gizmos in scene view displaying capture positions and angles. |
HasImpostor |
bool |
Returns true if a billboard has been generated (read-only). |
ImpostorTextureRT |
RenderTexture |
Main impostor texture atlas (read-only). |
NormalMapTextureRT |
RenderTexture |
Normal map texture atlas (read-only). |
ViewNormalAtlasRT |
RenderTexture |
View-space normal map atlas (read-only). |
PositionAtlasRT |
RenderTexture |
Position atlas (read-only). |
PBRMapTextureRT |
RenderTexture |
PBR map texture atlas containing metallic, smoothness, AO, depth (read-only). |
MetallicAtlasRT |
RenderTexture |
Metallic channel atlas (read-only). |
SmoothnessAtlasRT |
RenderTexture |
Smoothness channel atlas (read-only). |
AOAtlasRT |
RenderTexture |
Ambient occlusion channel atlas (read-only). |
DepthAtlasRT |
RenderTexture |
Depth channel atlas (read-only). |
EmissionMapTextureRT |
RenderTexture |
Emission map texture atlas (read-only). |
TranslucencyAtlasRT |
RenderTexture |
Translucency channel atlas (read-only). |
AlphaAtlasRT |
RenderTexture |
Alpha channel 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). |
IsCapturing |
bool |
Returns true if this instance is currently capturing (Editor only, read-only). |
TotalCaptures |
int |
Total number of captures based on current distribution settings (Editor only, 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. |
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. |
RawteousSettings
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, CatmullRom. |
billboardType |
BillboardType |
Billboard rotation type: Cylindrical, Spherical, or ScreenAligned. |
unfilteredPixels |
bool |
Use point filtering instead of bilinear for pixel-perfect rendering. |
textureResolution |
int |
Resolution of each tile (8-2048, power of 2). |
autoResolution |
bool |
Automatically calculate resolution from bounding box size. |
maxAutoResolution |
int |
Maximum resolution when autoResolution is enabled (8-2048). |
autoResolutionUseWorldSize |
bool |
Use world-space AABB for auto resolution (accounts for instance scale). |
captureDistribution |
CaptureDistribution |
Distribution mode: Grid, Fibonacci, Octahedron, or HemiOctahedron. |
captureAngles |
int |
Number of horizontal azimuth angles (4-256). Only applies in Grid mode. |
captureElevations |
int |
Number of vertical elevation angles (1-37). 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. |
captureFrameReduction |
float |
Capture padding (0-1). Expands billboard mesh vertices outward. |
editBounds |
bool |
Enable bounds editing mode in scene view. |
customBoundsCenter |
Vector3 |
Custom bounds sphere center (world space). |
customBoundsRadius |
float |
Custom bounds sphere radius (0.01-100). |
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). |
occlusionStrength |
float |
Ambient occlusion strength (0-1). |
invertThickness |
bool |
Invert thickness map calculation. |
useParallax |
bool |
Enable parallax mapping using depth atlas. |
parallaxScale |
float |
Parallax height scale (0-4). |
parallaxMaxSteps |
int |
Maximum parallax raymarch steps (1-128). |
parallaxMidPlane |
float |
Mid-plane depth for parallax (0-1). |
intersectionTolerance |
float |
Intersection tolerance to reduce artifacts (0-0.1). |
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). |
billboardZOffset |
float |
Z offset for billboard position (0-1000). |
enableWind |
bool |
Enable wind animation effects. |
windSpeed |
float |
Overall wind speed multiplier (0-10). |
windRate |
float |
Wind gust rate (0-5). |
windStrength |
float |
Wind strength multiplier (0-5). |
grassWeight |
float |
Grass-like wind weight (0-1). |
bushWeight |
float |
Bush-like wind weight (0-1). |
treeWeight |
float |
Tree-like wind weight (0-1). |
windDirection |
Vector3 |
Wind direction in world space. |
randomPhase |
bool |
Use random phase offset for wind animation. |
windPivotHeightOffset |
float |
Pivot height offset for wind animation (-1 to 1). |
useContourGeometry |
bool |
Use contour-based geometry instead of simple quad. |
geometrySimplificationTolerance |
float |
Simplification tolerance for contour geometry (0.001-0.1). |
geometryAlphaThreshold |
float |
Alpha threshold for contour extraction (0-1). |
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. |
IsOctahedronMode |
bool |
Returns true if using Octahedron or HemiOctahedron distribution. |
CreateCopy() |
RawteousSettings |
Create a copy of the settings (static method). |
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. |
CatmullRom |
Smooth interpolation with Catmull-Rom splines. |
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. |
DownscalingFilter
| Value | Description |
|---|---|
Bilinear |
Standard bilinear filter (fastest). |
Lanczos |
High quality Lanczos filter (best quality). |
CatmullRom |
Sharp Catmull-Rom filter. |
Usage Examples
Programmatic Impostor Generation
using UnityEngine;
using Rawteous.Runtime;
public class ImpostorManager : MonoBehaviour
{
public void ConvertToImpostor(GameObject target)
{
var impostor = target.AddComponent<Rawteous>();
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(Rawteous 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
Rawteous leader = leaderObject.GetComponent<Rawteous>();
leader.settings.textureResolution = 512;
leader.settings.captureAngles = 8;
// Set up followers
foreach (GameObject followerObj in followerObjects)
{
var follower = followerObj.GetComponent<Rawteous>();
follower.settings.leader = leaderObject;
// Follower will automatically sync settings from leader
}
Wind Animation Setup
// Enable wind effects
impostor.settings.enableWind = true;
impostor.settings.windSpeed = 1.5f;
impostor.settings.windStrength = 1.0f;
// Use tree preset weights
impostor.settings.grassWeight = 0f;
impostor.settings.bushWeight = 0f;
impostor.settings.treeWeight = 1f;
// Set wind direction
impostor.settings.windDirection = new Vector3(1f, 0f, 0.3f);
Parallax Configuration
// Enable parallax depth effect
impostor.settings.useParallax = true;
impostor.settings.parallaxScale = 1.0f;
impostor.settings.parallaxMaxSteps = 32;
impostor.settings.parallaxMidPlane = 0.5f;