GemParticles icon indicating copy to clipboard operation
GemParticles copied to clipboard

GPU Particles

Open frtru opened this issue 8 years ago • 9 comments
trafficstars

NOTE: As seen here https://github.com/amulware/genericgamedev-gpu-particles/tree/cpu-gpu-comparison/GenericGamedev.Pixelation The CPUSimpleParticles.cs, AlmostGPUParticles.cs and GPUParticles.cs demonstrate how you can completely render/update on the GPU.

List of things to do for this:

  • Need to add a call from app to particlesystem or something else
  • Maybe add renderers or entities that can iterate through all the pool particles and render and use the camera and add some special effects i guess
  • I need to provide minimal implementation in the shaders (take the matrices and multiply it with the vertex location)

SEE THIIIS http://stackoverflow.com/questions/8608844/resizing-point-sprites-based-on-distance-from-the-camera he uses a sampler2darray as a uniform, would it be possible that way?

COMPUTE SHADERS

frtru avatar Dec 02 '16 21:12 frtru

Copy from the commit comment : Added a really early version of the renderers. Basically, the scheme will be that the renderers will render an "effect" to the particles. For example, the stub one will be used for debugging purposes and will render red transparent squares. TBD: An higher driver-like class or "effect" as fenbf did might be needed to compose many types of renderers (e.g. explosions have many textures applied to particles)

frtru avatar Dec 07 '16 03:12 frtru

I need to finish the task for the camera in order to complete this one. I need to send the matrices to the shaders as well.

frtru avatar Dec 10 '16 22:12 frtru

Finall found out that the model matrix doesn't matter in our system because we update the vertices position directly. With a model loaded, it basically comes like a big array in which we don't want to modify the vertices individually and we give it a model matrix and forward that model matrix to the shaders.

frtru avatar Dec 18 '16 16:12 frtru

Just noticed that the issue I was attacking was because the MVP wasnt defined and it defaulted to 0 everywhere and when I multiplied it with the positions, it puts all the particles at 0,0,0....

frtru avatar Jan 27 '17 03:01 frtru

NEXT STEP : FIX MVP MATRIX

frtru avatar Jan 27 '17 04:01 frtru

NOTE: As seen here https://github.com/amulware/genericgamedev-gpu-particles/tree/cpu-gpu-comparison/GenericGamedev.Pixelation The CPUSimpleParticles.cs, AlmostGPUParticles.cs and GPUParticles.cs demonstrate how you can completely render/update on the GPU. Also see how fenbf does it.

frtru avatar Feb 05 '17 04:02 frtru

http://stackoverflow.com/questions/8608844/resizing-point-sprites-based-on-distance-from-the-camera

frtru avatar Feb 21 '17 04:02 frtru

https://www.khronos.org/assets/uploads/developers/library/2014-siggraph-bof/KITE-BOF_Aug14.pdf

frtru avatar Mar 08 '17 01:03 frtru

UPDATE:

  • Another method instead of using the geometry shader to create quads on the GPU, just send 4 vertices and us glDrawArraysInstanced to reuse the same vertices http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/particles-instancing/
  • On vulkan: https://arm-software.github.io/vulkan-sdk/basic_compute.html
  • Analyze https://github.com/amulware/genericgamedev-gpu-particles/tree/cpu-gpu-comparison/GenericGamedev.Pixelation to see what parts could be done on the GPU in a new ParticlySystem class
  • https://rochefusion.com/devlog/239/from-thousands-to-millions-of-particles
  • ** HONESTLY JUST FOLLOW THIS** http://web.engr.oregonstate.edu/~mjb/cs557/Handouts/compute.shader.1pp.pdf

frtru avatar Jul 06 '20 06:07 frtru