Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Suggestion] Windowing
#1
Hi, I have no idea if it is already implemented, but in the case it isn't, I would suggest Windowing
It is used in quite a lot of Super Nintendo games, such as Super Mario World for the keyhole effect, or Super Metroid with the X-Ray glasses.
You also have this video that makes a pretty unique use of this technique :

I also found a video that explains the effect pretty well if you are interested :
https://youtu.be/uRjf8ZP6rs8?t=243

I have no idea if that can drain performances, but I think the basic principle is you don't display a layer when the pixel you want to draw is outside of a 2 X-values interval of the screen, and you can make more complex shapes (such as a circle for example) by changing those X values between scanlines.

What do you think about this suggestion?
Reply
#2
Hi!

Thanks for the suggestion and related documentation, this is quite interesting :-)

Tilengine implements a feature that, albeit not as complex as SNES windowing feature, is quite similar and can do the same trick in most scenarios. This is layer clipping:

https://www.tilengine.org/doc/md_layers....totoc_md37

The idea is simple: each background layer can have a clip region, defined by a rectangle, that masks out what lies outside the rectangle. Playing with the clipping rectangles of two or more layers using raster effects to tweak their shape can lead to very interesting special effects.

The explanation about how windowing works in SNES is very well explained. The SNES has a limited number of layers, so having the ability to combine masking with constant color blending (transparency) within a single layer is important. In Tilengine you can have more layers, and you can also clip and do color math. So, despite having somewhat different implementation, I think I could do all the shown effects with Tilengine without implementing any new feature. Some effects are more difficult than others, however.

What do you think? What effect do you have in mind?
Reply
#3
(01-19-2023, 04:16 AM)megamarc Wrote: Hi!

Thanks for the suggestion and related documentation, this is quite interesting :-)

Tilengine implements a feature that, albeit not as complex as SNES windowing feature, is quite similar and can do the same trick in most scenarios. This is layer clipping:

https://www.tilengine.org/doc/md_layers....totoc_md37

The idea is simple: each background layer can have a clip region, defined by a rectangle, that masks out what lies outside the rectangle. Playing with the clipping rectangles of two or more layers using raster effects to tweak their shape can lead to very interesting special effects.

The explanation about how windowing works in SNES is very well explained. The SNES has a limited number of layers, so having the ability to combine masking with constant color blending (transparency) within a single layer is important. In Tilengine you can have more layers, and you can also clip and do color math. So, despite having somewhat different implementation, I think I could do all the shown effects with Tilengine without implementing any new feature. Some effects are more difficult than others, however.

What do you think? What effect do you have in mind?

I was thinking to the effects I mentionned.

About transparency, I still have a question. Can Tilengine do that kind of blending effects without having to change the palette?
https://imgur.com/9oaWrY5
Reply
#4
Hi!

The effects you mention could be implemented in Tilengine right now, combining layer clipping and layer blending. The ability of the SNES to clip the portion of the layer that lies outside of a pair of x1 - x2 values is what's implemented in tilengine's clipping.

However the SNES can do much more, after watching the video you posted and reading this excellent documentation:
http://emudev.de/q00-snes/windows-bg-pri...-pipeline/

1. Inverse masking: draw what lies outside the x1 - x2 values and skip the inner section
2. Do color math (transparency) with the masked out portions and a fixed color
3. Build clipping masks composed of two rectangles and do bitwise math between them

Tilengine is not an SNES emulator. However I always seek for inspiration on classic systems to implement new features, and I think I could implement points 1 and 2 in Tilengine with relative ease without compromising performance. Point 3 will be left out for now.

Regarding the question about how to do the color trick without changing the palettes, you can do it with two layers in Tilengine:

1. Background layer without priority holds the basic background with standard palette
2. Foreground layer with priority enabled holds a vertical color gradient between black and half intensity red, and enable blending mode BLEND_ADD.

Additive blending of the foreground layer will cause the underlying elements to get progressively lighted with a red tint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)