How to create new state texture for GPU particles?
I'm modifying the engine source for a project I'm doing, and I'm trying to work with GPU particles.
For GPU particles, there are two state textures used for particle simulation: PositionTexture and VelocityTexture. I'm trying to add another texture ColorTexture that will store and update color in the GPU simulation just like the position and velocity texture.
I thought I could just go through the code and mirror the operations on the PositionTexture or VelocityTexture, but that hasn't been working. The part I'm missing is the specific place in the code where the FNewParticle attributes are first written to texture.
asked Feb 09 '18 at 12:50 AM in C++ Programming
Have a look at this shader in the engine's installed location: Engine\Shaders\Private\ParticleGPUSpriteVertexFactory.ush
That is where you'd add your own texture and sampler and add in the gpu logic in that shader
This is a vertex factory shader. So you'll have a corresponding vertex factory class in C++. Have a look at FGPUSpriteVertexFactory under Engine\Source\Runtime\Engine\Private\Particles\ParticleGpuSimulation.cpp
This class takes in the references of the state textures (e.g. PositionTextureRHI, VelocityTextureRHI)
You set these textures from here: FGPUSpriteDynamicEmitterData::GetDynamicMeshElementsEmitter
answered Feb 09 '18 at 05:45 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here