Planet atmosphere issue

Software: Away3D 4.x

doomdrake, Newbie
Posted: 10 April 2012 11:27 AM   Total Posts: 14

Hi guys, I’ve just started using Away3D.
Although it’s pretty easy to use ( managed to figure most of the things for myself ), i still can’t get the following thing to work.
So i’m trying to set the atmosphere for a planet ( ex. Earth ) by using a larger sphere (with a transparent png ) on top of the planet’s “terrain” sphere. Problem is the atmosphere sphere doesn’t show at all ( tried to change the image used for the texture since i thought it may be from the alpha issues i’ve been hearing about but it still doesn’t work ).

Note: the “terrain” sphere always shows correctly, so it may be related to z-sorting or the way i’m building the 2nd sphere ? o.O

The images are loaded through Loader3D and i can see from the traces that they are loaded succesfully…also if i apply the atmosphere texture on the “terrain” sphere, it shows correctly. Below is the planet creation code ( the class extends ObjectContainer3D class so i can move the whole planet more easily ).

/**
 * builds the planet
 * @param pW the radius o the planet
 * @param segH number of horizontal segments
 * @param segV number of vertical segments
 * @param lightPicker the lightPicker to be used for materials
 */
public function init(pW:NumbersegH:uintsegV:uintlightPicker:StaticLightPicker):void
{
  _radius 
pW;
  var 
geom:SphereGeometry = new SphereGeometry(pWsegHsegV);
  var 
material:TextureMaterial = new TextureMaterial(_meshTexture);
 
material.lightPicker lightPicker;
 
material.specular 0;
 
_mesh = new Mesh(geommaterial);
 
addChild(_mesh);
   
 if (!
_atmTexture)
  return;
    
geom = new SphereGeometry(pW segHsegV);
material = new TextureMaterial(_atmTexture);
material.alphaBlending true;
material.lightPicker lightPicker;
material.specular 0;
_atmMesh = new Mesh(geommaterial);
addChild(_atmMesh);
   
trace(_mesh.position "        " _atmMesh.position);
trace(SphereGeometry(_mesh.geometry).radius "        " SphereGeometry(_atmMesh.geometry).radius);

Any help would be greatly appreciated ^^

   

doomdrake, Newbie
Posted: 10 April 2012 12:14 PM   Total Posts: 14   [ # 1 ]

Fixed. The rotation appplied to the atmosphere sphere was NaN and that somehow made the whole sphere not render ( figured this out when i removed the rotation and the atmoshpere showed )...maybe add a if(value == NaN) condition ? ^^

   

Avatar
Baush, Sr. Member
Posted: 10 April 2012 12:15 PM   Total Posts: 135   [ # 2 ]

Hello, the problem could come from your _atmtexture . Please provide the code for its initialization.

Try putting a larger offset between your atmosphere and terrain

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X