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
How do you import this module? #11
Comments
For any of my pixi plugins
Just remember that its fr pixi-v4, i havent convert it to v5 yet |
Which features from pixi-picture do you want to use? |
Just the blendmode overlay in pixi v5 webgl :-) |
ok, I'll try to update it this weekend or next week. I needed someone to poke me :) Last week I updated https://github.com/pixijs/pixi-compressed-textures/ |
For some limited cases you can do it yourself. For example, if you just want to blend one image on top of another. If there are more images then it'll be a problem. |
I actually just need to have an image have it's blendmode set to overlay layered on top of a solid color below it and save the results once. I don't even need it to be dynamic as I'm gonna cache it as a bitmap once it's outputted once. Any other workaround that may be able to render the overlay effect? Thanks for your pointers. |
oh, then there's a easier way. Here's the frag part that you can use: https://github.com/pixijs/pixi-picture/blob/master/src/OverlayShader.ts#L14 Put it in https://pixijs.io/examples/#/filters-advanced/custom.js (here's its frag: https://pixijs.io/examples/examples/assets/pixi-filters/shader.frag ) Or in https://pixijs.io/examples/#/mesh/triangle-textured.js . Its a good way to learn how shaders work, but it requires some time and attention :) |
Thanks for the pointers, I tried to port it to v5 by extrapolating some of the SPRITE_UNIFORM code from the dist build. I ended up with:
However when running it I get this error:
|
put it in codepen, jsfiddle or in pixi-playground please, I'll edit it :) |
Sure thing, thanks! https://www.pixiplayground.com/#/edit/wm_vv6gp0ELsSD4fAEWVy |
you need two images for that overlay. bunny over something, right? where's that something? |
Actually just a solid color is what I'm looking for it doesn't need to blend with another image. So a solid color image would work - which I guess would be best to just do right in the shader instead of another image? |
OH, RIGHT! I forgot that. OK, one demo, coming right up. |
Here: https://www.pixiplayground.com/#/edit/wm_vv6gp0ELsSD4fAEWVy So, i've got targetColor through uniform - that's our backdrop! Cb stands for "color of backdrop", target color. Formulae is taken from css blending documentation, https://www.w3.org/TR/compositing-1/#blendingoverlay If you modify the color that is passed to uniforms - you'll see that filter takes rectangular area on screen. You might want to modify how alpha is handled, for example always preserve source alpha instead of setting it to 1 because I'm happy that you've chosen that way, because now we'll have one more person who knows how to do that stuff. |
I've put the post here: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#single-color-blending |
Thanks for the pointers, I ended up using the original overlay shader code (slightly modified for v5): https://www.pixiplayground.com/#/edit/4_8~zBItAuarz_ntitt59 - this now replicates proper overlay shader similar to chrome's built in in css. |
Oh, wait, i switched Cb and Cs because i thought there's a mistake.. and you switched it back , good job :) Now we both know which variant is correct. |
Any update on getting pixi-picture ready for v5? Thanks in advance! |
FYI With PixiJS 6, it's a simple import: // ESM
import { Sprite, BlendFilter } from '@pixi/picture';
// Require
const { Sprite, BlendFilter } = require('@pixi/picture');
// IIFE
PIXI.picture.Sprite, PIXI.picture.BlendFilter |
Results in:
pixi-picture.js:258 Uncaught ReferenceError: PIXI is not defined
at pixi-picture.js:258
at Object../node_modules/pixi-picture/dist/pixi-picture.js (pixi-picture.js:260)
The text was updated successfully, but these errors were encountered: