Page 1 of 1

Questions/answers around "optimised particles", layers

Posted: Tue Feb 18, 2020 10:21 pm
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 3236 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.

Re: New optimised particles - shadows??

Posted: Tue Feb 18, 2020 10:40 pm
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)

Re: New optimised particles - shadows??

Posted: Tue Feb 18, 2020 10:57 pm
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?

Re: New optimised particles - shadows??

Posted: Tue Feb 18, 2020 11:03 pm
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.

Re: New optimised particles - shadows??

Posted: Tue Feb 18, 2020 11:07 pm
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.

Re: New optimised particles - shadows??

Posted: Tue Feb 18, 2020 11:11 pm
by Deadlock989
Sorted.

particleshadows.jpg
particleshadows.jpg (171.75 KiB) Viewed 3204 times

Re: New optimised particles - shadows??

Posted: Wed Feb 19, 2020 2:20 pm
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

Re: New optimised particles - shadows??

Posted: Wed Feb 19, 2020 2:29 pm
by Bilka
Image

Re: Questions about "optimised particles", layers

Posted: Wed Feb 19, 2020 7:21 pm
by orzelek
So we will need to have special base to be destroyed by biters to look at eye candy? :D

Re: Questions about "optimised particles", layers

Posted: Thu Feb 20, 2020 12:47 am
by Deadlock989
NOOOO NOT MY CIRCUITSSSSS
NO MY CIRCUITS NOOOOOOOO

Image

Re: Questions about "optimised particles", layers

Posted: Thu Feb 20, 2020 10:39 am
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)

Re: Questions about "optimised particles", layers

Posted: Thu Feb 20, 2020 10:48 am
by posila
nosports wrote: Thu Feb 20, 2020 10:39 amI 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.

Re: Questions about "optimised particles", layers

Posted: Thu Feb 20, 2020 10:54 am
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?

Re: Questions about "optimised particles", layers

Posted: Thu Feb 20, 2020 1:34 pm
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:

Re: Questions about "optimised particles", layers

Posted: Fri Mar 06, 2020 11:46 pm
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?

Re: Questions about "optimised particles", layers

Posted: Sat Mar 07, 2020 7:57 pm
by Deadlock989
Deadlock989 wrote: Fri Mar 06, 2020 11:46 pmIs 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.)