Forum

DX11 particles - Custom Kinect emitter won't write my new variables to particle


#1

Hi all,

I want to add a emitter ID to my particles, so that my custom sprite shader is able to identify particles from different emitters and draw them accordingly in different sizes and colors.

I already did something similar with a dynamic buffer emitter, but I can’t get it to work with the kinect emitter. Does the kinect emitter work in a different way? Did I miss something?

kinectEmitter.zip (553.0 KB)


#2

a tip: mention which contribution you’re using and @-mention the creator of the contribution for best outreach.


#3

@tmp

p.emitterid = EmitterIdBuffer

won’t work, but

EmitterIdBuffer.GetDimensions(size,stride);
p.emitterid = EmitterIdBuffer[emitterCounter % size];

does work.

why does external data has to come through a dynamic buffer, and can’t be set through a simple int inlet within the shader? I throught dynamic buffers are just good for moving data between different shaders, so when there is a lot of data which I do not want to readback?

please explain your witchcraft, kind sir.


#4

p.emitterid = EmitterIdBuffer

this won’t work because p.emitterid expects a value and EmitterIdBuffer is a buffer of values

If you put there EmitterIdBuffer[index] it will work


#5

I had a look at your example. Everything works as expected. See here: kinectEmitter.zip (554.7 KB)


#6

@antokhio

sry I did not explain it well. initializing a variable (like uint eid= <string uiname=“Emitter ID”;> = 0;) and then writing its value to the particle (p.id = eid;) did not work. just by using a dynamicbuffer and writing its value I got it working.

@tmp

thx for looking into it. now my example does suprisingly work. with the same code that did not work before! I swear I sat there for 4 hours straight, trying to figure it out and then uploaded it. really strange.