Blend Mode Plugin

Currently trying to get things to work...

current script...

Also trying to figure out wtf is canvas and how to use it vs show picture, where are the tutorials for it?

Also if the code is contained within the Pixi engine is there any way to reconnect whatever is disconnected that keeps Pixi from executing colorburn?

$gameScreen.showPicture(3, "stonesky", 0, 0, 0, 100, 100, 100, PIXI.blendModes.COLOR_BURN)[IMG]http://i.imgur.com/vxJetkF.jpg[/IMG]

Research Links:

1. An interesting thing someone else has done but think it is for a previous rpg maker not MV http://rpgmaker.net/forums/topics/11622/

2. Which version was this? http://himeworks.com/2014/11/basic-overview-of-blend-modes/

3. Also a video tutorial showing some script but not sure the version: www.youtube.com/watch?v=MvsAEPXeFVo
4. Could part of this code be cannibalized some how to create a fix: http://www.rpgmakervxace.net/topic/874-sai-rmxp-blending-options/
Pixi actually has a couple of blendmodes, but aside from the first few they don't seem to do anything (or i'm just using them the wrong way):

Code:
PIXI.blendModes = {    NORMAL:0,    ADD:1,    MULTIPLY:2,    SCREEN:3,    OVERLAY:4,    DARKEN:5,    LIGHTEN:6,    COLOR_DODGE:7,    COLOR_BURN:8,    HARD_LIGHT:9,    SOFT_LIGHT:10,    DIFFERENCE:11,    EXCLUSION:12,    HUE:13,    SATURATION:14,    COLOR:15,    LUMINOSITY:16};
I believe it is due to the platform - only the first two are guaranteed to work on all platforms, so the others aren't offered as options.
Very nice cause some of the others would fit the bill to give something very close to vivid light

if they follow the photoshop variants... do you have a link to the Pixi plugin or how to install it?
They only seem to work on canvas (and even then not always), according to these parts:

Spoiler
PIXI.WebGLRenderer.prototype.mapBlendModes = function(){ var gl = this.gl; if(!PIXI.blendModesWebGL) { PIXI.blendModesWebGL = []; PIXI.blendModesWebGL[PIXI.blendModes.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.ADD] = [gl.SRC_ALPHA, gl.DST_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.SCREEN] = [gl.SRC_ALPHA, gl.ONE]; PIXI.blendModesWebGL[PIXI.blendModes.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; PIXI.blendModesWebGL[PIXI.blendModes.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; }};
Spoiler
Code:
PIXI.CanvasRenderer.prototype.mapBlendModes = function(){    if(!PIXI.blendModesCanvas)    {        PIXI.blendModesCanvas = [];        if(PIXI.canUseNewCanvasBlendModes())        {            PIXI.blendModesCanvas[PIXI.blendModes.NORMAL]   = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.ADD]      = "lighter"; //IS THIS OK???            PIXI.blendModesCanvas[PIXI.blendModes.MULTIPLY] = "multiply";            PIXI.blendModesCanvas[PIXI.blendModes.SCREEN]   = "screen";            PIXI.blendModesCanvas[PIXI.blendModes.OVERLAY]  = "overlay";            PIXI.blendModesCanvas[PIXI.blendModes.DARKEN]   = "darken";            PIXI.blendModesCanvas[PIXI.blendModes.LIGHTEN]  = "lighten";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR_DODGE] = "color-dodge";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR_BURN] = "color-burn";            PIXI.blendModesCanvas[PIXI.blendModes.HARD_LIGHT] = "hard-light";            PIXI.blendModesCanvas[PIXI.blendModes.SOFT_LIGHT] = "soft-light";            PIXI.blendModesCanvas[PIXI.blendModes.DIFFERENCE] = "difference";            PIXI.blendModesCanvas[PIXI.blendModes.EXCLUSION] = "exclusion";            PIXI.blendModesCanvas[PIXI.blendModes.HUE]       = "hue";            PIXI.blendModesCanvas[PIXI.blendModes.SATURATION] = "saturation";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR]      = "color";            PIXI.blendModesCanvas[PIXI.blendModes.LUMINOSITY] = "luminosity";        }        else        {            // this means that the browser does not support the cool new blend modes in canvas "cough" ie "cough"            PIXI.blendModesCanvas[PIXI.blendModes.NORMAL]   = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.ADD]      = "lighter"; //IS THIS OK???            PIXI.blendModesCanvas[PIXI.blendModes.MULTIPLY] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.SCREEN]   = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.OVERLAY]  = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.DARKEN]   = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.LIGHTEN]  = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR_DODGE] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR_BURN] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.HARD_LIGHT] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.SOFT_LIGHT] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.DIFFERENCE] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.EXCLUSION] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.HUE]       = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.SATURATION] = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.COLOR]      = "source-over";            PIXI.blendModesCanvas[PIXI.blendModes.LUMINOSITY] = "source-over";        }    }};
do you have a link to the Pixi plugin or how to install it?
PIXI.js is the engine MV uses for rendering.
That's not a plugin - it's already there in the code. You just need a way of accessing it.


Maybe using a script call for the Show Picture command rather than using an event command, so you can pass a blend mode other than those offered by Show Picture. Or use Show Picture followed by a script call to adjust the blend mode on the picture just shown.
That's not a plugin - it's already there in the code. You just need a way of accessing it.

Maybe using a script call for the Show Picture command rather than using an event command, so you can pass a blend mode other than those offered by Show Picture. Or use Show Picture followed by a script call to adjust the blend mode on the picture just shown.
Kk, thank you. Any existing scripts out there specifically for this purpose, or would it be an easy script for someone to create? If so I need it.
You do not need an entire script to do a script call.


Just figure out what the parameters are, and use the Script event command to do it, instead of the Show Picture command.


If you can't / don't want to figure it out yourself, show us a screenshot of the Show Picture command with all the variables set, and we'll let you know what the Script call should be.
You are a bit limited here, since blendModes only work correctly on canvas mode. The solution would depend on how you want to deploy your game:


- Both canvas/WebGL: Either use a semitransparent overlay or dynamically use one of the other solutions (tricky).


- canvas: Semitransparent picture or blendMode.


- WebGL: Semitransparent picture or WebGL filter/shader (either applied to an overlay picture or to the scene as a whole).


If the game should only run locally (on Node.js), you can safely enforce WebGL.
Gotcha @ Lavra - Intended platform will be PC & Android ( not sure if that answers the deployment question or not.

@ Shaz - If you can write the script based off this...

"color burn" for the blend mode to go with show picture.

Spoiler
[IMG]http://i.imgur.com/J9jgdZL.jpg[/IMG]
You do not need an entire script to do a script call.

Just figure out what the parameters are, and use the Script event command to do it, instead of the Show Picture command.

If you can't / don't want to figure it out yourself, show us a screenshot of the Show Picture command with all the variables set, and we'll let you know what the Script call should be.
let me know if my above post gave you all the info you need.
The original post is updated based of the information discussed.
I am now currently seeking anyone willing to help me with this script request.

Thank you Shaz & Lavra for helping me understand what to ask for.
I was actually working on a plugin like this, but gave up because there simply seems to be no good way of making other blend modes work on various platforms (even on different Windows versions) without modifying the node webkit wrapper that runs the game once deployed. I might be wrong, but based on my quite thorough google-fu there just is no good way to make "normal" HTML5 WebGL blend modes other than additive to work reliably at all.

However it does seem that Pixi V3 has other blend modes. I haven't researched how they've worked them out; perhaps they're software based.
You are a bit limited here, since blendModes only work correctly on canvas mode. The solution would depend on how you want to deploy your game:

- Both canvas/WebGL: Either use a semitransparent overlay or dynamically use one of the other solutions (tricky).

- canvas: Semitransparent picture or blendMode.

- WebGL: Semitransparent picture or WebGL filter/shader (either applied to an overlay picture or to the scene as a whole).

If the game should only run locally (on Node.js), you can safely enforce WebGL.
@ Galenmereth - There is two options to this... webgl and canvas. I think we could do canvas.

Either way I would rather make a game with the design and look I like and have fewer platforms I can launch with

than have a game that lacks the look and style all together.

Without the complete look and feel it takes away my purpose for making the game in the first place.

So I would rather press on even knowing that I may not be able to release my game compatible with every device.
Cody Rauh, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you want to quote several people's posts, you can either use @name, or the MultiQuote button, to avoid posting several times in a row.


Here is the script command to show a picture using a blend mode other than normal or additive.

$gameScreen.showPicture(3, "Actor1_3", 0, 200, 200, 100, 100, 255, 8)The 8 can be replaced by PIXI.blendModes.COLOR_BURN if you prefer something more readable.
The above is the equivalent of this:

$gameScreen.showPicture(pictureId, "picture name", origin, x, y, scaleX, scaleY, opacity, blendMode)
However, I showed a picture at 3 locations on my screen, one using Normal blend mode via the Show Picture command, one using blend mode 8, and one using PIXI.blendModes.COLOR_BURN, and all three of them looked exactly the same on both my test play and in the browser. If you are going to target a specific platform that's different to those, it might be worth giving it a try.


If you want two pictures to be displayed over each other and for the top one to have the blend mode, isn't it possible to just do that in an image editing program and save the final product as a different picture, so you don't need to use MV's blend modes at all?
Cody Rauh, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

If you want to quote several people's posts, you can either use @name, or the MultiQuote button, to avoid posting several times in a row.

Here is the script command to show a picture using a blend mode other than normal or additive.

$gameScreen.showPicture(3, "Actor1_3", 0, 200, 200, 100, 100, 255, 8)The 8 can be replaced by PIXI.blendModes.COLOR_BURN if you prefer something more readable.The above is the equivalent of this:

$gameScreen.showPicture(pictureId, "picture name", origin, x, y, scaleX, scaleY, opacity, blendMode)However, I showed a picture at 3 locations on my screen, one using Normal blend mode via the Show Picture command, one using blend mode 8, and one using PIXI.blendModes.COLOR_BURN, and all three of them looked exactly the same on both my test play and in the browser. If you are going to target a specific platform that's different to those, it might be worth giving it a try.If you want two pictures to be displayed over each other and for the top one to have the blend mode, isn't it possible to just do that in an image editing program and save the final product as a different picture, so you don't need to use MV's blend modes at all?
Yay!!! My Hero! I have been so very frustrated on this issue... gonna try this out and tell you how it works.. and yes I found a result with colorburn which will work just fine.

I will let you know what happens!
Don't call me a hero - none of the above work for me. If you can't get them working either, then I don't know if it can be done.
This is the result I got 🙁

Spoiler
[IMG]http://i.imgur.com/f0XuDO9.jpg[/IMG]
This is how I tried to implement it.
Spoiler
[IMG]http://i.imgur.com/zXp0RMq.jpg[/IMG]
My image is sized to the same exact surface area of the game window, Did I do something wrong?
So did some tinkering...

In your script you had transparency 255 I adjusted to 100 which fixed the opaque.
In scale you had 200x200 so adjusted that to 100x100. Now all of that is working.

I have tried 8 and color burn as you suggested both still appear as normal blend.

With the script in place now and everything set up need to find a way to get it to actual use color burn.

One thing I was curious about we are using showpicture... another user had mentioned canvas.. how do we do canvas, what is it?

and is there any tutorials on it?

Spoiler
[IMG]http://i.imgur.com/RF2fxL4.jpg[/IMG]
Original post updated with all the latest information, distilled and condensed into something more coherent for those coming into the thread fresh.

Original thread: https://forums.rpgmakerweb.com/threads/blend-mode-plugin.53857/