Hi guys, i’m new here.
I’m working on my thesis, i decided to make an interactive presentation of a 3d model, which uses web technologies (i choose Flash + away3d).
In my project i can change the car and rims color.
And also there is a possibility of opening a trunk.
Everything works fine, but i have a BIG problem with shadows and strange mesh behaviour.
First of all i have problems with shadows.
Below i paste my light settings and materials.
import away3d.materials.methods.FresnelEnvMapMethod;
import away3d.materials.methods.FogMethod;
import away3d.materials.methods.FilteredShadowMapMethod
//....
private function initLights() : void
{
sunLight = new DirectionalLight();
sunLight.position = new Vector3D(1, 1, 1);
sunLight.direction = new Vector3D(-1,-.5,-1);
sunLight.color = 0xEEEEBB;
sunLight.castsShadows = false;
sunLight.ambient = 0.8;
sunLight.diffuse = 1;
sunLight.specular = 1;
scene.addChild(sunLight);
/*
skyLight = new PointLight();
skyLight.y = 100;
skyLight.color = 0xFFFFFF;
skyLight.diffuse = 1;
skyLight.specular = 0.5;
skyLight.radius = 100;
skyLight.fallOff = 100;
scene.addChild(skyLight);*/
sceneLightPicker = new StaticLightPicker([sunLight]);
filteredShadowMapMethod = new FilteredShadowMapMethod(sunLight);
filteredShadowMapMethod.epsilon = 0.0;
fogMethod = new FogMethod(0, 3000, 0x5f5e6e);
fresnel = new FresnelEnvMapMethod(cubeTexture, 1);
fresnel.fresnelPower = 100;
fresnel.normalReflectance = 0.6;
fresnel2 = new FresnelEnvMapMethod(cubeTexture, 1);
fresnel2.fresnelPower = 60;
fresnel2.normalReflectance = 0.3;
}
// ...
private function initMaterials() : void
{
buildingMaterial = new TextureMaterial(Cast.bitmapTexture(buildingTexture));
buildingMaterial.shadowMethod = filteredShadowMapMethod;
signsMaterial = new TextureMaterial(Cast.bitmapTexture(signTexture));
signsMaterial.shadowMethod = filteredShadowMapMethod;
rimsMaterial = new ColorMaterial(0x666666);
rimsMaterial.shadowMethod = filteredShadowMapMethod;
bodyMaterial = new ColorMaterial(0xFF0000);
bodyMaterial.repeat = true;
bodyMaterial.shadowMethod = filteredShadowMapMethod;
tyresMaterial = new ColorMaterial(0X111111);
tyresMaterial.repeat = true;
tyresMaterial.shadowMethod = filteredShadowMapMethod;
blackElementsMaterial = new ColorMaterial(0x333333);
blackElementsMaterial.shadowMethod = filteredShadowMapMethod;
chromeElementsMaterial = new ColorMaterial(0xDDDDDD);
chromeElementsMaterial.shadowMethod = filteredShadowMapMethod;
chromeElementsMaterial.specular = 0.8;
headlightsMaterial = new ColorMaterial (0xCCCCCC);
headlightsMaterial.alpha = 0.7;
headlightsMaterial.specular = 0.8;
headlightsGlassMaterial = new ColorMaterial (0xFFFFFF);
headlightsGlassMaterial.alpha = 0.3;
glassMaterial = new ColorMaterial(0x000000);
backlightsGlassMaterial = new ColorMaterial (0xEA0000);
backlightsGlassMaterial.alpha = 0.7;
backlightsGlassMaterial.specular = 80;
shadesMaterial = new ColorMaterial(0x020202);
bodyMaterial.lightPicker = sceneLightPicker;
rimsMaterial.lightPicker = sceneLightPicker;
glassMaterial.lightPicker = sceneLightPicker;
blackElementsMaterial.lightPicker = sceneLightPicker;
chromeElementsMaterial.lightPicker = sceneLightPicker;
headlightsGlassMaterial.lightPicker = sceneLightPicker;
backlightsGlassMaterial.lightPicker = sceneLightPicker;
signsMaterial.lightPicker = sceneLightPicker;
tyresMaterial.lightPicker = sceneLightPicker;
shadesMaterial.lightPicker = sceneLightPicker;
buildingMaterial.lightPicker = sceneLightPicker;
}
second thing is this weird pixels on the edges of mesh
I suppose it’s because meshes on which it appears were loaded to awayBuilder
body as 2 submeshes ( but in 3ds max its only one mesh with skin modifier and bones to animate the trunk)
tyres also one mesh, (but in away builder it appears as 7 or sometimes even 20 submeshes!!)
I don’t know why that happnens.
because it’‘s many submeshes i had to do something like :
for(var i:int = 0; i<body.subMeshes.length; i++)
{
body.subMeshes[i].material = bodyMaterial;
}
for(var j:int = 0; j<tyres.subMeshes.length; j++)
{
tyres.subMeshes[j].material = tyresMaterial;
}
to add the color to this meshes.
I hope someone can help me.
i attach a zip file with screenshots of my problems