Composite Blend on Genesis core on all console cores?

dmckean
Posts: 84
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 51 times
Been thanked: 18 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by dmckean »

Kitrinx wrote: Mon May 10, 2021 12:33 pm
dmckean wrote: Sun May 09, 2021 5:39 pm
All the composite dithering in backgrounds in Little Samson is the only one I can think of off the top of my head. I'm sure there's probably others though.
I was unable to locate the part you are talking about.

PIC-2021_05_10_08_28_22.png
PIC-2021_05_10_08_27_32.png
If you scroll down to the NES section on this page and look at the Sunsoft section. There's two really good examples of the use of composite dithering on the NES. Move your mouse over the image to switch to composite.

https://www.chrismcovell.com/gotRGB/rgb_compare.html
User avatar
FaSMaN
Posts: 8
Joined: Mon Jun 15, 2020 4:52 pm
Been thanked: 1 time

Re: Composite Blend on Genesis core on all console cores?

Unread post by FaSMaN »

I have been lurking for a while and just stick my head in from time to time to see if there is any future plans for composite blend on more cores, but each time I look into it I can see there is new threads asking for the feature but it allways boils down to the same opinionated reasons as to why it shouldnt exist even if there is ample enough proof posted and linked examples.

So I did a quick search, 111 post mentioning composite blend, more than a dozen people asking for it, so its clear that the users really want composite blend at this stage? Yes it might not suite everyone tastes but it is a feature people clearly want?

Sometimes, you just have to put your opinions aside.

search.php?keywords=Composite+Blend
Just a small random youtuber from a South Africa.
dshadoff
Posts: 406
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 9 times
Been thanked: 91 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by dshadoff »

Not so easy in fact.
Let's assume that a developer wants to implement. What does he implement ? How does it get tested ? Are people going to be satisfied ?

Clearly there are many people who are not satisfied with the filters... but what mathematical transform is available to the core which cannot be done in a filter ?

This is not just a matter of whether it should exist or not - but rather, one of how to accomplish something which defies definition
dmckean
Posts: 84
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 51 times
Been thanked: 18 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by dmckean »

FaSMaN wrote: Mon May 10, 2021 7:10 pm I have been lurking for a while and just stick my head in from time to time to see if there is any future plans for composite blend on more cores, but each time I look into it I can see there is new threads asking for the feature but it allways boils down to the same opinionated reasons as to why it shouldnt exist even if there is ample enough proof posted and linked examples.

So I did a quick search, 111 post mentioning composite blend, more than a dozen people asking for it, so its clear that the users really want composite blend at this stage? Yes it might not suite everyone tastes but it is a feature people clearly want?

Sometimes, you just have to put your opinions aside.

search.php?keywords=Composite+Blend
The hesitancy from developers seems to come from the current composite blend implementation on the Genesis and 7800 cores being a hack that works to create transparencies but doesn't artifact in a way that's true to way real composite video looks. I think there's also some hope that someone will tackle the project of writing a composite video encoder for MiSTer so that real composite video could be output directly.
User avatar
Threepwood
Posts: 124
Joined: Mon May 25, 2020 9:14 am
Has thanked: 4 times
Been thanked: 18 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by Threepwood »

dshadoff wrote: Mon May 10, 2021 7:40 pmWhat does he implement ? How does it get tested ? Are people going to be satisfied ? [...] This is not just a matter of whether it should exist or not - but rather, one of how to accomplish something which defies definition
The examples in the links provided should serve as a good enough target vector and considering that three independent threads popped up over the months, praising the current implementation and asking for it to be made available in all cores that used CRT-systems, suggests that you all did a great job so far :)
RegalCutlass
Posts: 2
Joined: Tue May 11, 2021 1:28 am

Re: Composite Blend on Genesis core on all console cores?

Unread post by RegalCutlass »

Rather than making the whole image blurry with a composite filter, I'd love selective dither blending like the Mega SG. It blends parts of the image that have a checkerboard pattern in a very similar way as the Genesis core's composite blending while leaving the rest of the image sharp. Sonic 3D Blast is my favorite use case, since it uses dithering for shadows and parts of the background, but also has lots of really clean straight lines and large areas of one flat solid color. I was hoping the "Adaptive" option would achieve that effect but it doesn't seem to do anything.

Here's Green Grove Zone:

No filters.
IMG_20191217_195258.jpg
IMG_20191217_195258.jpg (4.52 MiB) Viewed 3587 times

With the Mega SG's dither blending.
IMG_20191217_195338.jpg
IMG_20191217_195338.jpg (3.45 MiB) Viewed 3587 times

Dither blending + scanlines (my preferred look).
IMG_20191217_195420.jpg
IMG_20191217_195420.jpg (4.79 MiB) Viewed 3587 times

Here's the start menu:

No dithering.
IMG_20191217_194036.jpg
IMG_20191217_194036.jpg (4.72 MiB) Viewed 3587 times

With dither blending.
IMG_20191217_194146.jpg
IMG_20191217_194146.jpg (5.1 MiB) Viewed 3587 times

Dither blending + scanlines (sorry for the aliasing, it's a bad cell phone photo).
IMG_20191217_194727.jpg
IMG_20191217_194727.jpg (5.18 MiB) Viewed 3587 times

Finally, here's the infamous waterfalls from Green Hill Zone in Sonic 1:

No dithering.
IMG_20191217_201210.jpg
IMG_20191217_201210.jpg (3.64 MiB) Viewed 3587 times

With dither blending.
IMG_20191217_201240.jpg
IMG_20191217_201240.jpg (3.11 MiB) Viewed 3587 times

Dither blending + scanlines.
IMG_20191217_201311.jpg
IMG_20191217_201311.jpg (3.95 MiB) Viewed 3587 times

This feature is literally the only reason I still have my Mega SG plugged in. It just seems like a shame to have to smear the whole image just to blend specific parts of it.
User avatar
Kitrinx
Posts: 104
Joined: Sat May 23, 2020 2:14 am
Location: NYC
Been thanked: 66 times
Contact:

Re: Composite Blend on Genesis core on all console cores?

Unread post by Kitrinx »

My understanding is that the one on MegaSG works pretty poorly most of the time. MiSTer also has an adaptive composite blend feature in the genesis core.
RegalCutlass
Posts: 2
Joined: Tue May 11, 2021 1:28 am

Re: Composite Blend on Genesis core on all console cores?

Unread post by RegalCutlass »

How so? In my experience it generally leaves any areas without checkerboarding alone.

I tried turning on the adaptive blend in the Genesis core but it didn't seem to make a difference, even in games like 3D Blast where the SG's dither blending would be obvious. If nothing else I'd love to understand what I'm doing wrong. Does it require some configuration? Is there a filter or video setting that prevents it from working?
User avatar
barfood
Posts: 59
Joined: Thu Jun 18, 2020 6:55 pm
Has thanked: 44 times
Been thanked: 10 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by barfood »

RegalCutlass wrote: Tue May 11, 2021 11:00 pm How so? In my experience it generally leaves any areas without checkerboarding alone.

I tried turning on the adaptive blend in the Genesis core but it didn't seem to make a difference, even in games like 3D Blast where the SG's dither blending would be obvious. If nothing else I'd love to understand what I'm doing wrong. Does it require some configuration? Is there a filter or video setting that prevents it from working?
These questions are great, but they are sort of derailing the main topic of this thread, which is about applying a composite filter (not even adaptative) to cores -other than- the Genesis.

Personally I am also interested in having a "general purpose composite blending" feature on MiSTer, so I'd really like to be able to get to the bottom of this specific issue first. :)

==================

For my 2 cents, the composite blending on the Genesis feels like a hack, but it's certainly better than no option at all. When I'm in a rush and I just want to rinse my eyes on my LCD screen, it's fun to switch back and forth between enabling and disabling the blending.

If this use case is not really in the spirit of the MiSTer, then fair, I'll be happy to stay with our current solution (I have a CRT in storage that I can take out whenever I want a true CRT look in component (though that still looks way sharper than og composite...)). However I think it's worth pointing out, because it really is fun to switch back and forth for comparisons.
kalach.x
Posts: 43
Joined: Thu Dec 02, 2021 3:12 pm
Has thanked: 13 times
Been thanked: 17 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by kalach.x »

RegalCutlass wrote: Tue May 11, 2021 2:08 am Rather than making the whole image blurry with a composite filter, I'd love selective dither blending like the Mega SG. It blends parts of the image that have a checkerboard pattern in a very similar way as the Genesis core's composite blending while leaving the rest of the image sharp. Sonic 3D Blast is my favorite use case, since it uses dithering for shadows and parts of the background, but also has lots of really clean straight lines and large areas of one flat solid color. I was hoping the "Adaptive" option would achieve that effect but it doesn't seem to do anything.
You will have this feature soon enough on Mister too.
I took these today when testing my changes
https://imgur.com/a/wdkBbLl

I am checking Sonic 3D Blast now and result seems to be pixel per pixel identical. No wonder because that was such obvious idea observing how Genesis graphics look. More photos https://imgur.com/a/khGT6je
Only last photo is from LCD, rest from CRT and my camera doesn't focus all that great on CRT. Probably better to take shots of LCD with scanlines :lol:

While at it I also fixed bug in Adaptive blend (for transparent objects) which caused some edges of solid objects to blur. Existing adaptive blending is necessary because this new/old method of removing dithering doesn't handle transparent meshes very well but working together result are at places truly amazing. I also implemented anti-HUD-blur of sorts. It needs some tweaking and testing in more games to check what is the best condition in various popular and less popular games to choose. Currently it re-enables bright gray dithering but it fixes Sonic HUD nicely and especially HUDs in Castlevania and point number that appears when you pick up gold. Will probably go with pure white, pure red, green, etc. vivid colors as these are less likely to be used for dithering except maybe one game, Wolfenstein 3D.

For now I need to make proper release or at least beta release and not debug release . Then I will start reading how this pull request system work as I never contributed to any open source project before :oops:

ps. My Genesis github page https://github.com/kalachx/Genesis_MiSTer_FM_Overdrive
kalach.x
Posts: 43
Joined: Thu Dec 02, 2021 3:12 pm
Has thanked: 13 times
Been thanked: 17 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by kalach.x »

viral-video-blendtec-blenders.jpg
viral-video-blendtec-blenders.jpg (89.71 KiB) Viewed 551 times

YES IT WILL!

Core in this post attachment. It is let's say beta version.
World is not ready to see this code and it will never be so I need to first refactor it before I push it to github :lol:

What you will find in this Genesis version of core is "smart blend" function that:
- add pattern based adaptive "smart blend"-ing with two patterns that cover most dithering patterns used by games
- smart blending has HUD filter option to fix blurring on HUDs and blending on elements in games which should not be smoothed out
- fixed Adaptive blending (now called as "Transparency" under Smart Blend) which had bug that blended left edges of objects which it shouldn't even attempt to blend (BTW. It was the very reason I didn't even use this option!)
- (from previous releases) FM Overdrive with high precision (twice as many bits!) YM2612/YM3438 and additional heavy metal sounding presets and options
- (from previous releases) Additional color palettes - Default and Raw RGB
- (from previous releases) CPU Turbo renamed as Blast Processing and put as the first option for convenience as most useful option which is not set-and-forget kind

Since last post most of the time I spent on finding the right HUD filter. This is something I will spend most of my time improving moving forward also :) Yesterday I came up with the idea to add another pattern and it just worked and worked beautifully at that. Now almost all gradients now look uniform and consistent. At this point it seems (at least from photos made by user RegalCutlass) my 'selective dither blending' is more advanced than what Mega SG provides :lol: Especially with ability to filter/fix HUD's 8-)

There are many ways in which this form of blending can be improved and regarding that I have a request for all of you: please post cases of games with issues in transparent objects/meshes. My method relies on previous 'adaptive' composite blend for transparent objects as it cannot (in current form at least) figure out it by itself it should blend them and this can produce artifacts. I will need some examples of games where issues can be seen to figure best way to blend them and/or if any potential fixes for adaptive blend are working. Also it would be appreciated if this was something seen early on in the game ;)

And other than that just enjoy. Your feedback is much appreciated :)
Attachments
Genesis-FMO2.1.rbf
Genesis core with FM Overdrive and Smart Blend
(3.72 MiB) Downloaded 14 times
Sigismond0
Posts: 181
Joined: Mon May 25, 2020 2:21 am
Has thanked: 1 time
Been thanked: 19 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by Sigismond0 »

For anyone that just wants something that has a softer image overall, the CRT Simulation - Composite filters do a great job. Transparent waterfalls in Sonic and everything. Doesn't help anyone that wants to keep razor sharp pixels but also blended dithering. But you can use it on all cores, and it might satisfy a lot of peoples' needs. If the main topic of the thread is non-adaptive composite blending for all consoles, that's pretty much already there with the filter.
User avatar
darksakul
Posts: 276
Joined: Mon May 25, 2020 4:34 pm
Has thanked: 313 times
Been thanked: 59 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by darksakul »

aberu wrote: Fri Dec 04, 2020 5:53 pm The upcoming PS1 core (still in somewhat early development where more people are getting involved, after 2 years of amazing hard work by Laxer3a) will likely have a DIP switch for dithering on and off (it's already incorporated in the current code, which isn't natively running completely on the MiSTer yet, but many components of it are currently being ported over), I'm not aware of plans for composite yet though.
For the PS1 Core I rather have the ability to lose the Dithering effects than to incorporate Composite Blend
With the way the PS1 textures are, I don't think I would lose anything with the lack of Dithering.
It is my great regret that we live in an age that is proud of machines that think and suspicious of people who try to.
kalach.x
Posts: 43
Joined: Thu Dec 02, 2021 3:12 pm
Has thanked: 13 times
Been thanked: 17 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by kalach.x »

darksakul wrote: Thu Jan 13, 2022 10:05 pm For the PS1 Core I rather have the ability to lose the Dithering effects than to incorporate Composite Blend
With the way the PS1 textures are, I don't think I would lose anything with the lack of Dithering.
In videos about disabling dithering on PSX almost all games look much worse and some look completely broken.
The only use case I see for such feature are 2d games because 3d games even if textures have low color bitdepth polygons have colors assigned to each vertex and there are supposed to be smooth color gradients which blend with texture data. Also alpha blending effect will suffer from lost of color bitdepth, even if it is reconstructed by dithering.

Best way to avoid dithering and still having correct colors would be to widen video chip internals and make it render at 24/32-bit. For now PSX core is missing sound and making chip bigger would not make any sense. But maybe if there is space left it could be done. Emulators can already do it so it wouldn't even be reinventing any wheel to be smoother :)

On the other hand maybe some clever filter can be used to smooth PSX dithering patterns without affecting overall sharpness. Something like later 3dfx Voodoo cards blended dithering patterns to hide them. That would be probably best cheap solution that should fit even if Cyclone V is full for the brim after PSX core is completed.
User avatar
aberu
Posts: 710
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 154 times
Been thanked: 199 times
Contact:

Re: Composite Blend on Genesis core on all console cores?

Unread post by aberu »

darksakul wrote: Thu Jan 13, 2022 10:05 pm
aberu wrote: Fri Dec 04, 2020 5:53 pm The upcoming PS1 core (still in somewhat early development where more people are getting involved, after 2 years of amazing hard work by Laxer3a) will likely have a DIP switch for dithering on and off (it's already incorporated in the current code, which isn't natively running completely on the MiSTer yet, but many components of it are currently being ported over), I'm not aware of plans for composite yet though.
For the PS1 Core I rather have the ability to lose the Dithering effects than to incorporate Composite Blend
With the way the PS1 textures are, I don't think I would lose anything with the lack of Dithering.
Not so fast. There's major banding in a lot of PSX games if you get rid of dithering. Motor Toon Grand Prix is a good example, the banding is kind of atrocious.

Dithering:
PSX_Dith_MotorSM-dith.png
PSX_Dith_MotorSM-dith.png (13.42 KiB) Viewed 664 times
No Dithering:
PSX_Dith_MotorSM-none.png
PSX_Dith_MotorSM-none.png (11.02 KiB) Viewed 664 times
Valkyrie profile however looks great without dithering... sometimes, but in some game modes it looks pretty bad. It's kind of difficult to tell which will look better. Final Fantasy VII personally has too strong banding to turn off dithering. The menus get a really strong banding effect with it turned off, even though there isn't the weird dot-screen effect. It's kinda strange.
kalach.x
Posts: 43
Joined: Thu Dec 02, 2021 3:12 pm
Has thanked: 13 times
Been thanked: 17 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by kalach.x »

Disabling dithering produce banding. Just look at surface of metal crates.

No dithering:
no_dithering.jpg
no_dithering.jpg (1.24 MiB) Viewed 614 times
Dithering gives proper gradients (and in some case colors in general) which was also intended look of the game.

Dithering:
dithering.jpg
dithering.jpg (1.09 MiB) Viewed 614 times
But we have power of field programmable logic array gods behind us so why not have both? Good gradation and no dithering patterns...

Smart blend:
Example of PSX smart blend algorithm
Example of PSX smart blend algorithm
smart_blend.jpg (1.24 MiB) Viewed 614 times
Core in attachment.

Took me only few builds to make it. Actually I downloaded PSX core only today after reading Abreu comment because patterns from his shot were very similar to what my code could detect. I did end up however using different algorithm, one which I developed fort the kind of dithering system like PSX would use and to my both surprise and no surprise it works perfectly. At least as far as I can tell. Kinda has this 3dfx-esque vibe to it... that is why I mean by perfect :lol:

EDIT://
It doesn't handle transparent polygons as well as it imho should for perfection.
It can be easily fixed by providing information given pixel was drawing transparent object, just like is needed in Genesis case and then effect will be complete.

EDIT2://
Debug view
Pixels which are NOT blended are colored red. Everything else is like composite blend.
debug_view.jpg
debug_view.jpg (1.46 MiB) Viewed 602 times
EDIT3://
And in attachment PSX core build with alpha blending support
PSX_smart_blend_alpha.rbf
PSX with smart blend + alpha blending support made from official commit 35e3388
(3.5 MiB) Downloaded 6 times
I only tested it (and PSX core in general) in in Crash Bandicoot and Spyro and in the latter one blending transparency works great but Crash somehow sets transparency bit for almost whole screen except Crash himself and maybe few objects here and there. Still beats forcing composite blend for whole screen but dithering in alpha blending on PSX is hardly present and it doesn't even look bad and more like sparkle effect (which is the authentic look! It was visible even when using composite) which is hardly an issue :)

In Spyro it works great and even adds slight blurring effect to things like flashing light or smoke
Debug view for transparency detection
Debug view for transparency detection
debug_transparency.jpg (381.13 KiB) Viewed 570 times
At this point in current state of PSX core this was most probably all the fun I could have with it :)
Attachments
PSX_smart_blend.rbf
PSX with smart blend made from official commit 35e3388
(3.46 MiB) Downloaded 8 times
FPGAzumSpass
Posts: 158
Joined: Sat May 23, 2020 12:55 pm
Has thanked: 16 times
Been thanked: 183 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by FPGAzumSpass »

Can you share the code?
The third picture of crash looks very nice, i would like to integrate it into the core if possible.
Maybe i can also help with some core internals (like alpha?) if you still need it.

(Not sure we should discuss this in a genesis topic...)
kalach.x
Posts: 43
Joined: Thu Dec 02, 2021 3:12 pm
Has thanked: 13 times
Been thanked: 17 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by kalach.x »

I created pull request for this feature https://github.com/MiSTer-devel/PSX_MiSTer/pull/1

Please feel free to refactor it as you see fit. I am still learning so the design might not be optimal.
totozero
Posts: 2
Joined: Tue Nov 09, 2021 11:08 pm
Been thanked: 2 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by totozero »

kalach.x wrote: Wed Jan 12, 2022 5:32 pm I will need some examples of games where issues can be seen to figure best way to blend them and/or if any potential fixes for adaptive blend are working. Also it would be appreciated if this was something seen early on in the game ;)

And other than that just enjoy. Your feedback is much appreciated :)
Hey man, glad you're working on the matter !
Full RGB Genesis with adaptive blending while mitigating artefacts would be very nice.
Sadly I can't test your build, I'm waiting for a new de-10, as all of them seem made of unobtainium.

Meanwhile I've been testing some stuff on retroarch with shaders, maybe they could work as a comparison with your algo.
All screenshots were taken in 4k with integer scaling, please don't mind the color output when filtered as it was calibrated for my tv.

1. Aero the acrobat 2 raw screenshot
2. Aero the acrobat 2 filtered (mdapt)
3. Aero the acrobat 2 filtered (mdapt + crt royale)
Attachments
Aero the Acro-Bat 2 (USA)-220119-223318.png
Aero the Acro-Bat 2 (USA)-220119-223318.png (62.94 KiB) Viewed 134 times
Aero the Acro-Bat 2 (USA)-220119-223445.png
Aero the Acro-Bat 2 (USA)-220119-223445.png (69.58 KiB) Viewed 134 times
Aero the Acro-Bat 2 (USA)-220119-223252.png
Aero the Acro-Bat 2 (USA)-220119-223252.png (4.22 MiB) Viewed 134 times
totozero
Posts: 2
Joined: Tue Nov 09, 2021 11:08 pm
Been thanked: 2 times

Re: Composite Blend on Genesis core on all console cores?

Unread post by totozero »

Here's a tricky one, I don't know really how it's supposed to look with composite, but the hills on the background look better for sure when dithered.
Attachments
Alisia Dragoon (USA)-220119-224629.png
Alisia Dragoon (USA)-220119-224629.png (144.17 KiB) Viewed 133 times
Alisia Dragoon (USA)-220119-224609.png
Alisia Dragoon (USA)-220119-224609.png (175.93 KiB) Viewed 133 times
Alisia Dragoon (USA)-220119-224401.png
Alisia Dragoon (USA)-220119-224401.png (5.22 MiB) Viewed 133 times
Post Reply