Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate CRT-Royale or other CRT-emulation shader #54

Open
bni opened this issue Apr 29, 2020 · 25 comments
Open

Integrate CRT-Royale or other CRT-emulation shader #54

bni opened this issue Apr 29, 2020 · 25 comments

Comments

@bni
Copy link

bni commented Apr 29, 2020

It would be really nice if there was a way to make Cannonball use a CRT shader so it would look as similar as possible to the real arcade cabinet screen.

@J1mbo
Copy link

J1mbo commented Jun 27, 2020

I have a build integrating Blargg with multi-threaded shading via boost. I'm trying to get this updated as it was based on 2013 code.

My version also fixes the timer sync between countdown and game times (bug in original game). I'm pulling this back out now as the idea is to get this working on RPi 4 to make a mini cab, so the Linux force feedback I will be needing too :)

@J1mbo
Copy link

J1mbo commented Aug 9, 2020

@bni in case you were wondering. I've updated the build for SDL2 and it runs on an RPi 4 (at 30fps)... I need to sort out some in-game seg faults and will put in a pull. Multi-threading is via omp (memory fades over 6 years!).

@J1mbo
Copy link

J1mbo commented Aug 9, 2020

outrun-start-clean-and-filtered
Work in progress, especially the vignette.

@bni
Copy link
Author

bni commented Aug 10, 2020

Looks great J1mbo. I can attempt to build and run it on macOS. Last time I build it I used SDL1.2, so will have to upgrade that.

@J1mbo
Copy link

J1mbo commented Aug 11, 2020

outrun-start-filtered2
Progress...

@J1mbo
Copy link

J1mbo commented Aug 17, 2020

@bni Are you able to build the current master on Mac OS with SDL2?

@bni
Copy link
Author

bni commented Aug 17, 2020

@J1mbo I tried but failed, my understanding of CMake and SDL is not enough. The Cannonball macosx.cmake seems to be setup to use SDL 1.2 and I was unable to modify it to work with SDL2

@bni
Copy link
Author

bni commented Aug 17, 2020

@J1mbo I tried again and got it to build finally.

It runs ok using the default rendersurface.cpp. But if I use rendergl.cpp there is a black window only. I can hear the music and control the game but nothing is displayed. With SDL 1.2 it worked to use OpenGL

I guess your CRT shader will require OpenGL ?

@J1mbo
Copy link

J1mbo commented Aug 18, 2020

Excellent, can you share the cmake etc? The shaders would be better done in OpenGL, but currently I have just stacked textures in SDL which seems to work well enough for my requirements. SDL is a front to OpenGL incidentally.... strange.

@bni
Copy link
Author

bni commented Aug 18, 2020

Sure @J1mbo I have put it in my fork: https://github.com/bni/cannonball

Also some other stuff too, like putting the executable in .app container and bundle the SDL2 .dylib correctly.

It looks quite bad, as scanlines are disabled since the rendersurface.cpp is used. Hope your shader can fix this :-)

@J1mbo
Copy link

J1mbo commented Aug 19, 2020

Thanks. I can't make it work on Mac, it just gets stuck at SDL.h.

But anyway, I have also made a fork with the shaders here: https://github.com/J1mbo/cannonball Broadly the functionality is:

  • Blargg CRT filter integration
  • 7 synthetic CRT Masks (RGB stripes, grills etc)
  • Scanlines
  • Vignette mask (with round corners)
  • RGB colour processing (some via Blargg filter, some currently with no UI, controlling the colour intensity curves)

This build also fixes the screen ratio and SDL2 sound bug.

If you can get it to build and let me know how/if it works that would be great.

@bni
Copy link
Author

bni commented Aug 19, 2020

Hi @J1mbo , I have integrated your changes in my fork now.

I can report it works great. Performance is great on my 2013 macbook with intel graphics.

About your troubles with SDL2, are you using SDL2-2.0.12.tar.gz and compiling form source? The .dmg only works when using xcode it seems.

@J1mbo
Copy link

J1mbo commented Aug 19, 2020

Thanks - I finally got it built, by compiling with gcc. I have SDL installed with brew. I think we need some better documentation for Mac, it's a bit of a mystery to me.

I was hoping that SDL would see the Mac screen at it's native resolution, but that doesn't seem to be the case. Perhaps that can be controlled somehow.

@bni
Copy link
Author

bni commented Aug 21, 2020

Agreed, the build.sh I made tell the story of what is needed to build a self contained "Out Run.app". Using brew the dependencies is easier to get in place of course. I realise integrating this into djyts original repository wont be great, but maybe someone that knows how to do this properly could use some of the ideas.

@bni
Copy link
Author

bni commented Aug 21, 2020

@J1mbo what settings do you use for the CRT emulation? Im interested in finding settings so it matches the original arcade hardware as much as possible.

If someone out there has the real arcade machine, your view on this would be much appreciated

@bni
Copy link
Author

bni commented Aug 21, 2020

@J1mbo about the hiDPI issue, I remembered this: ioquake/ioq3#422

Seems to be controlled from Info.plist:
NSHighResolutionCapable

@J1mbo
Copy link

J1mbo commented Aug 21, 2020

Thanks, I got high-DPI working. This shot from the arcade mini cab is a great reference: https://twitter.com/djyt/status/1293109217235275776/photo/4

On the Mac is looks like this (I think mask 7 35%): https://twitter.com/jimbo_4000000/status/1296894217969635330/photo/1

@bni
Copy link
Author

bni commented Aug 22, 2020

I didn't realise before it was possible to select different masks. Selecting 7 made a large difference.

I also noticed it essential to have a 4K screen. On a 4K TV the effect looks very good and I think its very close to the reference pictures you linked to.

On my 1440p PC monitor the effect is lost and the rgb subpixels is not really seen, its more of a black grid. But maybe this is to be expected and you really need 4K to emulate CRT properly.

@bni
Copy link
Author

bni commented May 23, 2021

I have re-started my fork to be based on the latest code from djyt. I implemented a renderer based on SDL_gpu and a shader that is based on crt-lottes. No idea if it is close to the vintage arcade, but I think it looks nice on todays screens.

@djyt
Copy link
Owner

djyt commented May 25, 2021

@bni Update this thread when you're done. Maybe we can integrate into the main codebase this time round. I am likely to have some downtime in the coming weeks.

@bni
Copy link
Author

bni commented Jun 9, 2021

@djyt Sure I am done now I think. I have accomplished what my goals was with the fork.

There are 3 parts that can be picked more or less independently:
macOS CMake file
app bundle build script
CRT shader using SDL_gpu

@J1mbo
Copy link

J1mbo commented Jun 9, 2021

I’m super looking forward to trying this out :-)

@Johnreidsilver
Copy link

Does your fork have steering wheel support in Linux? I tried the Ubuntu version from the default software app and steering isn't recognized.

@bni
Copy link
Author

bni commented Nov 21, 2021

@Johnreidsilver I have no changes/fixes regarding that. My fork is focused on CRT shader and macOS app bundle.

@Johnreidsilver
Copy link

Thanks anyway. Hope to enjoy your CRT shader version soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants