Away 3d 3.6 weird subdivision

Software: Away3D 3.x

kz, Newbie
Posted: 30 September 2011 01:58 PM   Total Posts: 30

Hi, I’m new to away3d and I can’t figure out what’s happening here:

http://kz.vh5n1.net/away3d/problem.swf

I’m using a self made movie material (I’ll apply then some animation, by now is just a plain colored surface), I got this problem but I don’t get it.

Can you suggest me a solution?

   

Avatar
Alejandro Santander, Administrator
Posted: 30 September 2011 02:09 PM   Total Posts: 414   [ # 1 ]

Can you please show the code of how you are constructing this geometry?

   

kz, Newbie
Posted: 30 September 2011 03:16 PM   Total Posts: 30   [ # 2 ]

I’m just adding it like a normal one, in this case I used prefab (c4d, export to collada, than as3 class)

http://kz.vh5n1.net/away3d/problem2.swf

But I got the same issue with a normal cube

package planets 
{


 import away3d
.materials.BitmapMaterial;
 
import away3d.materials.MovieMaterial;
 
import away3d.primitives.*;
 
import away3d.primitives.CubeMappingType;
 
import away3d.materials.PhongMovieMaterial;
 
import away3d.containers.ObjectContainer3D;
 
import away3d.primitives.data.CubeMaterialsData;
 
import away3d.core.utils.Cast;

 public class 
Planet1 extends ObjectContainer3D
 {
  
private var tetraedro:Tetraedro = new Tetraedro();
 
  public function 
Planet1() 
  
{
   tetraedro
.scale(200);
   
addChild(tetraedro);
  
}
 }

 

 

 

   

kz, Newbie
Posted: 30 September 2011 03:17 PM   Total Posts: 30   [ # 3 ]

here’s the class that loads everything (I’m sorry it’s a bit of a mess..)

package
{
 import away3d
.cameras.HoverCamera3D;
 
import away3d.cameras.SpringCam;
 
import away3d.cameras.TargetCamera3D;
 
import away3d.core.clip.FrustumClipping;
 
import away3d.core.render.Renderer;
 
import away3d.core.utils.Cast;
 
import away3d.lights.PointLight3D;
 
import planets.Planet1;
 
 
import com.greensock.*;
 
import com.greensock.easing.*;


 
import away3d.primitives.Plane;
 
import away3d.primitives.Sphere;
 
 
import flash.events.Event;
 
import flash.events.KeyboardEvent;
 
import flash.events.MouseEvent;
 
 
import away3d.events.MouseEvent3D
 
 
 
///stars
 
import away3d.materials.TransformBitmapMaterial;
 
import away3d.primitives.Skybox;
 
import flash.display.BitmapData;
 
import flash.display.Sprite;
 
 
import flash.geom.Vector3D;
 
import away3d.lights.DirectionalLight3D;

 
 public class 
CameraDemo extends Away3DTemplate
 {

  
protected var sphereCam:Sphere = new Sphere({radius.1});  
  protected var 
hoverCamera:HoverCamera3D;
  protected var 
lastStageX:Number;
  protected var 
lastStageY:Number;
  protected var 
mouseButtonDown:Boolean;
  public var 
planet1:Planet1 = new Planet1();
  public var 
planet2:Planet1 = new Planet1();
  
  
  
//protected var light:DirectionalLight3D;
   
  
public function CameraDemo()
  
{
   super
();
  
}
  
  
protected override function initEngine():void
  {
   super
.initEngine();
   
view.renderer Renderer.CORRECT_Z_ORDER
   
view.clipping = new FrustumClipping();
  
}
  
  
protected override function initScene():void
  {
   super
.initScene();
   
makeSphereCam();
   
   
makeStars();
   
   
loadPlanes();
   
   var 
light:DirectionalLight3D = new DirectionalLight3D({color:0xFFFFFFambient:.5diffuse:.3specular:.1x:500,  direction: new Vector3D(-1,-1,0)});

     
 
//   scene.addLight(light);

   
   
   

  
}
  
  
protected function loadPlanes():void {
   
   scene
.addChild(planet1);
   
//scene.addChild(planet2);
   //planet2.z = 1000;
   //planet2.y = 100;
   //planet2.x = 300;
   
   
planet1.addEventListener(MouseEvent3D.MOUSE_DOWNplanetClick);
   
//planet2.addEventListener(MouseEvent3D.MOUSE_DOWN, planetClick);
  
}
  
  
protected function planetClick(event:MouseEvent3D):void {
   trace
("click!" event.currentTarget.z);
   
TweenLite.to(sphereCam4{x:event.currentTarget.xy:event.currentTarget.yz:event.currentTarget.z});
   
  
}
  
  
protected function makeSphereCam() : void {
   scene
.addChild(sphereCam);
   
addHoverCamera();

  
}
  
  
protected override function initListeners():void
  {
   super
.initListeners();
   
stage.addEventListener(MouseEvent.MOUSE_DOWNonMouseDown);
   
stage.addEventListener(MouseEvent.MOUSE_UPonMouseUp);
   
stage.addEventListener(MouseEvent.MOUSE_MOVEonMouseMove);
   
stage.addEventListener(Event.RESIZEresizeHandler);

  
}
 
  
  
protected override function onEnterFrame(event:Event):void
  {
   super
.onEnterFrame(event);
    
   
//planet1.roll(1);
   //planet1.pitch(1);
   
   
hoverCamera.hover(); 
   
   
//trace(sphereCam.x + " " + sphereCam.y + " " + sphereCam.z );
   
   
   
   
    
  
  
}
  
  
protected function onMouseDown(event:MouseEvent):void
  {
   mouseButtonDown 
true;
   
lastStageX event.stageX;
   
lastStageY event.stageY;
  

  
  
protected function onMouseUp(event:MouseEvent):void
  {
   mouseButtonDown 
false;
  
}
  

  
protected function addHoverCamera():void
  {
   
   hoverCamera 
= new HoverCamera3D(
    
{
     target
sphereCam,
     
distance100,
     
mintiltangle5,
                    
tiltAngle45
    }
   
);
   
   
view.camera hoverCamera;
   
hoverCamera.zoom * (stage.stageHeight 768);
   
   
  
  
}

  
protected function onMouseMove(event:MouseEvent):void
  {
   
if (hoverCamera != null && mouseButtonDown == true)
   
{
    
var pan:int = (event.stageX lastStageX);
    var 
tilt:int = (event.stageY lastStageY);

    
hoverCamera.panAngle += pan;
    
hoverCamera.tiltAngle += tilt;

    
lastStageX event.stageX;
    
lastStageY event.stageY;
   
}
  }        
  
  
private function resizeHandler(event:Event):void{
          
   view
.= (stage.stageWidth 2) ;
   
view.= (stage.stageHeight 2) ;
   
   
hoverCamera.zoom * (stage.stageHeight 768);
 
        
}
  
  
  
protected function makeStars():void { 
   
//////////////////////stars
   // create a temporary container-sprite to add stars into
   
var mc:Sprite = new Sprite();
   
mc.graphics.beginFill(0);
   
mc.graphics.drawRect(0,0,2048,2048);
   
mc.graphics.endFill();
   
// add 2000 star-sprites to the container
   
var s:Spriter:Number;
   for( var 
i:uint=0i<500i++ ) {
    r 
Math.random()*Math.random() * 2;
    
= new Sprite();
    
s.graphics.beginFill(0xFFFFFF,0.9);
    
s.graphics.drawCircle(0,0,r);
    
s.graphics.endFill();
    
s.+ (mc.width 2*r)*Math.random();
    
s.+ (mc.height 2*r)*Math.random();
    
mc.addChild(s);
   
}
   
// render the container-sprite to a bitmap
   
var bmd:BitmapData = new BitmapData(mc.widthmc.heightfalse0);
   
bmd.draw(mc);
   
// create a 2x2 tiled material from the bitmap
   
var mat:TransformBitmapMaterial = new TransformBitmapMaterial(bmd{
   smooth
trueprecision:0,
   
repeattruescaleX0.5scaleY0.5 });
   
// create a skybox using that material on all 6 sides
   
var box:Skybox = new Skyboxmat,mat,mat,mat,mat,mat );
   
// and finally add it to the scene
   
scene.addChild(box);
  
}
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 }
   

kz, Newbie
Posted: 30 September 2011 03:21 PM   Total Posts: 30   [ # 4 ]

here’s the same issue with a cube:

http://kz.vh5n1.net/away3d/problem3.swf

private var cubeTest:Cube = new Cube ({mappingTypeCubeMappingType.NORMAL}); 
   

kz, Newbie
Posted: 03 October 2011 02:29 PM   Total Posts: 30   [ # 5 ]

Any suggestion???

   

Avatar
Alejandro Santander, Administrator
Posted: 05 October 2011 01:06 AM   Total Posts: 414   [ # 6 ]

I really don’t know… Actually, its quite interesting how the ‘artifact’ renders Sierpinski triangulations!

Lets see if anyone else knows what’s going on here.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X