SkyBox still renders after removing it?

Software: Away3D 4.x

Stephen Hopkins, Sr. Member
Posted: 16 July 2011 09:44 PM   Total Posts: 110

Is there something you need to remove it other than view.scene.removeChild(skyBox)?

I made a simple test program that adds a skybox, renders once, removes the skybox and renders again, and the skybox is still there.

 Signature 

http://www-scf.usc.edu/~shopkins

   

Richard Olsson, Administrator
Posted: 17 July 2011 07:05 AM   Total Posts: 1192   [ # 1 ]

It sounds like you are trying to do it all on a single frame. Is that the case? Drawing on the GPU is asynchronous, so it might simply be that you need to wait for the first “frame” to render before removing the object and invoking render() again.

Otherwise give us some code to reproduce and we’ll investigate the issue.

   

Stephen Hopkins, Sr. Member
Posted: 17 July 2011 09:00 AM   Total Posts: 110   [ # 2 ]

It was over multiple frames.

Hm… Though, I wasn’t checking if the skybox actually still worked, i.e., background changes when rotating the camera. So, I added a rotation to the camera. Once the skybox is removed, the background stops rotating, but the skybox background is still there. Maybe the buffer for the skybox isn’t getting cleared? The view/camera are still working, but the skybox seems to be frozen in place at the moment you removed it.

Here’s the program I used. The cube is there so you can see that everything else works while the skybox is stuck. The skybox images can be found here:
http://www-scf.usc.edu/~shopkins/files/cave.zip .

package{
 import away3d
.containers.View3D;
 
import away3d.materials.ColorMaterial;
 
import away3d.materials.utils.CubeMap;
 
import away3d.primitives.Cube;
 
import away3d.primitives.SkyBox;
 
 
import flash.display.Sprite;
 
import flash.events.Event;

 public class 
SkyboxTest extends Sprite{
  [Embed
(source="../cave/caveback.jpg")]
  
private var caveback: Class;
  
[Embed(source="../cave/cavefront.jpg")]
  
private var cavefront: Class;
  
[Embed(source="../cave/cavedown.jpg")]
  
private var cavedown: Class;
  
[Embed(source="../cave/caveleft.jpg")]
  
private var caveleft: Class;
  
[Embed(source="../cave/caveright.jpg")]
  
private var caveright: Class;
  
[Embed(source="../cave/caveup.jpg")]
  
private var caveup: Class;
  private var 
_view:View3D = new View3D();
  private var 
_skybox:SkyBox;
  private var 
_removeCount:int 0;
  public function 
SkyboxTest(){
   _skybox 
= new SkyBox(new CubeMap(
    new 
caveright().bitmapData,
    new 
caveleft().bitmapData,
    new 
caveup().bitmapData,
    new 
cavedown().bitmapData,
    new 
cavefront().bitmapData,
    new 
caveback().bitmapData
   
));
   
_view.scene.addChild(_skybox);
   
_view.scene.addChild(new Cube(new ColorMaterial(0xFFFFFF)));//for point of reference
   
this.addChild(_view);
   
this.addEventListener(Event.ENTER_FRAMErunfalse0true);
  
}
  
public function run(e:Event):void{
   
++_removeCount;
   if(
_removeCount == 20){//remove skybox on 20.. before I used a simple boolean to remove it after rendering once, still same bug
    
_view.scene.removeChild(_skybox);
    
trace("removed skybox");
   
}
   _view
.camera.rotationY += 10;//to see if skybox still working
   
_view.render();

  
}
 }
 Signature 

http://www-scf.usc.edu/~shopkins

   

Avatar
David Lenaerts, Administrator
Posted: 20 July 2011 02:46 PM   Total Posts: 80   [ # 3 ]

This was a bug in the EntityCollector, which should now be fixed!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X