Mega Bezel Reflection Shader! - Feedback and Updates

Hey guys… I’m looking for some tips on setting up a preset for Irritating Maze. Is it possible to properly line up the “official” bezel from Mr. Do’s pack with the in-game MAME lights? I’m hoping to use opacity to get them to glow through the bezel a bit. I know this won’t look perfect, but it’s the only way I could think of to make a unique bezel for it. Any other ideas are most welcome… would love to hear specifics about what aspect ratio and sizing tips to use to line everything up.

Thanks for the help.

Could you post a picture of the raw mame output and the overlay pointing out what you are trying to do?

I believe this is how it’s supposed to line up. I would probably like to add a marquee (or bottom part of) to use the red light area, and just have the CP area off screen.

1 Like

If you can’t do it by just scaling and positioning the screen then you are out of luck. (You’ll have to play with the aspect also.)

It is a pretty simple layout though.


<mamelayout version="2">
	<element name="bezel">
		<image file="irrmaze_bezel.png" />
	</element>
	<view name="Upright_Artwork">
		<screen index="0">
			<bounds x="408" y="221" width="1200" height="900" />
		</screen>
		<bezel element="bezel">
			<bounds x="0" y="0" width="2000" height="1660" />
		</bezel>
	</view>
</mamelayout>

<!--

- Artwork type: Bezel
- Photographed bezel provided by Bobby Tribble
- Converted for MAME by Mr. Do
- Lay file by Mr. Do

-->

So it should be possible.

Edit: Not going to be possible after all, without some serious effort.

The thing is that applying a layout in MAME disables the hard coded layout. I’m sure there are no flashing lights in MAME standalone using the Mr. Do layout.

In MAME you could recreate the lights and place them where you want but in the shader everything is part of the screen.

You could use the screen only base preset but you would need to edit the hard coded layout and do a custom compile. The hard coded layout is not as simple.

<!--
license:CC0
copyright-holders:Vas Crabb
-->
<mamelayout version="2">
	<!--
	sit0...sit9     TIMER LAMP          *0x10fe1c & 0x03ff
	sit10           TRACK BALL LAMP     *0x10fe1f != 0
	sit11           SIDE LAMP           *0x10fe20 != 0
	sit12...sit13   COLOR LAMP          *0x10fe21 & 0x0003
	sit14           FLASH LAMP          *0x10fe22 != 0
	sit15           ???                 *0x10fe29 != 0
	-->

	<element name="white">
		<rect><color red="1" green="1" blue="1" /></rect>
	</element>

	<element name="marquee">
		<rect><color red="0.5" green="0" blue="0" /></rect>
	</element>

	<element name="colorlamp">
		<rect state="0"><color red="0.4" green="0.4" blue="0.4" /></rect>
		<rect state="1"><color red="1" green="0.3" blue="0.2" /></rect>
	</element>

	<element name="timerlamp">
		<disk state="0"><color red="0.3" green="0" blue="0" /></disk>
		<disk state="1"><color red="1" green="0.3" blue="0.1" /></disk>
	</element>

	<element name="sidelamp">
		<rect state="0"><color red="0.5" green="0.5" blue="0.1" /></rect>
		<rect state="1"><color red="1" green="1" blue="0.5" /></rect>
	</element>

	<element name="flashstick" defstate="1">
		<rect state="0"><color red="1" green="1" blue="1" /></rect>
		<rect state="1"><color red="0" green="0" blue="0" /></rect>
	</element>

	<element name="flashgrille" defstate="1">
		<disk state="0"><color red="1" green="1" blue="1" /></disk>
		<disk state="1"><color red="0" green="0" blue="0" /></disk>
	</element>

	<element name="cpanel">
		<rect><color red="0.4" green="0.4" blue="0.4" /></rect>
	</element>

	<element name="trackball">
		<disk state="0"><color red="0.6" green="0" blue="0" /></disk>
		<disk state="1"><color red="0.9" green="0.5" blue="0.1" /></disk>
	</element>

	<element name="redbtn">
		<disk state="0"><color red="0.7" green="0" blue="0" /></disk>
		<disk state="1"><color red="0.35" green="0" blue="0" /></disk>
	</element>

	<element name="bluebtn">
		<disk state="0"><color red="0.2" green="0.5" blue="1" /></disk>
		<disk state="1"><color red="0.1" green="0.25" blue="0.5" /></disk>
	</element>

	<view name="Cabinet Lamps">
		<screen index="0"><bounds x="3.5" y="4.4" width="16" height="12" /></screen>

		<collection name="Marquee and Timer Lamps">
			<element ref="marquee"><bounds x="0" y="0" width="23" height="2.5" /></element>
			<element ref="colorlamp" name="sit13"><bounds x="0" y="0" width="11.5" height="1" /></element>
			<element ref="colorlamp" name="sit12"><bounds x="11.5" y="0" width="11.5" height="1" /></element>
			<element ref="timerlamp" name="sit9"><bounds x="2" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit8"><bounds x="4" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit7"><bounds x="6" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit6"><bounds x="8" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit5"><bounds x="10" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit4"><bounds x="12" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit3"><bounds x="14" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit2"><bounds x="16" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit1"><bounds x="18" y="1.25" width="1" height="1" /></element>
			<element ref="timerlamp" name="sit0"><bounds x="20" y="1.25" width="1" height="1" /></element>
		</collection>

		<element ref="flashstick" name="sit14"><bounds x="0.75" y="6.5" width="1.5" height="5.5" /></element>
		<element ref="sidelamp" name="sit11"><bounds x="0.5" y="12.5" width="2" height="4.5" /></element>
		<element ref="flashstick" name="sit14"><bounds x="20.75" y="6.5" width="1.5" height="5.5" /></element>
		<element ref="sidelamp" name="sit11"><bounds x="20.5" y="12.5" width="2" height="4.5" /></element>
		<element ref="flashgrille" name="sit14"><bounds x="7" y="17.25" width="3" height="2.5" /></element>
		<element ref="flashgrille" name="sit14"><bounds x="13" y="17.25" width="3" height="2.5" /></element>

		<collection name="Control Panel">
			<element ref="cpanel"><bounds x="4.5" y="20" width="14" height="7" /></element>
			<element ref="trackball" name="sit10"><bounds x="10" y="22" width="3" height="3" /></element>
			<element ref="bluebtn" inputtag="edge:irrmaze:START" inputmask="0x01"><bounds x="11.125" y="20.125" width="0.75" height="0.75" /></element>
			<element ref="redbtn" inputtag="edge:irrmaze:BUTTONS" inputmask="0x10"><bounds x="7" y="23" width="1" height="1" /></element>
			<element ref="bluebtn" inputtag="edge:irrmaze:BUTTONS" inputmask="0x20"><bounds x="5" y="22.5" width="1" height="1" /></element>
			<element ref="redbtn" inputtag="edge:irrmaze:BUTTONS" inputmask="0x40"><bounds x="15" y="23" width="1" height="1" /></element>
			<element ref="bluebtn" inputtag="edge:irrmaze:BUTTONS" inputmask="0x80"><bounds x="17" y="22.5" width="1" height="1" /></element>
		</collection>
	</view>

	<view name="Screen 0 Standard (320x224)">
		<screen index="0">
			<bounds left="0" top="0" right="4" bottom="3" />
		</screen>
	</view>

	<view name="Screen 0 Cropped (304x224)">
		<element ref="white">
			<bounds x="8" y="0" width="304" height="240" />
		</element>
		<screen index="0" blend="multiply">
			<bounds x="0" y="0" width="320" height="240" />
		</screen>
	</view>

	<view name="Screen 0 Stretched (304x224)">
		<bounds left="8" top="0" right="312" bottom="228" />
		<element ref="white">
			<bounds x="8" y="0" width="304" height="228" />
		</element>
		<screen index="0" blend="multiply">
			<bounds x="0" y="0" width="320" height="228" />
		</screen>
	</view>
</mamelayout>

Which is why you have the fancy lights.

This would be a LOT of tedious trial and error and probably not worth it for one game.

1 Like

The lights are actually flashing if you just enable them in the MAME tab video settings.

That will turn on the hard coded layout, but it has no relation to the soft layout. If you wanted the lights to match up with transparencies in the graphic, the hard coded layout would have to be modified to work. (And compiled into the binary.)

I went through the effort years ago for my MAME Spacewar! layout.

Original Spacewar! hard coded layout.

New hard coded layout.

3 Likes

Here’s what I came up with… I had to resize elements of the bezel art to fit the lights properly. The overlay still needs some cleanup and I found out I didn’t have an image of the red light part of the marquee, so I just colored it red for now, over the lights. Duimon, you were probably right that it was too long to spend on one game, but I felt like I wanted to do something for it since it was a unique cabinet.

3 Likes

I would have spent less time answering if I had known you were willing to modify the original art.

Nice work.

1 Like

This is why I like to use Integer Scale Mode + Integer Scale Offset + Bezel Independent Scale when using certain masks in my SNES presets.

Observe the power bars.

2 Likes

What does bezel independent scale do? These options look really good. I found some weird patter in Rastan’s life bar, and always thought that something was missing there and in other games always found life bars a bit different from a CRT, and it would be nice to align the stripes I think these are good options… Here’s a pic of Rastan’s life bar… It has odd stripes, they don’t look simetrical…

2 Likes

This is generally not needed, it is only useful in situations where you have a bezel as part 9f one of the images and so you want the bezel to be transparent and stick to it and not scale with the screen/tube, so basically the graphics stay static while the tube is scaled inside them.

I say it’s generally not needed because you usually can and want the graphics to scale with the screen/tube

This is because of the crt curvature and the uncurving mask, to get rid of this you should set the crt curvature multiplier to 0.

2 Likes

In my examples above if I leave Bezel Independent Scale Off and leave Integer Scale Mode Offset on 0, I still get the anomalies. It’s only when I increase it to 1 (or alternatively step up to the next Max Integer Scale Height % stop) that everything seems to render cleanly in all SNES games I’ve tested so far.

If I try to do this while leaving Bezel Independent Scale Off, too much of the Bezel/Frame ends up off screen and it doesn’t look nice in my opinion. In the case of my presets which include graphics, I at least wanted the top of Bezel/Frame to be aligned with the top of the graphics and for the Bezel/Frame not to overlap with the graphics which are already at the extreme horizontal edges of the screen so there’s not much room for the Bezel/Frame to grow without some overlap there.

As mentioned, this power bar rendering anomaly doesn’t seem to occur when using all mask type and size combinations.

Some of them look completely fine without increasing the Integer Scale (and possibly even using Non-integer scale).

In my examples above the issue is present even with Curvature turned off.

In my further testing, I’ve observed a strip where there’s overlapping going on between different layers behind the bezel which is increasing the brightness. It’s not just reflection but also the non-mirrored edges of the viewport being filtered/blurred and “shining through”. This seems to be mixing with the reflections which are stemming from the reflection plane, which starts at the edge of the content, even if the edge is supposed to be obscured by the bezel, (which is possibly incorrect behaviour) but that plane is not lining up with the inner edge of the tube/bezel or otherwise scaling properly.

I’ve observed some further strange behaviour where when using Bezel Independent Scale and some of the image is cut off, if I reduce the Integer Scale Offset or even use Non-integer Scale the reduced image, part of the image that was off screen/beneath the Bezel is still missing.

When I tried the new Show Pass debugging tool, I think I was able to see the strip of overlap when showing either Pass 2 or 3.

Adjusting the Inner Black Edge Thickness seemed to have an effect on the strip of overlap.

If Bezel Independent Scale is not used, everything “seems” fine including where the reflections stem from.

I say “seems” because I haven’t really gone back and scrutinized the reflection with Bezel Independent Scale Turned Off to see if there might be other less obvious anomalies which I might have previously missed.

Ultra Smooth RGB Mode…

1 Like

Mega_Bezel_Logo

Mega Bezel is updated to V1.9.0_2023-01-22

Changes:

  • Added some more Sinden presets for SCREEN-ONLY and POTATO
  • Added Screen Region to Resolution Debug text
    • Good for getting the screen region pixel coordinates if you need them
  • Adjusted Ambient Lighting Scaling when using the Inherit Zoom scale mode
    • Now when you zoom out it is much less likely to generate a black frame covering the outer parts of the background image
    • The minimum size of the lighting texture will be close to the height of the current viewport
    • This reduces the likelihood that we will see the cutoff
  • ScaleFx: Exposed more of the settings so they can be tweaked
    • Default Settings changed:
      • ScaleFx Threshold: now 0.43 (was 0.5)
      • ScaleFx Filter Corners: now 0 (was 1)
      • These settings result in a slighly clearer picture and less rounding of square corners
  • SMOOTH-ADV ntsc presets: ntsc_scale adjusted so it visually matches the regular ADV ntsc presets

Go to the first post here for links to the package and install instructions. Please make sure to read the install & setup instructions

I’ll probably add some screenshots soon

11 Likes

Which mask and width for 4K is the correct number for a High TVL? I want to make a setting with High TVL to see how it looks. :sweat_smile:

1 Like

Mask 12 in the post below below corresponds to Mask 13 in the above post.

1 Like

Wow! Thanks for the info well explained… Thanks.:smiley:

What does WYSWYG mean?

1 Like

WYSWYG means, “What you see is what you get.” So basically to get the correct Slot Mask Width, you first go up to the screen and choose the Aperture Grill Mask that suits the TVL, layout and looks like what you’re looking for, then adjust the width until it looks right or matches the width of the number of RGB subpixels in the Mask pattern you chose.

So Mask 6, which is RGB should use a width of 3, Mask 10, which is RGBX should use a width of 4, while Mask 12, which is RRGGBBX should use a width of 12.

As you saw from the tables above as you go down in the width of the Mask patterns, TVL goes up. So using a Mask 12 slot mask at 4K would have a TVL around 300, but Mask 10 would be higher and Mask 6 would be even higher than that.

Believe it or not using higher TVL Mask patterns actually reduce the chance of seeing or at least the severity of moire patterns. Especially when viewport sizes are reduced.

It also causes the image to be naturally less sharp/less harsh.

1 Like

Thanks a lot. You are really helpful.:grin::+1:t3:

1 Like

You’re welcome. Just a word of warning though. This thing can really suck you in to the point where you’re no longer or hardly playing games anymore but mostly looking at and tweaking pixels, lines and images.

Then you can reach to a point where you just can’t play (pixel art/low res) games if they don’t have the right shaders, kinda similar to the folks who can’t play retro games unless they’re playing them on a CRT.

So be wary of the double edged sword that this wonderful world can be.

Never forget to be having fun.

3 Likes