Questions/answers around "optimised particles", layers

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Questions/answers around "optimised particles", layers

Post by Deadlock989 »

So - having an inordinate amount of fun blowing things up and then having them scatter tiny pieces everywhere. The new particle system is loads of fun.

This is getting to really silly levels of OCD now - but I can't decide whether this is a minor bug or I'm just doing it wrong. And there's no docs for optimised particles yet ...

I'm convinced that the shadows are drawn on top of the particles when they come to rest on the ground:

particleshadows.jpg
particleshadows.jpg (425.02 KiB) Viewed 2156 times
I've searched through the base mod's Lua and couldn't find many particles that are using shadows. Mostly they are mining particles and stuff related to trees - stuff that doesn't rest on the ground for long anyway.

I'm defining the particles like this:

Code: Select all

    {
        name = "bronze-particle",
        type = "optimized-particle",
        life_time = 1800,
        movement_modifier_when_on_ground = 0,
        pictures = {
            sheet = {
                filename = DIR.particles_path.."/bronze-particle.png",
                frame_count = 64,
                line_length = 64,
                height = 16,
                width = 16,
                scale = 0.5,
                variation_count = 4,
            }
        },
        shadows = {
            sheet = {
                filename = DIR.particles_path.."/shadow-particle.png",
                frame_count = 64,
                line_length = 64,
                height = 16,
                width = 32,
                scale = 0.5,
                variation_count = 4,
		shift = {2/32,1/32},
		tint = {a=0.5},
            }
        },
        render_layer = "air-object",
        render_layer_when_on_ground = "corpse",
    },
Instead of the tint, I also tried draw_as_shadow - it has exactly the same effect, where the "shadow" seems to be drawn on top of the "pictures".

Is it because the render_layer_when_on_ground specified is setting both the pictures and the shadow to the same layer?

Anyone have any insights? I mean it's pixel-level shiz but I like things to be right.
Last edited by Deadlock989 on Sat Mar 07, 2020 8:04 pm, edited 2 times in total.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: New optimised particles - shadows??

Post by posila »

Shadows are indeed drawn over the particles because corpse render layer is under shadows.

Code: Select all

water-tile
ground-tile
tile-transition
decals
transport-belt-integration
resource
building-smoke
decorative
ground-patch
ground-patch-higher
ground-patch-higher2
remnants
floor
transport-belt
transport-belt-endings
transport-belt-circuit-connector
floor-mechanics-under-corpse
corpse
floor-mechanics
item
lower-object

-- shadow composition happens here --

lower-object-above-shadow
object
higher-object-above
higher-object-under
item-in-inserter-hand
wires
wires-above
lower-radius-visualization
radius-visualization
entity-info-icon
entity-info-icon-above
explosion
projectile
smoke
air-object
air-entity-info-icon
light-effect
selection-box
higher-selection-box
collision-selection-box
arrow
cursor
It came up when artists were doing new dying explosion effects, but in the end we decided to keep particles on ground in corpse layer - to make them dim when they hit the ground.

(This is how it was before 0.18 too)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: New optimised particles - shadows??

Post by Deadlock989 »

Doh. Of course corpse is below shadows. Thanks.

So turret bases are lower-object? Any chance they could be lower-object-above-shadow?
Image

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: New optimised particles - shadows??

Post by posila »

I believe vanilla turret bases are under shadows so that turret gun can cast its shadow on it without base having to be part of the turret rotation animation. (But I am not sure that's the real reason why it is the way it is)

There is TurretPrototype::base_picture_render_layer, in case that's of use to you and didn't know about it.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: New optimised particles - shadows??

Post by Deadlock989 »

posila wrote:
Tue Feb 18, 2020 11:03 pm
I believe vanilla turret bases are under shadows so that turret gun can cast its shadow on it without base having to be part of the turret rotation animation. (But I am not sure that's the real reason why it is the way it is)
Maybe at one point? But the bases look like they have a "soft" shadow baked into the render. That's how I've been doing it too ...
There is TurretPrototype::base_picture_render_layer, in case that's of use to you and didn't know about it.
Argh, how did I miss that.

Thanks again.
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: New optimised particles - shadows??

Post by Deadlock989 »

Sorted.

particleshadows.jpg
particleshadows.jpg (171.75 KiB) Viewed 2124 times
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: New optimised particles - shadows??

Post by Deadlock989 »

Automated shrapnel and boom generation. If the recipe to make the item that places the entity only has wood and stone in it, the particles are wood-like and stone-like. If it's made of steel and glass, the particles are steel-like and glass-like - and in the right proportions too. Change the recipe, the damage and explosion effects change automatically. Make a new entity, don't have to bother setting up its effects. Pretty chuffed.

Image
Image

Bilka
Factorio Staff
Factorio Staff
Posts: 3169
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: New optimised particles - shadows??

Post by Bilka »

Image
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Questions about "optimised particles", layers

Post by orzelek »

So we will need to have special base to be destroyed by biters to look at eye candy? :D

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Questions about "optimised particles", layers

Post by Deadlock989 »

NOOOO NOT MY CIRCUITSSSSS
NO MY CIRCUITS NOOOOOOOO

Image
Image

nosports
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

Re: Questions about "optimised particles", layers

Post by nosports »

hell thats a sight :P

I would suggest that its possible to gater some of these back (either useable and/or as scrap)

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Questions about "optimised particles", layers

Post by posila »

nosports wrote:
Thu Feb 20, 2020 10:39 am
I would suggest that its possible to gater some of these back (either useable and/or as scrap
I think it leaves some item entities on ground also.

Good job on making nice effects within Factorio's constrained systems and non-existent tools.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Questions about "optimised particles", layers

Post by Deadlock989 »

nosports wrote:
Thu Feb 20, 2020 10:39 am
hell thats a sight :P

I would suggest that its possible to gater some of these back (either useable and/or as scrap)
This is running as a byproduct of the scrapping system already in IR, you can see the loot in the top picture in the middle of the remnants - since the system already went to some trouble to determine the material composition of every recipe it could find so that it could generate the loot tables for machine entities, I realised I could use that data for the particle effects as well. (It also picks some crafting tints for certain recipes using it.)

Now if only I can stop wooden chests exploding in a fireball of wooden shards, Michael Bay style ... Use smoke instead of fire for things without an energy source?
Image

nosports
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

Re: Questions about "optimised particles", layers

Post by nosports »

Deadlock989 wrote:
Thu Feb 20, 2020 10:54 am
Now if only I can stop wooden chests exploding in a fireball of wooden shards, Michael Bay style ... Use smoke instead of fire for things without an energy source?
Thats a disappointment, the factorian style if moar so they need to have a mushroom cloud nonetheless :lol:

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Questions about "optimised particles", layers

Post by Deadlock989 »

Following the issues with the "blood fountains" you got from the combo of fire stickers and damaged_trigger_effects creating particles mentioned in https://factorio.com/blog/post/fff-335.

I think I found another case: vehicles revving into buildings at point blank range.

In vanilla, if you continuously throttle into an obstacle, you get this:

Image

Not great, but not the end of the world.

But in a modded situation, what otherwise results in nice subtle damage impact effects for everything else (spitter spit, biter bites, bullets etc.) results in this for vehicles accelerating into obstacles:

Image


So it looks like the same "small damage every tick" issue. Is there any way to limit the particles produced by damaged_trigger_effect? In the FFF, the solution for fire stickers was to change the way damage is applied. I guess modders can't do that themselves for vehicle impacts?
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Questions about "optimised particles", layers

Post by Deadlock989 »

Deadlock989 wrote:
Fri Mar 06, 2020 11:46 pm
Is there any way to limit the particles produced by damaged_trigger_effect? In the FFF, the solution for fire stickers was to change the way damage is applied. I guess modders can't do that themselves for vehicle impacts?
Turns out you can, with the new damage effect filters. If you add

Code: Select all

damage_type_filters = {"fire","impact"}
to your damaged_trigger_effect particle creations, then you will avoid fountains of them occurring when things are burning or hit by vehicles. "Impact" damage is only used by vehicle impacts as far as I can tell, so the particles still spawn on biter bites, bullets etc., which are "physical".

(Whether or not vehicles should be taking any damage at all if they try and move into buildings at point blank range is another issue.)
Image

Post Reply

Return to “Modding help”