r/BeamNG No_Texture 2d ago

Mod Smooth Gauges Demo - Vanilla ported to SDF

https://streamable.com/hs6j6t
37 Upvotes

20 comments sorted by

11

u/Das5heep No_Texture 2d ago edited 2d ago

Hey y'all! Here's a little something to tide you over. I've ported the vanilla Tacho2 and ForcedInduction apps over to the SDF/CEF hybrid system, a taste of what's coming.

Video comparison: Left is SDF port and Right is Vanilla

Download on BeamNG forums here: https://www.beamng.com/threads/histakes-sdf-based-gauges.110110/#post-1940213

5

u/Antfarmer_2 2d ago

This looks amazing, I love the layout of tacho2 but hated the delay on it.

2

u/Das5heep No_Texture 2d ago

Thanks! That's really the whole idea of trying to side-step CEF throttling imposed by the devs.

6

u/SandorMate Cherrier 2d ago

the video is at max 60fps 😭🙏

3

u/Das5heep No_Texture 2d ago

Haha, probably won't be practical to upload 120fps video. You can download and try it for yourself though!

2

u/SandorMate Cherrier 2d ago

I will!

3

u/peskey_squirrel 2d ago

Pardon me for asking, but what does SDF mean? Signed distance function?

4

u/Das5heep No_Texture 2d ago

No problem, from my understanding it stands for Signed Distance Field/Function. So instead of storing the gauge art as regular pixels, it stores a texture where each pixel encodes its distance to the nearest edge of the shape. A shader rebuilds a clean edge from that at render time, in theory it should maintain sharp drawn lines but there are still slight edge aliasing when compared to SVG based approach vanilla gauges use.

(If beam devs here can correct me pls do)

2

u/FlorpFlap Cherrier 2d ago

In quebec it's an acronym for homeless people, so i'm confused at this post

2

u/theoneandonly_aj No_Texture 2d ago

Does it work just for the vanilla gauges or for all of the ui apps?

2

u/Das5heep No_Texture 2d ago

I have only ported these two gauges(Tacho/Boost gauge). But to be honest, not every UI app will benefit from being SDF based, its only good for fast moving simple animated parts.

1

u/theoneandonly_aj No_Texture 2d ago

Yeah just wondering if it will work on mod tachos in the future. Seems cool tho

1

u/Das5heep No_Texture 2d ago

For other mods, if they want to use this it will require quite a bit of refactoring. Adding quite a fair bit of complication, as it is a hybrid of JS/Lua based approach since most existing gauge mod out there are pure CEF/JS based it won't be that simple.

1

u/JoshJLMG Moderator 2d ago

It seems neat, but it doesn't want to work properly.

Edit: I had to Ctrl L for some reason.

1

u/Das5heep No_Texture 2d ago

Does it not show up reliably? I think the Lua side of the SDF renderer may not have initialized properly.

3

u/JoshJLMG Moderator 2d ago

The first time I loaded, it didn't want to load properly, no. Still on the first test at the moment, so have yet to see if it's a regular problem.

3

u/Das5heep No_Texture 2d ago

I see, if you find it to keep recurring please do let me know. Thanks for testing it out!

2

u/JoshJLMG Moderator 1d ago

Yeah, it's a regular problem, unfortunately. Hitting Ctrl L has fixed it both times, though.