-
Notifications
You must be signed in to change notification settings - Fork 263
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
[Bug]: Performance regression for lights/sights performance on 1.12.0 #3651
Comments
@kwvanderlinde it might be worth testing with different scaling qualities (preferences -> application ) to see if there is any interaction there as this also affects the rending hints for different things being drawn to the buffer. |
Even at lowest quality the issue persists. I've also tried reverting that particular change altogether and light rendering remains just as slow. |
One thing I noticed is that the repeated Beyond that, I have spent a fair amount of time trying to figure a way to improve the performance of drawing the lights themselves. Unfortunately, every idea I get has come up short and I've never been able to get a consistent improvement. So if anyone has some thoughts I would love to hear them. |
So given I can't currently look at the code but if you are willing to entertain thoughts.... If we are rendering lights with blending modes to the same buffer then drawing that into the map it might be more efficient to render each light to its own buffer without any blending mode, then in one pass draw all those buffers into another with blending on. Drawing a rectangle with blending is more easily optimised than filling an arbitrary shape with blending. But the questions are 1) Is it optimised in the Java2d Graphics library, 2) is the speed difference enough to make up for the increased number of pixels you are drawing :) Oh and I guess 3) is it an easy enough thing to change to test that if it doesn't work its not a lot of time lost. |
That was a good idea, unfortunately it didn't yield any improvements. It did at least give out Looks like I really do need to come up with a way of speeding up |
I took a look at the Another thing you can do that may help in the general case is a bounding box check to see which light sources overlap that generates "list of lists" of light sources that overlap. And if you can cache them and only have to compare lights that have moved even better.
I guess it then comes down to the different usages.
|
I am looking forward to one day having a libGDX renderer as that would open up an avenue for lots of neat things. Your idea of grouping lights is interesting and that would allow us to rescue performance in cases of isolated lights. But the point of the additive blending feature is to make overlapped lights look better, and I am finding that even a couple of overlapped lights are enough to cause performance to noticeably suffer. And I'm not exactly running this on a low-end system, so I can only imagine what some other users will run into. I'm honestly thinking it might be better to pull the feature for the time being until we have something like the libGDX renderer that could support more interesting effects. |
Yeah that's it. |
Another thing we could do is - similar to the image scaling - have a lighting quality preference that can either use |
Have you looked into the issues that are going on with libGDX in MT? Getting that thing working with MT could probably use a wizard like you in the mix. ;) I don't want to speak for him (but I guess I kinda am), but right now it seems like @thelsing is only touching it on occasion and could use some help. |
To my understanding, the LibGDX port is still incomplete and there as there is functionality that is not yet implemented. After it reaches feature parity, it's going to require a lot of testing effort; by his admission, Thelsing doesn't use macros in his campaigns, and all of the issues that we found with the protobuf change were loading old campaigns and macro related nd they have taken a lot of time to sort out. I believe this renders on the JavaFX thread, so I suspect it will potentially break all the macro functions that are somehow related to the map rendering. From get selected macros to get/set states, on token move, you name it. There could also be obscure interactions with any dialogs like edit token properties. So at this point, it looks to be many, many releases away. |
@kwvanderlinde any more thoughts on if we should remove it? I think we have fixed all the other issues for a 1.12.1 build; if you do want to take it out, then it would probably be wise for us to wait for that before releasing 1.12.1. Or do you want to put it behind a preference that defaults to off? |
I think it's best if we remove it. Keep the new light/darkness/aura overlays, but avoid additive blending for the time being. I can have that put together fairly quickly. |
Describe the Bug
Map rendering on 1.12.0 can be choppy even with only a handful of sights or lights in play if they take up a signification portion of the viewport.
To Reproduce
ZoneRenderer.renderZone
, observe highpaintComponent
times , and in particular highrenderLightOverlay:drawLights
times.Expected Behaviour
The map can be rendered smoothly in the presence of a few lights or sights (<16 ms or so).
Screenshots
This screenshot shows that it can easily happen that a viewport fills with sights or lights even when only the party is on the map, and at reasonable zoom levels:
MapTool Info
1.12.0
Desktop
Linux Mint 21
Additional Context
This is a performance regression since 1.11.5 and is related to the implementation of additive lights (#1550). The times I am seeing are 50-60 ms or more for drawing lights, and sometimes as high as 80ms for rendering the zone.
I am running two monitors both at 2560x1440, though MapTool is constrained to just one monitor. If I reduce this to 1920x1080 it's a much better experience, but still 25-30 ms per render.
Debug information
The text was updated successfully, but these errors were encountered: