Skip to main content

True transparent background (yes, I did it !)

11 replies [Last post]
mikofclassx
Offline
Joined: 2003-07-02

Hello all,

I have modified the Canvas3d.c (ogl) in order to obtain a nice offscreen canvas with true (alpha = 0) transparent backgorund. It works very well and I would like to see this feature in the next Java3D. KCR do you read me ?

Cheers,

Mik
--

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kcr
Offline
Joined: 2004-03-17

> I have modified the Canvas3d.c (ogl) in order to obtain a nice offscreen canvas with
> true (alpha = 0) transparent backgorund. It works very well and I would like to
> see this feature in the next Java3D. KCR do you read me ?

This should be a fairly easy API addition in Java 3D 1.4, as long as we are just talking about off-screen Canvas3D. My first thought is to add an "alphaSize" attribute GraphicsConfigTemplate and the ability to specify alpha as part of the background color (i.e., the Background node will need to take a Color4f as well as the current Color3f).

-- Kevin

mikofclassx
Offline
Joined: 2003-07-02

Yes Kevin, you simply anticipated my suggestions.
Why don't you put such functionality into the next beta ? I really need such feature and I need it as soon as possible (as usual..). It makes my fps jump at 2x and also allows me to keep my code simpler as I do not need to filter the background anymore.

As of onscreen Canvas3D, am I rigth when I say that the problem is the heavyweight nature of the canvas ?

Cheers,

Mik
--

kcr
Offline
Joined: 2004-03-17

> Yes Kevin, you simply anticipated my suggestions. Why don't you put such functionality into the next beta ?

Since this requires API change, there is no way to add it in version 1.3.2 (per the Java Community Process, API changes are only allowed with an approved Java Specification Request (JSR) as part of a "dot" release).

Java 3D 1.4, which is the programmable shader release, is the earliest opportunity to add new API to core javax.media.j3d classes. The only short-term solution I can think of is to add this in as an experimental feature that would be enabled by setting a Java property. When set, this property would cause all off-screen Canvas3Ds to be created with an alpha buffer and use the default alpha=0 for background color. If you're willing to take a stab at doing this, let me know; you would need to submit a Joint Copyright Assignment.

Btw, as part of the fix for Issue 20, the GLX code for context creation is undergoing a bit of reorganization / code cleanup, which affects how pbuffers are created.

> As of onscreen Canvas3D, am I rigth when I say that the problem is the heavyweight nature of the canvas ?

Yes.

-- Kevin

mikofclassx
Offline
Joined: 2003-07-02

Thanks Kevin,

this night I was thinking of implementing the feature by myself and sending the sources to you.

Of course I prefer the "real" solution, with Color4f background and AlphaBits into GraphicsConfig.
It should not be _that_ complicated and I can implement the feature today itself. Even more I'm sure this feature does not break any backwards compatibility.

I can also implement the ".properties" version if you want, but I could miss the possibility to have offscreen opaque backgrounds when the property is set.

Let me know.

Silvère Martin-Michiellot

At 12:53 20/09/2004, you wrote:
>Hello all,
>
>I have modified the Canvas3d.c (ogl) in order to obtain a nice offscreen
>canvas with true (alpha = 0) transparent backgorund. It works very well
>and I would like to see this feature in the next Java3D. KCR do you read me ?

Hi,

Did I read correctly ? A canvas3D with transparent background ? In which we
could underlay some graphics ? Why not also for onscreen canvas ?

By the way, if anoyone could add a method to compute the light that falls
on every particular vertex, that would be very useful (for example to
compute the total illumination and therefore the received energy of a
surface and may be work out some cool effects.

Cheers.

Silvere.

>Cheers,
>
>Mik
>--
>---
>[Message sent by forum member 'MikOfClassX' (MikOfClassX)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=29297牱
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

__________________________________________________________________________________________

Silvere Martin-Michiellot builds the Internet future on
www.digitalbiosphere.com
__________________________________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

mikofclassx
Offline
Joined: 2003-07-02

Silvère,

yes, you read it correcly. We can grab an offscreen Canvas3D contents with the correct alpha. I'm afraid you'll not be able to put a Canvas3D into a JPanel and see the background due to the heavyweight nature of Canvas3D (or due to a fault in my implementation). It will remain fully opaque. But you could simply grab the offscreen and then blit it into the JPanel (like I'm doing..) by overriding the painComponents().

For the second question... I have no clue.

Cheers,

Mik

Silvère Martin-Michiellot

At 18:31 20/09/2004, you wrote:
>Silvère,
>
>yes, you read it correcly. We can grab an offscreen Canvas3D contents with
>the correct alpha. I'm afraid you'll not be able to put a Canvas3D into a
>JPanel and see the background due to the heavyweight nature of Canvas3D
>(or due to a fault in my implementation). It will remain fully opaque. But
>you could simply grab the offscreen and then blit it into the JPanel (like
>I'm doing..) by overriding the painComponents().

... by overriding the painComponents() ... and you do succeed. Could you
send me a screen capture ? I'd dream about that.

>For the second question... I have no clue.

Well, this would need to hack the Java3D source code by one of you. ;)

>Cheers,
>
>Mik
>---
>[Message sent by forum member 'MikOfClassX' (MikOfClassX)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=29384狈
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

__________________________________________________________________________________________

Silvere Martin-Michiellot builds the Internet future on
www.digitalbiosphere.com
__________________________________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

mikofclassx
Offline
Joined: 2003-07-02

Hi Silvère. Here it is: www.classx.it/public/j3dpanel.jpg

I'll send you the final sources of my canvas3d as soon as the transparent background feature will be incorporated into java3d.

Cheers,

Mik

Silvère Martin-Michiellot

At 11:07 21/09/2004, you wrote:
>Hi Silvère. Here it is: www.classx.it/public/j3dpanel.jpg
>
>I'll send you the final sources of my canvas3d as soon as the transparent
>background feature will be incorporated into java3d.

Soooo good.

>Cheers,
>
>Mik
>---
>[Message sent by forum member 'MikOfClassX' (MikOfClassX)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=29553獱
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

__________________________________________________________________________________________

Silvere Martin-Michiellot builds the Internet future on
www.digitalbiosphere.com
__________________________________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Mike Pilone

The transparent background is nice, but couldn't you get the same effect by
grabbing the background color of the canvas parent and setting it on a
background node? Obviously this wouldn't work if you are looking to capture
with true transparency.

Just an idea.

-mike

-----Original Message-----
From: Silvère Martin-Michiellot [mailto:silvere@digitalbiosphere.com]
Sent: Tuesday, September 21, 2004 7:22 AM
To: interest@java3d.dev.java.net
Subject: Re: [JAVA3D-INTEREST] True transparent background (yes, I did

At 11:07 21/09/2004, you wrote:
>Hi Silvère. Here it is: www.classx.it/public/j3dpanel.jpg
>
>I'll send you the final sources of my canvas3d as soon as the transparent
>background feature will be incorporated into java3d.

Soooo good.

>Cheers,
>
>Mik
>---
>[Message sent by forum member 'MikOfClassX' (MikOfClassX)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=29553獱
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

____________________________________________________________________________
______________

Silvere Martin-Michiellot builds the Internet future on
www.digitalbiosphere.com
____________________________________________________________________________
______________

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

mikofclassx
Offline
Joined: 2003-07-02

Mike you have to know that I need a TRUE alpha background, (i.e. alpha=0) and not a visual trick.
In my apps I grab the 3d scene and save it as TGA (or whatever) for subsequent blending over existing graphics.

This new feature allows me to achieve the result without having to trick with chroma keys, fake appearances and so on. Ah, yes, my FPS jumped from 25 to 50...

Cheers,

Mik
--