CaffeineMC / sodium-fabric

A Fabric mod designed to improve frame rates and reduce micro-stutter
Other
4.58k stars 775 forks source link

Optimization for glow ink sac sign. #794

Open NamiUni opened 2 years ago

NamiUni commented 2 years ago

Is your feature request related to a problem? Please describe. Yes, it might a problem related to the signs lag (#350) . It is about glow ink sac sign. Like literally, even 10 glow ink sac signs make fps significantly decay.

Describe the solution you'd like The optimization for the sign render Using "Enhanced Block Entities" to resolve by my own.

Describe alternatives you've considered Optimize sign rendering and enhance in performance.

Additional context The video that I filmed to examine the fps ratio per signs: https://youtu.be/2lazxwyKUXw

Enhanced Block Entities: https://www.curseforge.com/minecraft/mc-mods/enhanced-block-entities

Rajbir98 commented 2 years ago

Plz update the curseforge link its not working

Rajbir98 commented 2 years ago

https://www.curseforge.com/minecraft/mc-mods/enhanced-block-entities is this link working

NamiUni commented 2 years ago

@Rajbir98 Thank you for pointing that out 😘

Rajbir98 commented 2 years ago

Welcome I Also have the same problem i wanted to make a led room with these glowing signs but its lagging my game i get 64 to 90 fps in max it droped to 5 to 10

Rajbir98 commented 2 years ago

and with Enhanced Block Entities it becomes 15 to 25 fps so it get rids of a lag a bit but not completely remove the lag

NamiUni commented 2 years ago

0.4-experiments showed a significant improvement in performance. We look forward to its release. The image shows a comparison between 0.3.2 and 0.4. 2021-09-05_13 00 20

NamiUni commented 2 years ago

I took a comparison video. 5 times the performance of vanilla and 1.3 times the performance of 0.3.2. https://youtu.be/znGDVf_8ijM

BeeFox-sys commented 2 years ago

i have been thinking about this issue and my idea on this would be to replace the font of glowing signs with an emmisive font that has an outline, rather then generating an outline for the font by copying text as vanilla does, i did manage to make an example font but i had to do it manually and would prefer a way to do it programatically to avoid headaches for people maintaining it. here is the ascii font file i tested with; ascii

this is probably a fairly important thing to optimise, as one glowing sign is the equivalant of 5 non glowing signs

EuropaYou commented 11 months ago

Doing it separately for each colour, each alphabet, each language would be too much work for a sign and would make compatibility with mods worse.

I don't know what Sodium did in 0.4, so I'm speaking accordingly: (I couldn't find the release notes)

If it renders the text first, then the outline, it would degrade performance a lot. Instead, it might be a much better solution to combine the text with the outline and render it. It would be less work than the previous solution, with better compatibility with mods, but less performance.

Felix14-v2 commented 9 months ago

I think this is efficiently solved in ImmediatelyFast 1.2.4 and above, you just need to enable experimental options

image

Demo
Screenshots by maybemeowing#0000 vanilla ![image](https://github.com/CaffeineMC/sodium-fabric/assets/75726196/92831803-1bab-40f1-9559-e50fa70cb2e5) immediatelyfast 1.2.3 ![image](https://github.com/CaffeineMC/sodium-fabric/assets/75726196/02bac05e-ae2d-44b6-941d-6ba667822172) immediatelyfast 1.2.4 ![image](https://github.com/CaffeineMC/sodium-fabric/assets/75726196/ccca0568-35fc-4098-a18e-ca46d16c60a7)
Tests by wicivo#0000 ![image](https://github.com/CaffeineMC/sodium-fabric/assets/75726196/435d831c-93fc-41d9-ae83-ad1349201142) ![image](https://github.com/CaffeineMC/sodium-fabric/assets/75726196/3e443b44-eb3d-4818-9520-20e39c8e5cc0) [source](https://discord.com/channels/927329821405642772/1025809029798301736/1150886996370280468)
douira commented 2 months ago

Is this still a relevant issue for sodium if immediately fast seems to have more or less fixed it?

MeeniMc commented 2 months ago

The IF experimental optimization is incompatible with using a different Font than the unreadable default font that comes with Vanilla, and also break for signs with unicode chars.

That being said, there are other mods that also do some work on signs, e.g. EBE, Exordium and these don't have corner cases. They do a good job of making the problem less painful but not sure this is completely solved.