This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=320 as retrieved on 3 Aug 2007 01:36:45 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:d5P0Uk6jxO4J:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D320+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=21


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ porting from 1.1 to 1.2 beta

Posted by: hardbutnot Feb 15 2007, 01:11 PM

Hey.

I'm attempting to update what I'd already built from 1.1. to 1.2. dry.gif

There are a couple of things that I wondered if you could help with...
1) when I change from a clipscreen to a *standard* movie clip, the camera *size* is not being maintained - i.e. the scene runs off the side of the space i want it to go... My code is below, the commented bits are the ones that were working in 1.1...
// var screen:ClipScreen = new ClipScreen( this.createEmptyMovieClip('screen_mv', 1), 600, 570 );
var screen = _root.createEmptyMovieClip("screen_mv", this.getNextHighestDepth(), 600, 570);
World3D.getInstance().setContainer(screen);
// create camera
// cam = new Camera3D( 700, screen);
cam = new Camera3D(600, 570);
cam.setPosition(_root.camPosX, _root.camPosY, _root.camPosZ)
cam.lookAt(0, 0, 0);
// add the camera to the world
// World3D.getInstance().addCamera( cam );
World3D.getInstance().setCamera( cam );
// create the root node.
bg = new Group();
World3D.getInstance().setRootGroup( bg );
// launch the scene
createScene( bg );
// launch the world rendering
World3D.getInstance().render();

2) I'm loading some Plane3D's with images on (hopefully) one face. In 1.1 I was able to set the back face culling and a box with a line across it appeared when the camera moved to the untextured face. This is precisely what I want to happen, but the 1.2 code is not working the same...
// set the back-face of the skin to be a *simple* box
// newo.enableBackFaceCulling = false;
newo.enableBackFaceCulling(false);

Is there a change to this functionality? or a different call to make?

3) The most recent change I made to my application was to implement a *smooth camera movement* function. This worked perfectly in 1.1, but the following code doing something very odd with the camera in version 1.2. Again - is there a change to the functionality, or a different call to make?
// function to move camera to new location
function moveSmoothTo(newX:Number, newY:Number, newZ:Number):Void {
var camEase:Ease = new Ease();
camtrans = new PositionInterpolator( camEase.create(),20,
new Vector( _root.camPosX, _root.camPosY, _root.camPosZ ),
new Vector( newX, newY, newZ ) );
_root.cam.setInterpolator( camtrans );
// when interpolation ends, fire the look at function..
camtrans.addEventListener( InterpolationEvent.onProgressEVENT, this, lookAtIt );
camtrans.addEventListener( InterpolationEvent.onEndEVENT, this, removeMoving );
}
// function to remove moving movie
function removeMoving() {
_root.cam.setPosition(_root.camPosXFinal, _root.camPosYFinal, _root.camPosZFinal);
_root.cam.lookAt(_root.currPosX, _root.currPosY, _root.currPosZ);
}
// function to look at current image
function lookAtIt() {
_root.cam.lookAt(_root.currPosX, _root.currPosY, _root.currPosZ);
}

I've had a good search through the Wiki and this forum for anything about the above three issues, and I'm unable to find anything which answers my queries... any help would be most appreciated.

Posted by: hardbutnot Feb 15 2007, 01:34 PM

minor update... when I add
newo.enableClipping( true );

to the creation of each object, then 1) only becomes a problem with the vertical dimension of the screen. 2) is still a problem - 1.2 is rendering both sides of the Plane3D. 3) turns out to be working perfectly -- it was bits of the other objects coming in front of the camera somehow... I've attach a screenshot for reference...




Attached thumbnail(s)
Attached Image

Posted by: hardbutnot Feb 15 2007, 02:14 PM

Another minor update... it seems the Camera3D(width, height) won't do anything except a "square" based on the first dimension??
i.e. Camera3D(600,570) == Camera3D(600,0) == Camera3D(600,600)

I think I can easily work around this issue by making my flash canvas slightly different... so I think I am happy with this as a solution to issue 1) for now.

so I'm only looking for an answer on 2) the backFaceCulling / enableClipping problem.

Posted by: kiroukou Feb 15 2007, 02:46 PM

Hi,
It's nice that you are finding the solution so tyour problems yourself smile.gif
The new dimensions of the camera are really true if the clipping is enabled with all the worlds objects. This would be the behaviour with a fast platform, but it's not, so I prefer to let people make their choice.
So you have to set the correct position of the world container. The dimensions you give to the camera is the area where the scene will be drawn. If you augment it, you'll not see more things, but exactly the same bigger or smaller (and previous version did'nt do that).

Concerning the problematic second point, I don't see the point... But maybe this can be a sort problem? Is it an object that is displayed and that wasn't before? Or a box in a middle of a plane? Because the current 1.2 beta does not allow that. But this will change back soon!

Posted by: hardbutnot Feb 15 2007, 04:29 PM

Thanks for the response.

I'm still in error-land tho...

Previously I created a Plane3D then added a skin to it. When the camera was on the *not normal* side of the Plane3D, what was rendered was a black square which was transparent. I've attached two screenshots to highlight this. The first (screen_1.png) is the 1.1 version, the second (screen_2.png) is the 1.2 version...

hopefully you now see what I mean?


Attached thumbnail(s)
Attached Image Attached Image

Posted by: kiroukou Feb 15 2007, 05:00 PM

Oh ok.
This seems to be a back skin problem.
To solve this, try to apply a simpleLineSkin to the plane with setBackSkin( new SimpleLineskin() )

Not sure it will solve (temporary!) the problem, but you can give it a try smile.gif

Posted by: hardbutnot Feb 15 2007, 05:19 PM

QUOTE(kiroukou @ Feb 15 2007, 05:00 PM) *

Oh ok.
This seems to be a back skin problem.
To solve this, try to apply a simpleLineSkin to the plane with setBackSkin( new SimpleLineskin() )

Not sure it will solve (temporary!) the problem, but you can give it a try smile.gif


hmmm. I like your thinking, but that didn't work. It seems when I do the ...
newo.setSkin( new TextureSkin( bitmap ));
that the textureSkin takes over both faces of the Plane3D... maybe this could be a "bug" with 1.2?

Posted by: kiroukou Feb 15 2007, 06:01 PM

Sure it can be smile.gif

I'll look at it. But even if you specify both setSkin and setBackSkin the problem exists...
What a shame.

Thanks for the report(s) !

Posted by: Vatrobot Feb 22 2007, 03:28 PM

I've noticed this problem too! ohmy.gif

setSkin and setBackSkin functions in the Object3DClass seem to be copied and pasted.. i think the problem is in the

var l:Number = aFaces.length;
while( --l > -1 )
{
aFaces[l].updateTextureMatrix( _s );
}

part. I tried this code:

// myPlane3D triangulated, quality set to 1

var myPlane3DFaces:Array = myPlane3D.aFaces; // myPlane3DFaces.length returns 2
var faceFront:Object = myPlane3DFaces[0];
var faceBack:Object = myPlane3DFaces[1];

// skin A and B are MovieSkins

faceFront.setSkin(skinA);
faceBack.setSkin(skinB);

... although it didn't work, i still love sandy biggrin.gif

Posted by: Vatrobot Feb 22 2007, 04:12 PM

... or somewhere in the PolygonClass, suspected functions: updateTextureMatrix, render...

Posted by: kiroukou Feb 22 2007, 04:22 PM

Do you want to have a different texture to both sides?


Posted by: Vatrobot Feb 22 2007, 04:36 PM

QUOTE(kiroukou @ Feb 22 2007, 05:22 PM) *

Do you want to have a different texture to both sides?


Yes! The code before was stupid, here is my correct one which doesn't work:

private function addSkin() {
var skinA:Skin = new MovieSkin( 'skinfront', true);
var skinB:Skin = new MovieSkin( 'skinback', true);

skinA.setLightingEnable( false );
skinB.setLightingEnable( false );

myPlane3D.setSkin(skinA);
myPlane3D.setBackSkin(skinB);
}

setBackSkin simply doesn't work... it would be nice if you could help.

Posted by: Petit Feb 22 2007, 04:37 PM

QUOTE(Vatrobot @ Feb 22 2007, 04:28 PM) *

I've noticed this problem too! ohmy.gif

CODE
// myPlane3D triangulated, quality set to 1
var myPlane3DFaces:Array = myPlane3D.aFaces; // myPlane3DFaces.length returns 2
var faceFront:Object = myPlane3DFaces[0];
var faceBack:Object = myPlane3DFaces[1];
// skin A and B are MovieSkins
faceFront.setSkin(skinA);
faceBack.setSkin(skinB);

... although it didn't work, i still love sandy biggrin.gif

No, that shouldn't work. Nice try though wink.gif
I suppose your myPlane3D is a Plane3D, whith the quality set to 'tri'.
As the plane is a square, it has to be divided into two triangles, which means that the number of faces are two, and the myPlane3DFaces.length returns 2.
If all this is true, you should see skinA and skinB on the 'front' side of the plane.
Or rather half of skinA and half of skinB.

Setting skins on the back side of the plane involves setBackSkin( someSkin ),
and disabling back face culling, i.e
CODE
myPlane3D.enableBackFaceCulling( false );

For some reason it doesn't seem to work in this 1.2 beta version.

Posted by: Vatrobot Feb 22 2007, 04:50 PM

hehehe, yes i know that was a wrong way...
for a better understanding, here is what i'm working on: http://sandyplayground.vatrobot.com

Posted by: kiroukou Feb 22 2007, 05:17 PM

Ok,
The 1.2 BETA does not support both front and backside textured...
It's temporary don't worry wink.gif
And I don't see any hack for the moment, unless you want to code this support smile.gif

Posted by: Vatrobot Feb 22 2007, 05:24 PM

QUOTE(kiroukou @ Feb 22 2007, 06:17 PM) *

Ok,
The 1.2 BETA does not support both front and backside textured...
It's temporary don't worry wink.gif
And I don't see any hack for the moment, unless you want to code this support smile.gif


i'm still chewing on it, we shall see, if i find a solution i'll let everybody know biggrin.gif

Posted by: Jeffrey Blyseth Feb 22 2007, 10:43 PM

Hi Thomas,
I just noticed this thread regarding backSkin. Is backSkin still not working in 1.2? Could you give me an idea of whether this will be supported or is being removed? Also why it might not be working now?

For a plane that I want a front and a back for I guess I need to create 2 planes?

Posted by: Vatrobot Feb 22 2007, 10:54 PM

QUOTE(Jeffrey Blyseth @ Feb 22 2007, 11:43 PM) *

For a plane that I want a front and a back for I guess I need to create 2 planes?


... i tried that (with a small offset to second plane) - it looks okay, but it's a fake and it reduces performance... setBackSkin... such a nice feature and i didn't even had a chance to use it... pleas fix it kiroukou, i'm not good enough yet wink.gif

Posted by: Jeffrey Blyseth Feb 22 2007, 10:59 PM

Yeah, it's a bummer. Having the backface skin different is so convenient. I too am worried about performance, although I wonder how much different the performance would be if the both planes had enableBackFaceCulling(true); But you still have to transform 2 objects instead of 1 for each plane sad.gif

Posted by: Petit Feb 23 2007, 12:14 AM

QUOTE(Jeffrey Blyseth @ Feb 22 2007, 11:59 PM) *

Yeah, it's a bummer. Having the backface skin different is so convenient.

Well, I'm sure the backSkin will be back ( unintended pun ), even in the 1.2 version.
For now I'd use Sandy 1.1, where the setBackSkin works well, http://www.petitpub.com/labs/media/flash/sandy/skinning.shtml if you haven't already.

Posted by: Jeffrey Blyseth Feb 23 2007, 12:19 AM

Your tutorials are really great.
I had backfaces working fine in v1.1, unfortunately I'm committed to using 1.2 for a myriad of other reasons. Any news on an update? And if one is coming, will backfaces be in it?

Posted by: Vatrobot Feb 23 2007, 02:02 AM

I started and am staying with 1.2 Beta testing looking foreward biggrin.gif ... trying to figure out why something doesn't work is also a great way of getting more familiar with the engine.

So, here is something else:

CODE


function createThumb()
{
thumb = new Box( 160, 15, 160, 'tri');
thumb.enableBackFaceCulling(false);
}
    
function addSkin()
{
var thumbFaces = thumb.aFaces;
        
var skinA:Skin = new MovieSkin( 'skinfront', true);
var skinB:Skin = new MixedSkin(0xC89159, 100,0,0,0);
        
skinA.setLightingEnable( true );
skinB.setLightingEnable( true );
        
//top face

thumbFaces[6].setSkin(skinA);
thumbFaces[7].setSkin(skinA);

// the rest

thumbFaces[0].setSkin(skinB);
thumbFaces[1].setSkin(skinB);
thumbFaces[2].setSkin(skinB);
thumbFaces[3].setSkin(skinB);
thumbFaces[4].setSkin(skinB);
thumbFaces[5].setSkin(skinB);
thumbFaces[8].setSkin(skinB);
thumbFaces[9].setSkin(skinB);
thumbFaces[10].setSkin(skinB);
thumbFaces[11].setSkin(skinB);
}


Problem: Faces skined correctly, but Bitmap in a MovieClip not visible (grey). Same skin works fine as Plane3D-Skin > Bitmap visible + correct animations

check it out at http://sandyplayground.vatrobot.com (in 2 minutes...)

Posted by: Vatrobot Feb 23 2007, 02:25 AM

correction:

CODE
thumb.enableBackFaceCulling(true);


there are also some strange "white light stripes" on left and top of the whole scene if i play it in a browser (Firefox 2.0), but I'm not sure if it's not a local problem of some kind... please give me some feedback on that too... thanx and good night/good morning!

Posted by: Petit Feb 24 2007, 10:16 PM

QUOTE(Jeffrey Blyseth @ Feb 23 2007, 01:19 AM) *

Your tutorials are really great.
Any news on an update? And if one is coming, will backfaces be in it?

Thanks for your kind words Jeffrey!

Rumors has it, that an update should be out at the end of the month.
The back skin will be back, and hopefully in the next release.

Posted by: Petit Feb 24 2007, 10:47 PM

QUOTE(Vatrobot @ Feb 23 2007, 03:25 AM) *

Faces skined correctly, but Bitmap in a MovieClip not visible (grey) ..

I have done some experimenting with skins on a cube now, and with the latest 1.2 beta 2
and a bitmap ( extracted your Sandy logo ) smile.gif in a MovieClip in the library - link 'Sandy' I have two skins:
CODE
var movskin:Skin = new MovieSkin('Sandy');
var mixskin:Skin = new MixedSkin( 0x00FF00, 80, 0, 100, 1 );

1. Skinning the whole cube with the movskin works OK
2. Changing the skin to mixskin for all but faces[6] and faces[7] makes the moveskin one color.
3. Skinning the whole cube with mixskin and then changing faces[6] and faces[7] to movskin gives the same
result.
4. Not skinning the whole cube at all, and then in a loop setting the wanted skins, gives the same result.
This is the same as in your example above.
5. Setting only mixskin on all faces one bye one looks okay - all faces have the MixedSkin
6. Setting only movskin on all faces one by one, makes all faces grainy and one colored.

Conclusions:
You cannot set a MovieSkin directly on the faces - you must do it on the whole Object3D.
If you set MixedSkin to separate faces afterwords, the MovieSkin is corrupted.

Your textures went grey and mine orange, so the griny color we get comes from the applied texture,
probably the upper left corner, where the vatrobot logo is grey and the Sandy logo is orange.
This certainly looks like corruption of UV coordinates.
------------
QUOTE(Vatrobot @ Feb 23 2007, 03:25 AM) *

... there are also some strange "white light stripes" on left and top of the whole scene if i play it in a browser (Firefox 2.0)

The stripes are there at least for Flash Player 9, in Firefox or stand alone.
One may wonder where the problem lies, but I know where the stripes comes from.

They come from an image, which you see if you zoom out and pan the movie.
I attach a screen shot here, and you can check where that image is.
Is it something you set as texture of a Plane or Box - and if so do place the image on Stage first?
Or is it an image that you want to have on the Stage.

Why it gives the stripes I don't know, but maybe you can try to use it some other way.
If you want me to guess better, you might send me the fla ( if you use one ) and the ActionScript, and I will have a look at it. ( If you send it by mail, I'll keep it confidential wink.gif

I'm not sure I can solve it, but it's an interesting problem.


Attached thumbnail(s)
Attached Image Attached Image

Posted by: Vatrobot Feb 25 2007, 05:27 PM

Hello Petit!

I've sent you a link to the files.
Have a look and thanx!

Feel free to change/correct/improve &/or publish code.



Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)