Best way to manage custom particle rendering distance?

I’m working on a game with a cartoon-like color aesthetic, and one of the things I’ve done is make grass particles that are a solid color to emulate the grass effect in games such as Way To The Woods. However, one thing I noticed when testing is that on the lowest graphics settings, the particles don’t go out of view until I’m well beyond the point where I don’t need to see them anymore. I imagine that this is because if they weren’t the same color as the ground under them, they would need to stay visible for much longer.

Since I expect to use a lot of grass particles, I’m considering having a custom in-game setting that removes or disables them based on how far away they are from the camera. However, also because I expect to use a lot of them, many of my normal proximity tests I use for other things might cause major lag spikes when applied here. How should I go about handling this?

2 Likes

I’m interested in this too, but for a different kind of LOD system.

2 Likes

I’m not entirely sure what you mean by this? If you mean farther away you are the particles disappear? If so then you could always use RADIUS and make them disappear locally assuming your game is filtering enabled. (I’m not sure if this is the best way to do it though)

1 Like

That is what I was generally thinking, since my particles don’t need to be visible from as far away due to how I’m using them I want to make them disappear at a particular distance regardless of graphics settings. I’d use radius if that was an actual property of anything relevant to proximity detection.

Well radius isn’t a property but you can always just magnitude which you can then make work just like a radius detection would.

A bit more complicated solution, but maybe this works better if you have a lot of particle emitters.
Have your map separated into a grid of cells, and have a table that holds a reference to the emitters in each cell.
So as you travel through the map, you only need to A) Detect which cell you are in (or which cells should be visible around you) then B) look at the table for those cells, detecting the radius ( ((yourPosition - emitterPosition).Magnitude) ) . C) Turn on or off the emitter based on the radius check D) turn off ALL emitters in cells that are no longer in range.
This should allow you to only have to check emitters that are in close cells, without having to iterate through all of them. Hope that makes sense.

4 Likes

Something like that will fit in perfectly with how I’m setting up the world in my game already, so I’ll go with that. Thanks.

1 Like