Component that builds an invisible depth floor for the alpha-zero lighting setup. On awake it tags its object, renames it A0_DEPTH_FLOOR, disables it, and spawns a child plane using models/dev/plane.vmdl with the materials/depth_alpha_zero.vmat override, scaled to 100. Also holds read-only properties for the shadow catcher object and a sun light reference.
public class AlphaZeroDepthFloor : Component {
[Property, ReadOnly] public GameObject ShadowCatcher {get; set;}
[Property, ReadOnly] public GameObject SunLight {get; set;}
protected override void OnAwake() {
Tags.Add("alpha_zero_depth_floor");
GameObject.Name = "A0_DEPTH_FLOOR";
GameObject.Enabled = false;
ShadowCatcher = Scene.CreateObject();
ShadowCatcher.SetParent(GameObject);
ShadowCatcher.Name = "plane";
var model = ShadowCatcher.Components.Create<ModelRenderer>();
model.Model = Model.Load("models/dev/plane.vmdl");
model.MaterialOverride = Material.Load("materials/depth_alpha_zero.vmat");
ShadowCatcher.WorldScale = 100f;
base.OnAwake();
}
}