Command Buffer and Particle System Renderers

I have a particle system that I render using a Command Buffer instead of the default pipeline. It works fine if the Renderer Module > Render Mode value is set to Billboard, but when I set it to “Stretched Billboard”, no matter what I set the 3 scaling values to, nothing gets rendered. The other render modes work as expected.

2994563--223040--upload_2017-3-15_11-58-22.png

Update:

The Frame debugger is reporting that there is indeed geometry being sent to the graphics card, but still, nothing is showing up, it’s as if there are no fragments being generated or all the vertices are off screen or something.


Nevermind, user error (specifically ID-Ten-T), it works as expected now.

1 Like

How do you use CommandBuffer to render particle?

You can feed any renderer into the Command Buffer. At run-time, when you set up your command buffter, you could do something like this:

public ParticleSystem ps;
private CommandBuffer buffer;

...

buffer.DrawRenderer(ps.renderer, ps.renderer.material);

How do you render it if there are trails? Does not seem to work, even if you do a separate render with the trail material.

Set the submesh index parameter to 1. Sorry it’s not obvious :frowning:

It works! Amazing and thanks so much for responding. Might be lovely to add a snippet to the particle system renderer documentation. Here is what I am doing for meteor showers. They draw after my custom sky, sun and moons but before my clouds, all in a giant command buffer :slight_smile:

CommandBuffer.DrawRenderer(meteorParticlesRenderer, meteorParticlesRenderer.material, 0, 0);
CommandBuffer.DrawRenderer(meteorParticlesRenderer, meteorParticlesRenderer.trailMaterial, 1, 0);

1 Like