Point Cloud for Kinect V2 (add shader to invert color)

edited February 2016 in Kinect

hi everyone , firstly i'm new with point cloud processing , and i've been working with kinect v2 processing from thomas sanchez lengeling from

http://codigogenerativo.com/code/kinectpv2-k4w2-processing-library/ .

the coding is already working , its just since im new with processing , i dont really know how to add the shader to invert the color . i wanted the background to be white while the point cloud is black , can anyone help me with this?

here's the coding

https://github.com/ThomasLengeling/KinectPV2/blob/master/KinectPV2/examples/PointCloudOGL/PointCloudOGL.pde

Tagged:

Answers

  • Answer ✓

    well this in the frag shader is setting the colour

    gl_FragColor = vec4(1, 1, 1, 1);
    

    which is white. making that black would just be

    gl_FragColor = vec4(0, 0, 0, 1);
    

    or perhaps

    gl_FragColor = vec4(1, 0, 0, 0);
    

    the shader uses a float from 0-1 rather than an int from 0-255. not sure which argument is the transparency hence the alternatives...

    setting the background colour is line 61 of the pde. use 255 for white.

  • Answer ✓

    ok,

    {r, g, b, a} Use when accessing vectors that represent colors

    so (0, 0, 0, 1)...

  • just replace the current line in frag shader with the new one.

    // gl_FragColor = vec4(1, 1, 1, 1); // white
    gl_FragColor = vec4(0, 0, 0, 1); // black
    
Sign In or Register to comment.