Light drawing: make 2 light sources interact with eachother

edited January 2018 in Library Questions

I'm new to processing and have been doing funprogramming.org light drawing tutorial (no. 150). Just wondering if it's possible to include a second light source, maybe a red and a white light, and have something happen when the 2 cross paths. Is this possible and how would I go about it? thanks in advance!

Answers

  • Should be. Hard to know without seeing a running example.

  • edited January 2018
    import processing.video.*;
    
    Capture cam;
    
    void setup() {
        size(320, 240);
        frameRate(30);
        background(0);
        String[] cameras = Capture.list();          
        cam = new Capture(this, 320, 240, cameras[0]);    
        cam.start();
    }
    
    void captureEvent(Capture cam) 
    {
      cam.read();
    }
    
    void draw()
    {
      image(cam, 0, 0);                      
      cam.loadPixels();      
      loadPixels();
      for(int i = 0; i < cam.pixels.length; i++)                                  
        {
        if(brightness(cam.pixels[i]) > 230)            
    
          {
           cam.pixels[i] = color(255);                  // makes it white [had to specify cam.pixels]
          }
        }
    
        updatePixels();          
    }
    
  • This is what I have so far, which isn't fully working either.. any help appreciated!

  • You don't need line 22. Line 29 should be pixels[i]=color(255);

    Can you tell us what is a light source in your concept?

    Kf

  • Thanks for the reply! I am thinking a small bright bike light or something similar, I'm getting it to pick up the brightest points (using phone light) now but I need to make the light 'draw' and for that to stay on screen

  • @ga77 -- once you are registering your traces, you might find this previous discussion useful for making your two traces interact:

    - https://forum.processing.org/two/discussion/comment/114960/#Comment_114960

  • Thanks for all the help!

Sign In or Register to comment.