Forum

Adding Colour to the GPU Partical System

I’m trying to get particle colour into the GPU particle example. I’ve added

ParticleStructPos4Vel4
{
struct ParticlePos4Vel4
{
float4 Pos;
float4 Vel;
float4 pCol;
};
};
And updated the sim and draw shaders. But Draw is red as I can;t remember how to use stream I think?
I’m trying stream float4 pointColor ; Do I need to add it to a struct somewhere too? If so where?
Thanks

Particles.zip (15.6 KB)

it is all correct, you just have to decide whether you want to use American or English spelling of color. :)

your stream variable definition is American float4 pointColor and when you use it, it looks English streams.ColorTarget = Col * streams.pointColour;.

Edit: you also have to adapt the element size of the particle buffer. it should be 48 if you add another float4.

image

Thanks! I actually remade it after it failed the first time, hence thinking it was my lack of memory, instead of my dyslexia!