« Return to Thread: Presentation and First Question
I'm no papervision expert but seems you are making your light REALLY far away from the model... I don't know how this would affect your scene though, or if it would cause this.
just a thought!
cheers,
mark
Javier España | javierespana.com wrote:Hi there, I'm Javier from Argentina and this is my first message to the maillist... I'm a graphic designer and I've been working with Flash for a long time... You can check some of my work on my site (you can find the address on my signature).
I'm starting out with Papervision 3D and there are some things I'm having trouble with... So to break the ice I'll ask you this:
I'm loading a Collada model with a BitmapFileMaterial to the scene, all is good but I'm trying to add a light so when making the material a Shader Material it all renders in the scene but the light doesn't seem to be affecting the object... Any ideas?
Here's the code I'm using:
package{
///
import flash.display.Sprite;
import flash.events.Event;
///
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.objects.parsers.Collada;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
///
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.materials.shaders.*;
import org.papervision3d.materials.shadematerials.*;
import org.papervision3d.lights.PointLight3D;
///
[SWF(width="640", height="480", frameRate="30", backgroundColor="#000000")]
///
public class frente_hotel extends Sprite{
///
private var scene:Scene3D;
private var vp:Viewport3D;
private var cam:Camera3D;
private var bre:BasicRenderEngine;
private var collada:Collada;
///
private var bitmapFileMaterial:BitmapFileMaterial;
///
private var luz:PointLight3D;
///
public function frente_hotel(){
///
setupPV3D();
addCollada();
///
addEventListener(Event.ENTER_FRAME, loop);
}
///
private function setupPV3D():void{
///
scene = new Scene3D();
cam = new Camera3D();
cam.z -= 30000;
cam.y += 10000;
vp = new Viewport3D();
bre = new BasicRenderEngine();
///
addChild(vp);
}
///
private function addCollada():void{
///
bitmapFileMaterial = new BitmapFileMaterial("frente_hotel.png");
//bitmapFileMaterial.doubleSided = true;
///
//1. La luz
luz = new PointLight3D;
luz.z = -1000000;
luz.x = 1500000;
scene.addChild(luz);
///
var shader:GouraudShader = new GouraudShader(luz,0xffffff,0x222222);
var shadeMat:ShadedMaterial = new ShadedMaterial(bitmapFileMaterial,shader);
///
var materialsList:MaterialsList = new MaterialsList();
materialsList.addMaterial(shadeMat,"baked_Shape1_mtl");
///
collada = new Collada("frente_hotel.dae", materialsList);
scene.addChild(collada);
}
///
private function loop(e:Event):void{
///
collada.rotationY += 2;
//collada.rotationX += 1;
//cam.y += 50;
//cam.z -= 50;
bre.renderScene(scene, cam, vp);
}
}
}
Thanks a lot, hope this is the first of many messages...
Javier España
www.javierespana.com
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
« Return to Thread: Presentation and First Question
| Free embeddable forum powered by Nabble | Forum Help |