YesNoOk
avatar

Mask or Window effect (workaround) (Read 1765 times)

Started by ink, June 16, 2018, 06:31:27 am
Share this topic:

ink

Mask or Window effect (workaround)
New #1  June 16, 2018, 06:31:27 am
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
The best example I can think of for this is Arakune's red effect. (BlazeBlue)

This is my attempt: https://imgur.com/a/Q5JlsYG (Shin Gouki's legs)

Mirror match support: https://imgur.com/a/PKV7YfY
The blinking is caused by changing SprPriority. This wouldn't be a problem in a character made for this effect.

The character I was testing it on.
https://www.dropbox.com/s/verwi6u3ftj0w8c/ShinGouki.zip?dl=0

I got the idea from an old post and it's done similar to how Byakko described.
Same way as the stage stuff. One sprite with additive transparency on top of the character, one sprite with negative transparency behind the character to cancel it out everywhere outside of the character's sprite.

The only issue with the "one sprite on top, one sprite behind" technique is that anyone can walk up to your character and have the flame appear on top of them. You might put your flames + character on one extremity of the sprpriority range and hope that no one uses the same range, or grabs you and forces you into another sprpriority range (a variation of the classic "attachment coded as helper, in a custom gethit animation" issue). You also shouldn't use him in a mirror match. ... That's the part that's going to be a problem.

There are some problems with this. As Byakko said P2 is also effected, though you can't see it very much here. The only solution to fix this is to have the character's SprPriority set to be further back than other characters or use a smaller animation that's bound to the character.



NOTE: The effect must cover the whole screen. Even if its just a solid black background. No effects should be applied in the air file. There are two animations needed, the effect and one that's solid black.

Statedef -2
Code:
;=================================================================================
;Inktrebuchet's Mask / Window effect.
;=================================================================================
[state mask inverted]
type = helper
trigger1 = numhelper(6546476) = 0
ID = 6546476
stateno = 6546476
name = "window/mask"
pos = 0,-10
ownpal = 1

[state mask inverted]
type = helper
trigger1 = numhelper(6546478) = 0
ID = 6546478
stateno = 6546478
name = "window/mask"
pos = 0,-10
ownpal = 1

[state mask color correction]
type = helper
trigger1 = numhelper(6546479) = 0
ID = 6546479
stateno = 6546479
name = "window/mask"
pos = 0,-10
ownpal = 1

[State 6546479, 3] ; lighten character
type = PalFX
trigger1 = 1
time = 1
add = helper(6546476),var(0) ,helper(6546476),var(0) ,helper(6546476),var(0)

;Used in testing to set character back.
[State charPriority]
type = SprPriority
trigger1 = 1
value = helper(6546476),var(1) - 3
;=================================================================================

CNS
Code:

;=================================================================================
;Inktrebuchet's Mask / Window effect.
;=================================================================================
[statedef 6546476] ;regular
type = A
physics = N
movetype = H
anim = 45245 ;effect full screen (black background)
 
;======================================================================================================
; config
;======================================================================================================
[State n]
type = VarSet
trigger1 = 1
v = 0
;#####################################################################################################################
;## change the value below to adjust effect.
;## character palettes will need to be adjusted (lightened) to work with this effect.
;## This value is saved to a var to ensure all values match throughout Mack/Window code.
;##
value = 64

;======================================================================================================

[State n] ; used vs other mask / window characters.
type = VarSet
trigger1 = 1
v = 1
value = cond(teamside = 1, 0, 5)

[State 6546476, 0]
type = AssertSpecial
trigger1 = 1
flag = noshadow
 
[State 6546476, 1] ;effect in front of character
type = SprPriority
trigger1 = 1
value = var(1) - 2
 
[State 6546476, 2]
type = Trans
trigger1 = 1
trans = addalpha
alpha = var(0), 256

;--------------------------------------
 
[statedef 6546478] ; inverted
type = S
physics = N
anim = 45245 ;effect full screen (black background)
 
[State 6546478, 0]
type = AssertSpecial
trigger1 = 1
flag = noshadow
 
[State 6546478, 1] ;effect behind character
type = SprPriority
trigger1 = numhelper(6546476) = 1
value = helper(6546476),var(1) - 4
 
[State 6546478, 2]
type = Trans
trigger1 = numhelper(6546476) = 1
trans = addalpha
alpha = helper(6546476),var(0) , 255
 
[State 6546478, 3] ; invert effect
type = PalFX
trigger1 = 1
time = 1
invertall = 1

;--------------------------------------
 
[statedef 6546479] ; correct background color
type = S
physics = N
anim = 45246 ; solid black(full screen)
 
[State 6546479, 0]
type = AssertSpecial
trigger1 = 1
flag = noshadow
 
[State 6546479, 1] ;in front of effect and character
type = SprPriority
trigger1 = 1
value = helper(6546476),var(1) - 1
 
[State 6546479, 2]
type = Trans
trigger1 = 1
trans = sub

[State 6546479, 3] ; lighten
type = PalFX
trigger1 = numhelper(6546476) = 1
time = 1
add = helper(6546476),var(0) ,helper(6546476),var(0) ,helper(6546476),var(0)

;================================================================================

Last Edit: June 19, 2018, 01:42:11 am by ink
Re: Mask or Window effect (workaround)
#2  June 16, 2018, 12:59:12 pm
  • ****
  • play more SNK games
  • I FUCKING LOVE PLATINUM!
    • South Africa
    • Skype - websta786
    • www.trinitymugen.net/
well now, thats certainly something. im really interested to see how you made it happen

ink

Re: Mask or Window effect (workaround)
#3  June 16, 2018, 05:31:22 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
First post updated with code. Let me know if you have any questions or if the code can be improved.
Re: Mask or Window effect (workaround)
#4  June 16, 2018, 05:45:30 pm
  • ******
  • Loyal to the Game
  • I'M SHADYYYYYYYYYY
    • USA
    • http://jesuszilla.trinitymugen.net/
I think you completely misunderstood Byakko’s post.

What he meant was have one layer use subtractive transparency (the bottom) and the top use regular additive.

What you do does nothing but add, which will never work.

Even Byakko’s suggestion wouldn’t be perfect. Say you have a background with a red of 64. Your effect has a red of 72. When you subtract, you’ll get 0 because colors can’t be negative values. So when you add it back, you’ll get 72 rather than 64.

ink

Re: Mask or Window effect (workaround)
#5  June 16, 2018, 05:56:44 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
I didn’t misunderstand. I tried subtractive and it didn’t come close to working. This is as close I could get with mugen and it’s not perfect. You can see the results in the video I posted.

Do you think there is a better way?
Re: Mask or Window effect (workaround)
#6  June 16, 2018, 06:00:45 pm
  • ******
  • Loyal to the Game
  • I'M SHADYYYYYYYYYY
    • USA
    • http://jesuszilla.trinitymugen.net/
You got it working in one case, with a red effect, on a stage with mostly blue. Of course those values are going to behave nicely in a RGB color space. Try it on a background with more color variation and it won’t work as you expect, especially since as I said, you’re always adding color and never subtracting (though I also mentioned why subtracting isn’t going to exactly work, either).

ink

Re: Mask or Window effect (workaround)
#7  June 16, 2018, 06:04:30 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
I did try this on other stages... I’ll post some other videos later. The main problem is that it causes the backgrounds to be lighter, that is all.

Also, the effect can be any color.
Re: Mask or Window effect (workaround)
#8  June 16, 2018, 06:06:06 pm
  • ******
  • Loyal to the Game
  • I'M SHADYYYYYYYYYY
    • USA
    • http://jesuszilla.trinitymugen.net/
Because you’re adding color, which in 8-bit RGB, goes from 0 (darkest) to 255 (brightest) for each component. It’s basic addition on the individual components.

ink

Re: Mask or Window effect (workaround)
#9  June 16, 2018, 06:16:02 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
There is no way to make it perfect. Do you think there is a way to improve it?
Last Edit: June 18, 2018, 03:47:11 pm by ink

ink

Re: Mask or Window effect (workaround)
New #10  June 18, 2018, 03:46:55 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
Updated my first post with improvements. A lot of the color problems are solved now, I don't see how this could be improved any more than this. Suggestions are welcomed.

video of working effect. The blinking is caused by changing SprPriority. This wouldn't be a problem in a character made for this effect.
https://imgur.com/a/Q5JlsYG

The character I was testing it on.
https://www.dropbox.com/s/verwi6u3ftj0w8c/ShinGouki.zip?dl=0

*This could also be simplified some by using explods.

-Update-
Now supports mirror matches!
https://imgur.com/a/PKV7YfY


I'm gonna sneak this one in too. Same idea but a little more advanced.
https://imgur.com/a/dcdJJot


Last Edit: July 17, 2018, 10:44:24 pm by ink