|
Ed, Newbie
Posted: 20 September 2013 01:34 PM Total Posts: 5
Hi!
I´m new on Away3d and I was trying to learn the basics. I found this tutorial from GotoAndLearn - TUTORIAL LINK
It was working flawless until I tried to set SkyBoxMaterial on the cube. When I run the code, the cube dissapear. If I set ColorMaterial the cube shows normaly.
I´m coding on FlashBuilder 4.6 with FP11.
Thank you!
|
SharpEdge, Member
Posted: 20 September 2013 04:37 PM Total Posts: 94
[ # 1 ]
Oh the problem is that you shouldn’t use a cube but a SkyBox instance.
SkyBoxMaterial is used internally by SkyBox and you should never instantiate it directly.
var skyBox : SkyBox = new SkyBox(cubeTexture);
scene.addChild(skyBox);
|
Ed, Newbie
Posted: 20 September 2013 05:21 PM Total Posts: 5
[ # 2 ]
SharpEdge - 20 September 2013 04:37 PM Oh the problem is that you shouldn’t use a cube but a SkyBox instance.
SkyBoxMaterial is used internally by SkyBox and you should never instantiate it directly.
var skyBox : SkyBox = new SkyBox(cubeTexture);
scene.addChild(skyBox);
That´s my problem. I´m struggling to find a way to texturize my cube. Since the way they teach on that video doesn´t work….
Thank you for help!
|
Ed, Newbie
Posted: 20 September 2013 05:53 PM Total Posts: 5
[ # 3 ]
I just figured out how to apply texture to a cube. Wasn´t like the video where that guy used separated images files for each cube face.
I manage to use a single image with all faces on it. Unless I can place my camera outside the SkyBox, I think I´ll have to stick with that!
Peace
|
GrokDD, Newbie
Posted: 20 September 2013 11:40 PM Total Posts: 28
[ # 4 ]
Ed,
If you want to use six different images for your skybox, successfully I use the following code in FlashBuilder 4.6 FP11.7 Away3D Gold 4.1.4
Hope this helps!
<fx:Script> <![CDATA[ import away3d.primitives.SkyBox; import away3d.textures.BitmapCubeTexture; import away3d.utils.Cast; // Skybox textures. [Embed(source="../embeds/space_posX.png")] private var PosX:Class; [Embed(source="../embeds/space_negX.png")] private var NegX:Class; [Embed(source="../embeds/space_posY.png")] private var PosY:Class; [Embed(source="../embeds/space_negY.png")] private var NegY:Class; [Embed(source="../embeds/space_posZ.png")] private var PosZ:Class; [Embed(source="../embeds/space_negZ.png")] private var NegZ:Class; private var skyBox:SkyBox; private var cubeTexture:BitmapCubeTexture; public function init():void { createDeepSpace(); } private function createDeepSpace():void { // Cube texture. cubeTexture = new BitmapCubeTexture( Cast.bitmapData( PosX ), Cast.bitmapData( NegX ), Cast.bitmapData( PosY ), Cast.bitmapData( NegY ), Cast.bitmapData( PosZ ), Cast.bitmapData( NegZ ) ); // Skybox geometry. skyBox = new SkyBox( cubeTexture ); away.view.scene.addChild( skyBox ); } ]]> </fx:Script>
|
SharpEdge, Member
Posted: 23 September 2013 07:54 AM Total Posts: 94
[ # 5 ]
@GrokDD: he want’s to apply 6 different images to a cube, this thread has nothing to do with skyboxes…
@Ed: Forget SkyBoxes and SkyBoxMaterials, they aren’t made for what you want to do.
|
Ed, Newbie
Posted: 23 September 2013 01:21 PM Total Posts: 5
[ # 6 ]
SharpEdge - 23 September 2013 07:54 AM @GrokDD: he want’s to apply 6 different images to a cube, this thread has nothing to do with skyboxes…
@Ed: Forget SkyBoxes and SkyBoxMaterials, they aren’t made for what you want to do.
That´s right SharpEdge!
I figured how to apply texture to a cube… saddly I can´t have separated images for each face. Maybe that tutorial video was made using a Away3D beta version…
Thank you for helping!
Peace!
|
SharpEdge, Member
Posted: 23 September 2013 01:33 PM Total Posts: 94
[ # 7 ]
A solution could be to create your cubic texture dinamically taking six images and drawing all of them in one bitmap.
|
|
Ed, Newbie
Posted: 23 September 2013 07:29 PM Total Posts: 5
[ # 9 ]
SharpEdge - 23 September 2013 03:05 PM Found this dirty solution, you’ll get six draw call and that’s not so good if you have complex scene.
http://greencollective.nl/blog/?p=54
Indeed… not so good for complex scenes. But works pretty nice for what I need right now! Ill give a try!!
Thanks!
|