# Variant Definition

The variant definition is where the user can define what properties to randomize.

<figure><img src="/files/cG90VdAFEmysafYnnuUz" alt=""><figcaption></figcaption></figure>

***

**Enable:** Enable / disable this variant completely from evaluation.

**Debug Color:** Color applied on bounds debug view in the Random assembly editor utility widget.

**Direct Spawn:** If True that any valid actor for this variant will be spawned during the variant evaluation itself. Otherwise all the variants with direct spawn False will be spawned at the end of all the variant evaluations.\
This means any actor set as direct spawned will be available as collision data for other next variants.

{% hint style="warning" %}
This means this variant (with this tag) must be unique in the variant list or you might end up with overdraw (overlapping meshes).
{% endhint %}

{% hint style="info" %}
The variants order evaluation is the same as the order they are saved in the variant dictionary:

<p align="center"><img src="/files/dXnlVXJJWru66PqiePrb" alt=""></p>
{% endhint %}

***

**Removal Probability:** From 0 to 1.0, a % of change to get the target actor removed from the generated result.

**Mesh Variants:** A weighted list of static meshes to pick a target actor's mesh replacement from. Higher weight means higher chance to get picked.

{% hint style="info" %}
You can create a Variant from a selection of meshes (actors or assets) using the provided [Scripted Right Click Action](/cgtoolbox-docs/pcg-random-assemblies/asset-action-helpers.md).
{% endhint %}

**Self Pruning:** A self pruning node (removing the overlapping actors) will be applied on the target actors.

***

**XForm variant:** Min / Max values for offset (translation), rotation and scale to be randomly applied on target actors.

***

**Project On Landscape:** If True, the target actor will be projected on the landscape (if there is no landscape, it will be ignored).

**Project Rotation:** If True the rotation from the landscape hit point will be fetched.

**Project On World Static:** If True, the target actor will be projected on any static actor's complex collision.

{% hint style="info" %}
If you need a specific projection behavior (use simple collision, filter on actor's tags, etc.) you can use the Post Variant Graph parameter to have your own custom projection / randomization graph.
{% endhint %}

## **Warning:**

![](/files/PiUp7nCICGk4L6sG4I0O) To make the projection work properly, you might need to had a xform Z offset as the points are projected from their initial positions (pivot position), it might be "under" the world static elements you're trying to project on, for example here:

<figure><img src="/files/bYXu8DsxBhi71Z5mDtVo" alt=""><figcaption></figcaption></figure>

No Z offset on the table variant, the projection failed as the pivot point of the table was under the world static

<figure><img src="/files/AwQwidFhCGbMtSTBl6xg" alt=""><figcaption></figcaption></figure>

With a min / max Z offset set to 200.0, the projection now work properly as it made the pivot point of the table above the world static elements.

***

**Static Mesh Spawner:** A PCG static mesh spawner proxy node (also called settings), to be used only for the target actors of this variant. This can be used to achieve more complex randomization for instance on materials using the Extra Floats parameter.

**Extra Floats:** A list of min / max float which will be injected on the target actors as PerInstanceCustomData, to be functional, a custom Static Mesh Spawner node must be provided as well.

<details>

<summary>Example of use of extra float on material</summary>

For example, to randomize the benches color, the bench Variant has an "Extra Float" random parameter called "ExtraFloat1":

<figure><img src="/files/pzYHFbSiv9KUFUWHqm2E" alt=""><figcaption></figcaption></figure>

And the static mesh spawner setting node has a Instance Data Packer which use this "ExtraFloat1" as attribute selector:

<figure><img src="/files/FgsvpVucpG4vWxDP5ldS" alt=""><figcaption></figcaption></figure>

This random float will be used as Custom data on the instances generated:

<figure><img src="/files/1dij7AlezmZHLgZKJrUs" alt=""><figcaption></figcaption></figure>

This can be used in a material using the "PerInstanceCustomData" node, for instance here, \
to lerp the albedo tint between a white and a red-ish color:

<figure><img src="/files/xehVQWA1VJvicn0QUifo" alt=""><figcaption></figcaption></figure>

*Example:*

*<mark style="color:$info;">/Game/PCGRandomAssembly/ExampleData/3DAssets/Materials/MSPresets/M\_MS\_Default\_Material\_VT/Functions/MF\_ObjAdjustmentsRandom</mark>*

</details>

***

**Use Post Variant Graph:** Enable / disable the custom post variant graph execution.

**Post Variant Graph:** A custom graph which will be executed after all the variant parameters (xform, removal probability, mesh variants, etc.)\
This is useful to have a tailored projection system, or a more complex set of randomization  rules.

{% hint style="info" %}
A PCG Graph template is available: TPL\_VariantCustomPostProcess
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cgtoolbox.gitbook.io/cgtoolbox-docs/pcg-random-assemblies/variant-definition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
