Adding Blob Shadows to Models
From C4 Engine Wiki
Make a texture of the blob shadow. For every frame, create a MarkingEffect object at the model's position with a normal of (0,0,1) and a tangent pointing to the model's right. Use the MarkingEffect::New() function to add the marking data:
MarkingData data; data.center = model->GetWorldPosition(); // Bottom center of model data.normal.Set(0.0F, 0.0F, 1.0F); // Up direction data.tangent = model->GetWorldTransform()[0]; // Right direction data.radius = 0.25F; // Change to whatever you need data.textureName = "MyTexture"; // Change to blob texture's name data.color.Set(0.0F, 0.0F, 0.0F, 1.0F); // Black shadow data.lifeTime = -1; // Marking only survives one frame MarkingEffect::New(model->GetWorld()->GetRootNode(), &data);
Use this code in the model controller's Move() function. This code will cause a new marking to appear at the model's base every frame.
Note that making a blob shadow with this method performs a full geometric clip every frame. It seems to be very fast, but if the geometry beneath a model's base is very complicated, or blobs are being created for a lot of models, there could be performance consequences.
Turn on wire frame (see Using the Command Console) and switch to the third-person camera to see how the engine creates the effect and forms it to the underlying geometry.
