Transparency in cube faces?

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
erik leeman
Posts: 470
Joined: Sat Sep 09, 2006 10:51 am
Contact:

Mon Jan 25, 2010 9:41 pm

Hi all,

I've now learned how to replace cube faces using AS3 code, and I know how to stack panos on top of each other, so now I want to make 'see through' windows.
For this I've made a replacement cubeface with a transparent area in Photoshop, and I've saved it as PNG24 with an alpha channel.
Then I modified my preloader so it loads this new PNG24 cubeface, and replaces one of the original cubefaces with it.
So far, so good.

However, to my disappointment the transparent area is no longer transparent in the pano, it becomes white.
Here's a screenshot:
(I made the foremost pano a little bit translucent to show that there is indeed a pano behind it)

Image

Does anyone know why that is so?
What can I do to retain transparency in that cubeface?

I sure hope someone has the answer, it would be a real pity if this couldn't be made to work.

Cheers!

Erik

edit: new screenshot with more clearly marked 'windows' and text painted on the .png before replacing cube face.
Last edited by erik leeman on Tue Jan 26, 2010 7:52 pm, edited 1 time in total.
User avatar
360Texas
Moderator
Posts: 3393
Joined: Sat Sep 09, 2006 6:06 pm
Location: Fort Worth, Texas USA
Contact:

Tue Jan 26, 2010 3:05 pm

question: did you also try a transparent .gif ?
Dave
Pano2VR Forum Global Moderator
Image
Visit 360texas.com
Sebastian
Posts: 209
Joined: Sun Jul 13, 2008 9:08 am
Contact:

Tue Jan 26, 2010 3:16 pm

My guess is that the AS3.0 in the original file creates shapes filled with color before they are mapped with raster images, so there is a solid based below each JPG. We can't see it while panorama is full loaded but the semi transparent PNG reveals it. There should be a property or variable that control it, but you would have to ask Thomas what are the names in order to control it from outside.

regards
Sebastian
Posts: 209
Joined: Sun Jul 13, 2008 9:08 am
Contact:

Tue Jan 26, 2010 3:20 pm

Also, you might want to try using WMODE to set the player transparency ON, perhaps what you see the player based control by object/embed tags...
smooth
Posts: 1493
Joined: Sat Sep 09, 2006 7:30 pm

Tue Jan 26, 2010 4:39 pm

My answer would have been WMODE just as Sebastian mentioned. This is the normal parameter for transparency in Flash.
Otherwise bgcolor HEX #FFFFFF colour is called.

Regards, Smooth 8)
Image
erik leeman
Posts: 470
Joined: Sat Sep 09, 2006 10:51 am
Contact:

Tue Jan 26, 2010 6:50 pm

I tried wmode="transparent" and <param name="wmode" value="transparent">,
but, as I expected, that didn't do anything.
I guessed it wouldn't because I have light grey as background colour in my embedding code, not white.
Besides, I don't want the HTML-background to be visible (although I imagine that could be useful in some cases), but the other pano!
My guess is that the AS3.0 in the original file creates shapes filled with color before they are mapped with raster images, so there is a solid based below each JPG.
I think you are right Sebastian.
What I think is my problem, is that Thomas probably set the transparency parameter in his BitmapData specs to 'false'.
And why shouldn't he? How could he have anticipated that one day a fool would attempt to load multiple panos, stack them on top of each other, and make little peep holes in them?
I don't think I would have.

This is a bit of the code I use to load the .png24 (with alpha channel) into the pano:

Code: Select all

function onImageLoader(evt:Event):void {
	var myBitmapData = new BitmapData(imageLoader.width, imageLoader.height, true);
	myBitmapData.draw(imageLoader.content);
	var bmp:Bitmap = new Bitmap();
	bmp.bitmapData = myBitmapData;
	vrB.pano.bmpTile[0] = bmp.bitmapData;
}
As (some of) you can see, I set the transparency parameter to 'true', so that should work fine.
Unless I f*cked up of course, being the AS3 nitwit that I am.
The cubeface is loaded allright, the original one is replaced as it should, so my code as such seems to be ok.

I asked Thomas about this, I hope he can tell me what to do (if anything).

Cheers!

Erik

ps: sorry, I didn't try a transparent GIF, it would be a true miracle if that would work ; )
erik leeman
Posts: 470
Joined: Sat Sep 09, 2006 10:51 am
Contact:

Sat Feb 06, 2010 11:20 pm

Solved the problem :D
Posted details in a different thread (http://gardengnomesoftware.com/forum/vi ... 030#p15916)

Here's a screenshot of my testpano showing transparent areas where the pano behind it is visible:

Image

Erik
smooth
Posts: 1493
Joined: Sat Sep 09, 2006 7:30 pm

Sun Feb 07, 2010 5:52 am

Congrats Erik,

Just like a new born.

Regards, Smooth 8)
Image
erik leeman
Posts: 470
Joined: Sat Sep 09, 2006 10:51 am
Contact:

Sat Feb 13, 2010 12:14 am

Here's an example of an interior with transparent windows:

http://tinyurl.com/Pano2VR-SwitchView

Just click on the red buttons (both of them).

The outside view that is revealed does not move exactly in sync with the interior, instead it moves in a way that simulates the natural parallax that happens when you move your head.
In this demo I exaggerated the parallax effect on purpose to make it more noticeable, it should of course be a lot more subtle to be realistic.
This is just one example of what can be done with transparency, Pano2Vr, and ActionScript3, there's soooo much more you could do!

Cheers!

Erik
Noisy
Posts: 35
Joined: Wed Apr 04, 2007 12:49 am
Location: Scotland

Fri Oct 01, 2010 4:59 pm

That's really nice, most obvious when moving up and down!
Post Reply