I’ve written some code to read in scan data and assign the position and color information to a particle system that uses cpu sprites. The only thing in my file is the particle system and I don’t have any lighting or motion so it renders pretty fast even with close to 80,000 pts. It spawns slow enough I can see it as it builds and when it gets about %70 finished it starts hiding the first points that it rendered so I end up with a model that’s missing the first %30 of the data. GetNumActiveParticles() returns all ~80,000 particles but not all are rendering. I increased the cpu sprite limit to over 100,000 and set the Max Draw Count to that as well. Is there something else I can do to force a render of every particle?
Hi there,
CPU sprites are limited to the processing power of the CPU as well as any other CPU actions occurring at the same time as the CPU particle system is being rendered. For this reason the actual limit will vary. The Max Draw Count is just a number set to the maximum allowed particle count instead of the number of particles that can actually be rendered. Once the limit is reached the emitter will stop emitting particles, there is not much you can do once this happens.
Is there any particular reason you need to use CPU sprites? Switching to a GPU sprite type-data will allow much more efficient rendering of the particle system, will likely increase your framerate, and it allows much higher numbers at the same time. All you need to do is right click on the emitter and select “TypeData” then choose “New GPU Sprites”. So long as all of the emitter parameters can be used with GPU sprites it should be all you need to do. If any come up with an error, right click to see if there is an equivalent module available and transfer over the parameter values.
If there is no particular reason to use CPU sprites, I would recommend switching it over to GPU. Hope that helps!
Thanks for the response. I need each particle to have it’s own color so I’m stuck with CPU. I can add a copy of my particles or run on another computer and they all render the same so it doesn’t seem to be a hardware issue.
I can get the particles to render if I split them up among multiple emitters. It seems as though there is a limit per emitter. Does anyone know if this is hard-coded somewhere?
This question is not resolved. I would rather use GPU particles but cannot because of the initial color.
Hey jlueck -
Assuming that you have the code setup already could you not use the Color Over Life module and use the Vector Particle Parameters and set a constant color and alpha values which can be set in a Blueprint or Code then you could use the GPU particles.
Thank You
Eric Ketchum
Thanks for the response Erik. Would this allow me to assign a specific color for each particle?
Ah, no my apologies I misread the expectation. I can get you close to what you want though. This material uses Particle Relative Time which always each particle to have a slight offset run through the color gradient (Red Texture is a color gradient from red to Violet). You could dig into the code to see the per particle call which would allow you to set your color call as you want. We do have a report of the GPU Initial Color Behavior in to our engineers.
Thank You
Eric Ketchum
Thanks Eric. I’ll give it a shot.
I have been using a custom location module to place my particles and it works fine for CPU particles but as soon as I use GPU Sprites they are only spawned at the emitter. Can I assign specific locations to GPU particles in code?
Hello,
For CPU particle simulaiton, there’s a console variable that restricts the number; this is primarly to avoid issues like applications becoming near unresponsive when, due to events like collisions, or other not directly controlled circumstances, the spawnrate balloons and tons of particles get spawned suddenly.
You can change this cvar by using “FX.MaxCPUParticlesPerEmitter=n”, n being your desired limit, in the console (which you can bring up with the `~ key) in both the editor and the running game. Once you find a limit that works for you, you can make it permanent for Windows PC by adding
+CVars=FX.MaxCPUParticlesPerEmitter=n
to Config/BaseDeviceProfiles.ini under the [Windows DeviceProfile] section, or other sections matching your desired device.
Please let us know if that works for you!
Thanks,
I was able to get a grayscale version working by setting particle size to determine a grayscale value.
I believe all my particles are being spawned but I still can’t get them to draw. If I spawn slow enough I can see them all get drawn but at a certain number it begins removing previously drawn particles every time it draws a new one. My frame rate still takes a hit during this process as if it is drawing them all. Changing MaxCPUParticlesPerEmitter has no effect on that.
Its “FX.MaxCPUParticlesPerEmitter 5555” instead of “FX.MaxCPUParticlesPerEmitter=5555”. No =, atleast when typed in the console.