I started experiencing large framerate dips when there were a bunch of elevated rail segments on the screen during draw and decided to dig some more into it with NVIDIA Nsight and found large amounts of wasted pixel space being used to draw a singular track segment when it was elevated
The section in blue is the current-drawn section when the max that is technically needed for the texture is highlighted in cyan just for a straight track.
Everything that is with the red squares and diagonal lines is the current-drawn vertices.
This same thing can be found during the rendering of curved elevated rails, but here it is even worse due to each segment being drawn individually.
Event 588:
Event 593:
Here I will not include the boxes due to the visual indicator of what actually is being drawn vs what space is being badly used.
Here is a collection of screenshots when a track on the ground is being drawn with the full viewport visible.
[2.0.55] Excessive overdraw during the rendering of elevated rails.
[2.0.55] Excessive overdraw during the rendering of elevated rails.
Brought to you by a crappy pc...
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
Here is a collection of screenshots when an elevated track is being drawn with the full viewport visible.
This is while using the hd_age packsBrought to you by a crappy pc...
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
Looking at the drawing with just the base game, it seems there is a trim step missing from the texture loading during mods that isn't being processed to pack the textures or that the mod itself needs to properly trim the excess as this is the result for drawing elevated rails without the hd_age pack
Posted it to the creator on the mod discussion in case it is deemed to be a mod issue and not a processing step issue.Brought to you by a crappy pc...
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
I will throw this to Not a bug. Looking at the sprite cropping code, it fails to crop those sprites because in the bitmap data, first pixel has alpha value of 1/256th instead of being 0. That means it is a mod issue.
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
Hi, I am the author of the HD-Age mod.
In my image editing program, the alpha value is given in 8-bit from 0 to 255, and this value is 0 in the corresponding areas of the textures on the Alpha Channel. When transferred to the specification, 1/256 corresponds to this value. How is an alpha value of 0 defined in Factorio?
If the alpha channel is 0, then the RGB values are greater than 0 due to compression. Are these values also checked to be 0?
In my image editing program, the alpha value is given in 8-bit from 0 to 255, and this value is 0 in the corresponding areas of the textures on the Alpha Channel. When transferred to the specification, 1/256 corresponds to this value. How is an alpha value of 0 defined in Factorio?
If the alpha channel is 0, then the RGB values are greater than 0 due to compression. Are these values also checked to be 0?
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
I am not able to tell you exact details as i am not working with graphics, i just see code for cropping sprites takes uncompressed sprites in something that looks like ARGB_8888 format, and when cropping those sprites, most of the pixels at the beginning of bitmap data are correctly 0x00000000, but the first pixel (and i would guess possibly the last pixel) reports as being 0x01000000 which has a non transparent alpha value causing it to not crop. When i temporarily changed the cropping code to ignore lowest bit of alpha value the sprites were cropped in a way that looked "correct".Ingo-Igel wrote: Thu Jul 10, 2025 7:56 am Hi, I am the author of the HD-Age mod.
In my image editing program, the alpha value is given in 8-bit from 0 to 255, and this value is 0 in the corresponding areas of the textures on the Alpha Channel. When transferred to the specification, 1/256 corresponds to this value. How is an alpha value of 0 defined in Factorio?
If the alpha channel is 0, then the RGB values are greater than 0 due to compression. Are these values also checked to be 0?
Re: [2.0.55] Excessive overdraw during the rendering of elevated rails.
Looking at the PNGs - they have non-zero RGB pixels with an alpha value of zero. The game won't strip those out for different reasons.
If I batch go over every PNG in the mod and for each alpha-zero pixel set the entire thing to 0 (0 r, 0 g, 0 b, 0 a), the graphics engine will then crop all of those transparent pixels away.
If I batch go over every PNG in the mod and for each alpha-zero pixel set the entire thing to 0 (0 r, 0 g, 0 b, 0 a), the graphics engine will then crop all of those transparent pixels away.
If you want to get ahold of me I'm almost always on Discord.