Hi Fabrice,
This is my code, I create two spheres to simulates the earth and the
moon, then I lighting these objects with a PointLight3D, but they are
seen with a flat aspect, I would like to have the same effect that I
have with the PointLight3D (the side towards to the sun lighting and
the other side dark), but with smooth objects.
I tried used a PhongBitmapMaterial with DirectionalLight3D or
AmbientLight3D, although i didn´t reached a good result. In fact, the
objects can be seen in a smooth aspect with these lights and
materials, but we cannot see the lighting differences between the two
objects sides.
Thanks.
Tiago.
package {
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.core.math.Number3D;
import away3d.lights.AmbientLight3D;
import away3d.lights.PointLight3D;
import away3d.loaders.utils.MaterialLibrary;
import away3d.materials.BitmapMaterial;
import away3d.materials.IMaterial;
import away3d.materials.WhiteShadingBitmapMaterial;
import away3d.materials.utils.SimpleShadow;
import away3d.primitives.Sphere;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
[SWF(backgroundcolor = "#000000000")]
public class TesteLuz extends Sprite
{
private var light:PointLight3D;
private var sphere:Sphere;
private var sphere2:Sphere;
private var v:View3D;
public function TesteLuz()
{
v = new View3D();
v.x = 200;
v.y = 230;
this.addChild(v);
v.scene = new Scene3D();
//light
light = new PointLight3D({x:80, y:0, z:0, brightness:5,
ambient:30,
specular:180, diffuse:30});
v.scene.addChild(light);
light.visible = true;
//earth sphere & white shadingg bitmap material
[Embed(source = "assets/earth.jpg")]
var Earth:Class;
var earthBmp:Bitmap = new Earth() as Bitmap;
var earthMat:WhiteShadingBitmapMaterial = new
WhiteShadingBitmapMaterial(earthBmp.bitmapData);
earthMat.ambient_brightness = 0;
earthMat.diffuse_brightness = 1.7;
earthMat.specular_brightness = 0;
sphere = new Sphere({radius:15, material:earthMat});
v.scene.addChild(sphere);
//moon sphere & white shadingg bitmap material
[Embed(source = "assets/moon.jpg")]
var Moon:Class;
var moonBmp:Bitmap = new Moon() as Bitmap;
var moonMat:WhiteShadingBitmapMaterial = new
WhiteShadingBitmapMaterial(moonBmp.bitmapData);
moonMat.ambient_brightness = 0;
moonMat.diffuse_brightness = 1.7;
moonMat.specular_brightness = 0;
sphere2 = new Sphere({radius:5, material:moonMat, x:-60
});
v.scene.addChild(sphere2);
v.render();
}
}
}
On Dec 17, 3:52 pm, Fabrice3D <[email protected]> wrote:
> Sure I wanna help you but in this case
> this is pretty much all you need...
>
> Show your code snippet where things go wrong or do not work
> then I might be able to help you more.
>
> Fabrice
>
> On Dec 17, 2009, at 7:22 PM, Tiago Machado wrote:
>
> > hi fabrice,
>
> > can you send me further details?
>
> > thx
>
> > tiago.
>
> > On Dec 16, 5:48 pm, Fabrice3D <[email protected]> wrote:
> >> you need to set the materials at face level.
>
> >> Like mesh.faces[index].material = ITriangleMaterial
>
> >> Fabrice
>
> >> On Dec 16, 2009, at 6:11 PM, Tiago Machado wrote:
>
> >>> how can i associate two or more materials with the same object?
>
> >>> i want to lighting an object with a pointLight3D and an
> >>> ambientLight3D
> >>> using whiteShadingMaterial and phongBitmapMaterial.
>
> >>> thx.
>
> >>> tiago.