Hey there,
I have been trying to grasp the process of lighting loaded 3D models. Are we supposed to apply the light to the model, the material, or both? There doesn’t e.g. appear to be a way to handle this directly to an instance of Loader3D.
And if the materials are loaded with the object e.g. in AWD2 format, then we don’t explicitly know what they are so there must be a way to access them.
I have seen some code e.g. from the ant example:
private function onAssetComplete(event:AssetEvent):void
{
if (event.asset.assetType == AssetType.MESH) {
var mesh:Mesh = event.asset as Mesh;
mesh.castsShadows = true;
} else if (event.asset.assetType == AssetType.MATERIAL) {
var material:TextureMaterial = event.asset as TextureMaterial;
material.shadowMethod = new FilteredShadowMapMethod(_light);
material.lightPicker = _lightPicker;
material.gloss = 30;
material.specular = 1;
material.ambientColor = 0x303040;
material.ambient = 1;
}
}
However, there is some coercion here, and I’m one of those people who need to understand what and why before I can just paste code in and hope it works.
Thanks!