Render to texture help

Software: Away3D 4.x

ranoya, Newbie
Posted: 29 May 2013 01:06 PM   Total Posts: 29

Hi, guys.

I´m trying to render the scene to a texture and apply it to a TextureMaterial on a cube mesh;

my code:

cube = new Mesh(new CubeGeometry(150));
var 
stage3dManager Stage3DManager Stage3DManager.getInstance(stage);
var 
stage3dProxy:Stage3DProxy stage3dManager.getStage3DProxy(0);
mat = new TextureMaterial();
var 
renderTexture RenderTexture = new RenderTexture(512512);
texture renderTexture.getTextureForStage3D(stage3dProxy);
mat.texture renderTexture;
cube.material mat;
cube.300;
view.scene.addChild(cube);

var 
renderer DefaultRenderer = new DefaultRenderer();
var 
entityCollector EntityCollector renderer.createEntityCollector();
entityCollector.clear();
entityCollector.camera view.camera;
view.scene.traversePartitions(entityCollector);
renderer.render(entityCollectortexture);
entityCollector.cleanUp(); 

I´ve already imported the arcane namespace for get access to some of the functions above.

My render just shows the already constructed meshes plus a red, not textured, cube.

Thanks for any help.

   

ranoya, Newbie
Posted: 29 May 2013 10:11 PM   Total Posts: 29   [ # 1 ]

Can´t anyone help me?

I added this lines and the cube became gray, not red:

var stage3dProxy:Stage3DProxy = view.stage3DProxy;
.
.
.
renderer.stage3DProxy = stage3DProxy;

I tried using the ProjectiveTextureMethod and TextureProjector, but nothing changes.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X