Hi,
my point is the pointlight.
I´m trying to create a background in Away4 with radial gradient.
So I take a plane and a Pointlight.
First everything seems to work right. But as you can see in the attachments:
- “fromFar.jpg” shows the gradient how I want it… but I need to fill the stage. Here is the camera set to z -800
- “fromClose.jpg” shows the filled background with camera z position at -200
As you can see, I expect the gradient to fill the borders of the plane.
I tried many settings with the light, but I couldn´t achieve to have a bigger light radius at camera set to z -200 in my scene
Here is all my cleaned up code:
package
{
import away3d.containers.*;
import away3d.entities.*;
import away3d.materials.*;
import away3d.primitives.*;
import away3d.utils.*;
import away3d.lights.*;
import away3d.materials.lightpickers.StaticLightPicker;
import flash.display.*;
import flash.events.*;
import flash.geom.Vector3D;
import flash.geom.Point;
[SWF(backgroundColor="#000000", frameRate="60")]
public class ATest extends Sprite
{
private var _material:ColorMaterial;
private var _view:View3D = new View3D();
private var _plane:Mesh;
private var pointLight:PointLight = new PointLight();
private var lightPicker:StaticLightPicker;
public function ATest()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
addChild(_view);
_view.scene.addChild(pointLight);
//setup the camera
_view.camera.z = -800;
pointLight.specular = 1;
pointLight.color = 0x0099CC;
pointLight.z = -1200;
trace(pointLight.bounds);
//setup the scene
lightPicker = new StaticLightPicker([pointLight]);
_material = new ColorMaterial(0x000000);
_material.lightPicker = lightPicker;
_plane = new Mesh(new PlaneGeometry(stage.stageWidth, stage.stageHeight), _material);
_plane.rotationX = -90;
_view.scene.addChild(_plane);
//setup the render loop
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function _onEnterFrame(e:Event):void
{
//pointLight.z -= 5;
_view.render();
}
private function onResize(event:Event = null):void
{
_view.width = stage.stageWidth;
_view.height = stage.stageHeight;
}
}
}