Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - tsaylor

Pages: [1] 2
Scripting / Re: Trying to understand position within a shader
« on: April 05, 2021, 10:08:52 PM »
I was able to track down my issues with this, and I'm beginning to understand it better. gl_FragCoord is indeed usable but I learned two important points, which I'll document here in case they are useful to others in the future:

  • The coordinate system is opposite to the normal AM screen coordinates. Within a shader (0,0) is bottom left instead of top left.
  • The coordinates are relative to the entire screen size. Normally this should not be an issue but in my case I am setting fe.layout.width and fe.layout.height to make the dimensions smaller because I'm testing different layout resolutions. This leaves some unused space on the screen edges, and those pixels still count.

For point 1, we can change the behavior by placing this line at the top of the shader code, switching to the AM style layout coordinates:

layout(origin_upper_left) in vec4 gl_FragCoord;

For point 2, I'm now passing a set of offset coordinates to the shader, and using them to shift the position and accommodate the extra screen edges. In my case this was like:

shader.set_param("fragmentOffset", -(ScreenWidth - flw) / 2, -(ScreenHeight - flh) / 2);

And then used in the shader like so:
vec2 position = gl_FragCoord.xy + fragmentOffset;
(then I use position instead of gl_FragCoord)

Scripting / Trying to understand position within a shader
« on: April 02, 2021, 10:39:45 AM »
I'm experimenting with writing my first shader, but I'm having a hard time using gl_FragCoord to determine the position within the image. Does anyone here have experience with this? I can set gl_FragColor and see results, but what I can't seem to do is pass values into the shader (say a position and a size), and then use those values relative to the current coordinate in gl_FragCoord. Basically I'm trying to color a specified set of pixels within the image, where those locations are provided by an AM layout. Is there a secret I'm missing? I can get the desired results in an online tool such as, but using the same code (I think) in a shader called by AM does not give the same results. I suspect the difference lies in how the coordinates are used, but I don't know of any direct way to "debug" the shader and show those internal values at run time.

I can put together a test example if needed, but I was hoping someone here knows something about conversion between a "standard" GLSL fragment shader and an AM compatible shader. In case it matters, the object I'm assigning the shader to is a surface.

Themes / Re: At-The-Arcade Multi-Cab [Release] - Updated 14 February 2021
« on: February 14, 2021, 10:38:54 PM »
Thanks Yaron for your work and even taking requests! For me the delay would only need to be on initial startup, not when switching layouts, but I'm not sure if the layout code would even know the difference. Probably it should just be an AttractMode feature rather than a layout feature. But anyway it is all working well.

Themes / Re: At-The-Arcade Multi-Cab [Released]
« on: February 09, 2021, 08:37:31 AM »
The new music settings are really great! Feature request: I'd like if there were a setting for the music location, so that we could point to some other common directory. And maybe a startup delay setting for the music (as I already play some audio when starting up AttractMode, so the two are overlapped currently).

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: February 03, 2021, 10:17:49 AM »
That sounds like an excellent module! Thanks mahuti!

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: February 02, 2021, 08:45:54 AM »
That's great, I didn't realize the snap size was still the same. Nice effect! It's tempting to do for every game regardless of orientation, but a complete solution would require a lot more logic, and knowledge of the bezel dimensions as well.

But yeah, just from looking around briefly it does seem like these efforts tend to be a bit ... fragmented. Each one for a specific purpose.

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: February 01, 2021, 04:53:55 PM »
Well that looks very nice! Definitely loses some available space for the video (unavoidably), but it's a really great option. But is there any good library out there of full-sized bezels (or at least as large as the side-bezel library that Yaron found)? If needed I'd be ok with doing some image editing for the games I use, but I only play a few dozen games so it's a very small subset of what others would want for a proper MAME library.

Seems like the ultimate group project would be a full set of cabinet images (control panel, marquee, bezel, snap, side art,...), with standard sizing but available as separate parts or combinable. But I doubt that anything like that exists.

Themes / Re: At-The-Arcade Multi-Cab [Relased]
« on: February 01, 2021, 10:11:37 AM »
Showing bezels for horizontal games seems possible (and those bezels are usually fairly thin), but I think it would also require checking the resolution of the 'snap' image, and reducing its size a bit if it is already full width.

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: January 31, 2021, 12:05:08 PM »
That looks very nice! Personally I prefer a bit of separation but the shader accomplishes that. And it's definitely an advantage to use the same image files. How were you able to find room for the entire bezel? [edit - actually I see you didn't fit the entire image, but most of it]

Now that bezels are in play, in hindsight, it probably would have been better if the cabinet images didn't contain a black bezel/border. More space to work with.

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: January 31, 2021, 10:09:11 AM »
I did some test mods in the layout.nut, but I used Yaron's theme for that since it had the side bezel support already (so I don't even know which post is more relevant for this discussion). I "squished" the bezels at run time so they are displayed narrower, and placed the left/right sides of that separately. I actually think it looks pretty nice, as it keeps the full screen snapshot while also showing the full bezel (albeit squished). The main issue I ran into is that the snaps have varying aspect ratios, and similarly the visible bezel widths differ from game to game. Nothing about the bezel files tell us the inner width, so I had to take a guess on a percentage that looks good on most games.

Then as an experiment I tried enabling it for horizontal games as well, and it actually didn't look too bad. Mainly because the bezels for those games are already much thinner than the vertical game bezels. Could be enabled as a separate option perhaps. But to handle it better, we'd probably need to compute the aspect ratio for those horizontal snaps, and if it is too wide (basically consuming the entire available area, as some of them do, we could shrink the snap size a little).

Here's an example of a vertical game (1943) and a horizontal game (Defender), with the bezels squished to 65% of their full size. I can share the code I used, but it was based on the "At-The-Arcade Multi-Cab" layout so not directly applicable for this layout.

Themes / Re: DynamicArcade layout beta-v9 released 26 Jan 2021
« on: January 30, 2021, 09:34:04 AM »
Thanks jclampy69! I really like seeing those bezels but agree that it hurts to narrow the snap image, and makes the bezels seem comparatively too large. I looked at what the original cabinet looked like ( I found it interesting that there was no black border around the screen, but I tried a photoshop mockup that way and it just doesn't look right. Your black border seems necessary.

I tried a mockup keeping the original snap image, adding the black border, and then squishing the width of the bezel sections. I like the result but admit it would be more effort, as I think the squished left/right sides of the bezel would need to be rendered separately. Not sure how much effort you want to put into it, but here's my mockup just to see what it could look like.

Themes / Re: At-The-Arcade Multi-Cab [Relased]
« on: January 29, 2021, 03:10:28 PM »
I notice we're only seeing about half the width of the bezel on each side, so I assume the aspect ratio of those bezel images doesn't match what those cabinets are expecting. Have you tried tweaking the rendering to squish the width? I suppose something like that would require separate handling of the left/right sides.

Themes / Re: At-The-Arcade Multi-Cab [Relased]
« on: January 29, 2021, 10:14:24 AM »
Agreed, it's brilliant! Now all the other cabinet-style themes need this addition as well.  ;D

Themes / Re: DynamicArcade layout beta-v8 released 25 Jan 2021
« on: January 25, 2021, 05:53:14 PM »
Here's an example of the layout running at 1600x1200. I think it works great even though it wasn't really designed for that resolution. As for the game titles /videos, you are correct that those do not show up with the default crt_shader on my AMD graphics card. With the scanlines option, the images are working. For some reason the curved corners are only working on some of my files (depending on the resolution I suppose), as in this attachment. Let me know if you need me to track down more details about resolutions and such.

Themes / Re: DynamicArcade layout beta-v7 released 18 Jan 2021
« on: January 24, 2021, 10:24:28 PM »
Actually it looks like both methods worked. Sorry, it flashes pretty fast and wasn't obvious to me. But I see rounded corners on both tests.

Pages: [1] 2