Pixel Shader sending data to Vertex Shader // fscanf

Hi all,

We are on way to create a point cloud shader for the kinect. We using kinect depth map to get value of each pixel. Trying to do this, we stuck on some issue.
Is there any way to redirect values from the Pixel Shader to the Vertex Shader ? ( we know that there is no problem by doing that inverse way: from vertex shader to pixel shader using ‘in /out’ )
Or maybe is there another way to get the values from the color pixels with the index of each pixel.
Is there option for touchdesigner to use the function ‘fscnaf’ in GLSL code?
Or mayby is another way to debug the shader program result?
What about global variables - can we use the variable seted in root to the vertex or pixel shader ?

Maybe we miss something ???

We willl be glad for any help.

peace&love :wink:
Lukasz Furman

Hi Lukasz,

No, you can not direct values from the pixel shader to the vertex shader. However you can sample the depth map texture in the vertex shader, which will allow you to position points based on the depth values.
GLSL has no notions of files or strings, so fscanf doesn’t work here. What are you looking to do with it?

The way to debug GLSL is to write the values you want to inspect (to check for proper results) to the output color of the pixel shader. Use a 32-float pixel format and then use the TOP To CHOP node to inspect the values.

Uniforms are global variables that are visible in both the pixel shader vertex shader.

Let me know if this doesn’t answer your questions.

Hi Malcolm,

thanks for advice and fast reply.

I’m looking for type of variables in with can I set value inside pixel shader and then read inside vertex shader. what kind of uniform - sampler or another ?

best
Lukas

ok, we done , subject closed. :slight_smile:

How can we textured points ? (not surfaces-cloud of points)

best
Lukas

How it’s going with point cloud shader? Is it done?
I’ve seen implementation of this in vvvv, cinder and processing, so having a version for TD would be very nice :slight_smile: