Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PNG transparency (Fixes #2) #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baudm
Copy link

@baudm baudm commented Feb 3, 2018

This is a JME issue. Since the modified code is internal to JME, a new
class with the same interface is created instead.

There are two problems:

  1. Renderer.readFrameBuffer() fills the output ByteBuffer with the wrong transparency information. Instead of setting the background to be fully transparent (0x00), the alpha channel bits are set to 0xff, or fully opaque.
  2. When an image of type BufferedImage.TYPE_INT_BGR is written, the alpha channel information is lost and is never written. Hence, we end up with 3-channel PNGs instead of 4.

This is a quick fix which should address the issue without waiting for JME to fix the issue on their end.

baudm added 2 commits February 3, 2018 15:05
This is a JME issue. Since the modified code is internal to JME, a new
class with the same interface is created instead.
@ghost
Copy link

ghost commented Mar 2, 2018

When I Render bowl,maybe the part of the bowl become transparency,how to solve it?

5f2ef71aa9b94edbb84959963148f2a2-0

@baudm
Copy link
Author

baudm commented Mar 6, 2018

Is this the result from my branch?

@ghost
Copy link

ghost commented Mar 6, 2018

yes ,it is.I guess the channel of the alpha has a little problem

@baudm
Copy link
Author

baudm commented Mar 6, 2018

Ok, looking at my code, I think I'm making all white pixels transparent. The problem is: how to determine whether a white pixel is truly transparent (i.e. background) or still part of the rendered image?

@ghost
Copy link

ghost commented Mar 8, 2018

I don't know whether to adjust the color of the light to decide to set the pixel to be transparent or not ? Always the direct zone of the ray or the brightest part seem to be wrongly decided. or applying Affine Transformation to decide to the transparent part if getting the motion info of the camera

@baudm
Copy link
Author

baudm commented Mar 8, 2018

I've read some comments before that the transparency is fine on OS X, but doesn't work in Linux and Windows. This is actually harder to fix because the actual rendered image doesn't contain proper values for the alpha channel.

@ghost
Copy link

ghost commented Mar 8, 2018

Your advice is very important for me,thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant