[posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

This subforum contains all the issues which we already resolved.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

[posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Deadlock989 »

As a result of this bug report and Twinsen's fix, the behaviour of the pipe_pictures specified in the fluid boxes of storage tanks is much improved in .67, i.e. the sprite segments now appear as expected and can be re-used across different types of entity - thanks for that.

There is something off with layers / render order, though. The pipe_pictures and pipe_covers interact poorly, being rendered on top of each other in a different order depending on location, entity orientation and zoom level:

Zoom level 2
Image

Some other zoom level
Image

If the stars align in the right way then every affected machine on the screen flickers back and forth when you highlight any one of them:
Image

It makes me think of z-fighting. I have seen something like this before in Factorio but I can't put my finger on the bug report. In that case it was some odd interaction between pipes, base layers and working_animations, due to them being on the same render layers, and I think the fix was some kind of internal microtweak to rendering order. If I find it I'll post the link. (Edited to add, I think it was this one, although fluid boxes weren't directly involved there.)

This is a minor issue in a sense because it can be worked around by baking the pipe_picture images into the base sprite itself. It's just that this means a completely different graphics workflow to other kinds of entity, even if the component bits of sprite are all identical and the different types of machine share some of their visual design.
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [Posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

I've seen this a number of times when applying pipe connections to entities. But I've not had my shit together enough to post a proper bug report, and I noticed if I try to just get you all to trust me, it doesn't work well. :P Really glad to see this being brought up. I'm going to try to put together examples to contribute. There's another issue that I think is related, too, where not only the pipe covers and pipe pictures are racing eachother, but I think pipe pictures are also racing at least working_visualizations, and possibly idle animations, I'm still trying to figure out exactly when it applies: it shows up when you try to apply the assembler type 3 pipe pictures to a copy of the centrifuge entity. Sometimes you can get the pipe pictures to show above the entity animations, sometimes not, and like this issue between the pipe covers and pictures, it depends on where you're standing.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5286
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Klonan »

Deadlock989 wrote: Tue Sep 03, 2019 2:08 pm As a result of this bug report and Twinsen's fix, the behaviour of the pipe_pictures specified in the fluid boxes of storage tanks is much improved in .67, i.e. the sprite segments now appear as expected and can be re-used across different types of entity - thanks for that.
Can you provide a mod or save file that reproduces the issue?
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by posila »

I am quite torn about this. Pipe connector being baked in the entity sprite is prefered way, and pipe_picture was originally intended only for dynamic pipe connector on assembling machines and I don't like that storage-tank was changed to render them also. On the other hand, I do see value in being able to overlay standard pipe sprite by an entity sprite - like we did with flamethrower turret - that ability can simplify making sprites for pipe connectable a lot, so I'll leave it be.

What Adamo posted is a real issue, though. So for 0.17.68 I'll make following change hoping nothing is going to get screwed up by it.
I'll change pipe_cover secondary draw order from 1 (resp. -1) to 64 (resp. -64) ... 64 is for covers drawn "in front of" entity, -64 is for behind. Entity sprite is drawn with secondary draw order 0. Working visualizations are drawn with secondary draw order 3*i + 10. For adjusting how pipe_picture should be layered with entity sprite and working visualizations, use secondary_draw_order/secondary_draw_orders
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

posila wrote: Wed Sep 04, 2019 9:28 am
Thanks, posila. I've been fussing around with the secondary_draw_orders to try to get things to layer right, so once 68 hits, I'll take a look how this changes things and report back.
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

The following application of pipe pictures and covers to the centrifuge had been confirmed to give the same effect as demonstrated in Deadlock's pictures. In version 68, this now renders properly. Thanks.

Code: Select all

data.raw["assembling-machine"].centrifuge.fluid_boxes = {{
		production_type = "input",
		base_area = 10,
		base_level = -1,
		height = 1,
		pipe_picture = assembler3pipepictures(),
		pipe_covers = centrifugepipecovers(),
		pipe_connections = {{
				position = {
					0,
					2
				},
		}},
		secondary_draw_orders = {
			north = -64,
			west = -64,
			east = -64,
			south = 4
		}
	},{
		production_type = "output",
		base_area = 10,
		base_level = 1,
		height = 1,
		pipe_picture = assembler3pipepictures(),
		pipe_covers = centrifugepipecovers(),
		pipe_connections = {{
				position = {
					-0,
					-2
				},
		}},
		secondary_draw_orders = {
			north = -64,
			west = -64,
			east = -64,
			south = 4
		}
	},{
		production_type = "input",
		base_area = 10,
		base_level = -1,
		height = 1,
		pipe_picture = assembler3pipepictures(),
		pipe_covers = centrifugepipecovers(),
		pipe_connections = {{
				position = {
					2,
					0
				},
		}},
		secondary_draw_orders = {
			north = -64,
			west = -64,
			east = -64,
			south = 4
		}
	},{
		production_type = "input",
		base_area = 10,
		base_level = -1,
		height = 1,
		pipe_picture = assembler3pipepictures(),
		pipe_covers = centrifugepipecovers(),
		pipe_connections = {{
				position = {
					-2,
					-0
				},
		}},
		secondary_draw_orders = {
			north = -64,
			west = -64,
			east = -64,
			south = 4
		},
	},
	off_when_no_fluid_recipe = true
}
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by posila »

You are making north = -64, west = -64, east = -64? Shouldn't -1 be enough? Or is it still supposed to be under the cover?
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

posila wrote: Wed Sep 04, 2019 5:56 pm You are making north = -64, west = -64, east = -64? Shouldn't -1 be enough? Or is it still supposed to be under the cover?
-1 was not enough, originally. It may be enough now. I set -64 after seeing that -1 did not work, and I probably tried -2, but for all I know, -3 would have been enough. I probably tried -1, didn't work, -2, still in front of some stuff, -64, worked, moved on. I was mostly just concerned with the southern one, which should be rendered above the rest of the entity's layers. I could try to increase the (negative) number to see where it cuts off.

The goal with all but the south pipe would be for the pipe picture to render under everything, yes.
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by posila »

Adamo wrote: Wed Sep 04, 2019 5:58 pm
posila wrote: Wed Sep 04, 2019 5:56 pm You are making north = -64, west = -64, east = -64? Shouldn't -1 be enough? Or is it still supposed to be under the cover?
-1 was not enough, originally. It may be enough now. I set -64 after seeing that -1 did not work, and I probably tried -2, but for all I know, -3 would have been enough. I probably tried -1, didn't work, -2, still in front of some stuff, -64, worked, moved on. I was mostly just concerned with the southern one, which should be rendered above the rest of the entity's layers. I could try to increase the (negative) number to see where it cuts off.

The goal with all but the south pipe would be for the pipe picture to render under everything, yes.
I am concerned now that -64 for back covers is too much ... but vanilla entities look correct to me.
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

I've been paying close attention to pipe pictures, as apparently has Deadlock. I have an interview this afternoon, but I'll run through my demo later tonight, and will be sure to report any issues if I come upon them. I have a few entities with a few different configurations, that should cover at least a few different cases. Not all cases, though. Thanks for the help.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Deadlock989 »

Adamo wrote: Wed Sep 04, 2019 6:02 pm I've been paying close attention to pipe pictures, as apparently has Deadlock.
They are the bane of my life. Everything about pipes is difficult.
Adamo
Filter Inserter
Filter Inserter
Posts: 481
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: [posila] [0.17.67] Sort of "z-fighting" shenanigans between pipe_pictures and pipe_covers on modded storage tanks

Post by Adamo »

Deadlock989 wrote: Wed Sep 04, 2019 6:09 pm
Adamo wrote: Wed Sep 04, 2019 6:02 pm I've been paying close attention to pipe pictures, as apparently has Deadlock.
They are the bane of my life. Everything about pipes is difficult.
My next step, now that Adamo Chemical is finalized and soon-to-be-released, is to make a fluid-powered furnace that also accepts fluid ingredients and results. We'll see how far I can push that. ;) Did you see how I did the gasifier? My right-hand man called it "an abuse of the fuel system, but terribly clever."
Post Reply

Return to “Resolved Problems and Bugs”