Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP] Custom sprite blend type?

Wichu

Member

Is there any way to make another blend type for sprites on RMXP? (The blend types are Normal, Addition, and Subtraction).

I want to know how to add a Negation blend type for use with sprites, if it's possible.

If you don't know what I mean, the Addition blend type adds the RGB of the colour of each pixel on a sprite to the RGB of the colour of the pixel underneath, whil Subtraction takes it away. Negation would give the difference between the RGB values of each pixel on the sprite and the background.

Again, does anyone know if it's possible, and if so, how to go about doing it?
 
I could do it, if I knew 100% what I was suppose to be doing. So lets say we have four pixels, 2 rows and 2 columns. With the values as demonstrated below.
Code:
|-----------|-----------|
| 10,150,  0| 65, 50,155|
|-----------|-----------|
|200, 75,100|165,150, 55|
|-----------|-----------|

So your top row values would be:
Code:
|190, 75,100|100,100,100|

Is that what you are talking about? And I am guessing bottom row takes it values from the top?

Or am I just really confused?
 

Wichu

Member

Like that, but the top row would be a separate sprite, overlapping the bottom row (same X and Y).
If you have Photoshop or a similar program, you'll know what I mean. If each sprite is a separate layer on Photoshop, you can change their blending mode to change the colours. For example, Addition would make it appear semi-transparent and lighter, while a Subtraction layer would appear darker. This is already possible in RMXP, using sprite.blend_type=1 or sprite.blend_type=2.
Negation is hard to describe, but a pure white graphic on Negation layer would reverse the colours of graphics on the layers below. A pure black graphic would have no effect.
Substitute layers for different values of the sprite's z-value: that's what I'm trying to get at.

Sorry if I confused you...
 
I am trying to think of a way to do this. The problem is reading the sprites below you, there really is no perfect method to do this. But, by knowing the original bitmap pixel values, and what they will be after the blending, you should be able to figure out the pixel below it. I'll mess around in a bit.
 

Zura

Member

Hi! Can you do this, when you know the formula for the new blend type?
Like, C=1-(1-A)*(1-B) (C=Composite, A=Foreground-Layer, B=Background-Layer, 1=0% transparency, 100% opaque or in tone value 255)

I really want something like this for my game too..
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top