Skip to content

pen transparency fix #418

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

Merged
merged 11 commits into from
Apr 30, 2019
Merged

pen transparency fix #418

merged 11 commits into from
Apr 30, 2019

Conversation

peabrainiac
Copy link
Contributor

Clears the pen framebuffer with transparent black instead of transparent white so transparent parts of the pen layer don't show up lighter than they should anymore.

See https://scratch.mit.edu/projects/277120576/.

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking down and fixing this!

I think the other call to gl.clearColor, down in _setCanvasSize, should be changed too. Even better: you could set a constant near the top of the file and use that constant in both gl.clearColor calls.

@peabrainiac
Copy link
Contributor Author

Thanks for tracking down and fixing this!

I think the other call to gl.clearColor, down in _setCanvasSize, should be changed too. Even better: you could set a constant near the top of the file and use that constant in both gl.clearColor calls.

Yeah, I made the pull request a little too early and forgot to double-check that. There's also one more thing that needs to be changed - I think the pen layer is rendered with the wrong blend functions. However, I couldn't find out which function is responsible for rendering the pen layer to the stage - could you help me out there? @cwillisf

changed clearColor on `_setCanvasSize`
Modified blend function in `_drawThese` to blend skins with premultiplied alpha correctly
@peabrainiac
Copy link
Contributor Author

peabrainiac commented Mar 2, 2019

Transparent pen now works just as expected, but now there's an issue when stamping transparent sprites. Once that is fixed this should all be working though.
Edit: nope, I misunderstood the rendering process once again. This is going to take a while.

@peabrainiac
Copy link
Contributor Author

Transparency works correctly now, both for pen, stamping and transparent sprites. Looks like the <is touching color [ ]>-block is broken though. I'll see if I can fix this.

@peabrainiac
Copy link
Contributor Author

peabrainiac commented Mar 3, 2019

I just tested it on scratch.mit.edu, and it looks like the <is touching color [ ]>-block is broken there too, so it's probably not a problem with my changes here. I think this should be ready for merging now @cwillisf or is there something I need to change first?

@thisandagain
Copy link
Contributor

@cwillisf Can you re-review?

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes... this looks great now!

@cwillisf
Copy link
Contributor

Testing notes: this project should look the same in both Scratch 2.0 and Scratch 3.0. It's based on project 277120576 linked above, but this version loads in the old editor as well.

pen-blend.sb2.zip

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

Successfully merging this pull request may close these issues.

3 participants