<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with ambientlight() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=ambientlight%28%29</link>
      <pubDate>Sun, 08 Aug 2021 17:52:44 +0000</pubDate>
         <description>Tagged with ambientlight() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedambientlight%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Help with spheres bouncing off each other</title>
      <link>https://forum.processing.org/two/discussion/27948/help-with-spheres-bouncing-off-each-other</link>
      <pubDate>Wed, 09 May 2018 21:26:56 +0000</pubDate>
      <dc:creator>Mojo</dc:creator>
      <guid isPermaLink="false">27948@/two/discussions</guid>
      <description><![CDATA[<p>Hey everyone, 
I created this sketch for a bunch of emojis orbiting around one emoji and I am trying to make them bounce off each other when they touch, can someone please help me on how to do that?
Here is the code I am using:</p>

<pre><code>// importing the Peasy Cam library
import peasy.*;
import peasy.org.apache.commons.math.*;
import peasy.org.apache.commons.math.geometry.*;

// declaring the main emoji
Planet sun;
//declairing the Peasy Cam 
PeasyCam cam;
// declaring the PImage function
PImage img;
// declairing the the texture
PImage[] textures = new PImage[7];
// declaring the particle system

void setup() {

  size(displayWidth, displayHeight, P3D);


  img = loadImage("1.jpg");
  textures[0]= loadImage("2.jpg");
  textures[1]= loadImage("3.jpg");
  textures[2]= loadImage("4.jpg");
  textures[3]= loadImage("5.jpg");
  textures[4]= loadImage("6.jpg");
  textures[5]= loadImage("7.jpg");
  cam = new PeasyCam(this, 500);
  sun = new Planet (100, 0, 0, img);
  sun.spawnMoons(10, 4);
}

void draw() {

  background(0);
  lights();
  ambientLight(129, 62, 0);
  //translate(displayWidth, displayHeight);
  noFill();
  stroke(255);
  strokeWeight(1);
  //rotateY(frameCount/200.0);
  box(4000);

  lights();
  ambientLight(129, 62, 0);
  directionalLight(51, 102, 126, 0, -1, 0);
  spotLight(255, 0, 0, width/2, height/2, 400, 0, 0, -1, PI/4, 2);

  sun.show();
  sun.orbit();
}

class Planet {
  float radius;
  float angle;
  float distance;
  Planet [] planets;
  float orbitSpeed;
  PVector v;
  PShape globe;
  float mass=1;


  Planet(float r, float d, float o, PImage img ) {
    v = PVector. random3D();
    radius = r;
    angle = random(20);
    distance= d;
    v.mult(distance);
    orbitSpeed = o;

    noStroke();
    noFill();
    globe = createShape(SPHERE, radius);
    globe.setTexture(img);
  }
  void spawnMoons(int total, int level) {
    planets = new Planet[total];
    for (int  i = 0; i&lt;planets.length; i++) {

      float r= random(level*10);

      float d = random(100, 1000);

      float o = random (-0.01, 0.02);

      int index = int(random (textures.length));
      planets[i]= new Planet (r, d, o, textures[index]);

      if (level&lt;1) {
        int num = int(random(0, 5));
        planets[i].spawnMoons(num, level+1);
      }
    }
  }

  void orbit() {
    angle =  angle + orbitSpeed/mass;
    if (planets !=null) {
      for (int  i = 0; i&lt;planets.length; i++) {
        planets[i].orbit();
      }
    }
  }
  void show() {
    pushMatrix();
    noStroke();
    PVector v2 = new PVector(1, 0, 1);
    PVector p = v.cross(v2);
    rotate (angle, p.x, p.y, p.z);

    translate(v.x, v.y, v.z);
    shape(globe);
    if (planets !=null) {
      for (int  i = 0; i&lt;planets.length; i++) {
        planets[i].show();
      }
    }
    popMatrix();
  }
  void bounce() {
  }
}
</code></pre>

<p>I would really appreciate your help
Thanks</p>
]]></description>
   </item>
   <item>
      <title>Trying to leave a trail</title>
      <link>https://forum.processing.org/two/discussion/27639/trying-to-leave-a-trail</link>
      <pubDate>Mon, 02 Apr 2018 07:03:02 +0000</pubDate>
      <dc:creator>oydis</dc:creator>
      <guid isPermaLink="false">27639@/two/discussions</guid>
      <description><![CDATA[<p>Hello, 
im very new to programming and i'm trying to leave a trail on these ellipses that i have. 
I've watched a few videos but i can't seem to get it down.</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/974/L7Q5B2MOWADM.png" alt="Screen Shot 2018-04-02 at 5.01.49 PM" title="Screen Shot 2018-04-02 at 5.01.49 PM" /></p>
]]></description>
   </item>
   <item>
      <title>Solar System in Processing - Part 4 (Light?)</title>
      <link>https://forum.processing.org/two/discussion/26622/solar-system-in-processing-part-4-light</link>
      <pubDate>Sat, 03 Mar 2018 10:42:23 +0000</pubDate>
      <dc:creator>sa002999</dc:creator>
      <guid isPermaLink="false">26622@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone,</p>

<p>I had recently viewed this video:
<a rel="nofollow" href="https://www.youtube.com/watch?v=FGAwi7wpU8c&amp;index=9&amp;list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH&amp;t=0s">Coding Challenge #9: Solar System in Processing - Part 3 (3D textures)</a></p>

<p>At 10:30s of this video, shiffman wants to create a effect like sunlight using pointLight at the position same as the sun sphere. The sun effect is done, but sun itself is darken. An there is no next video about Solar System in Processing which gives a solution. Can anybody help me how to create a sunlight effect?</p>

<p>Source code about this video:
<a href="https://github.com/CodingTrain/website/tree/master/CodingChallenges/CC_09_SolarSystemGenerator3D_texture" target="_blank" rel="nofollow">https://github.com/CodingTrain/website/tree/master/CodingChallenges/CC_09_SolarSystemGenerator3D_texture</a></p>

<p>pointLight inside the sun:
<img src="https://forum.processing.org/two/uploads/imageupload/733/4U3ABVOFBTEF.png" alt="solar system_01" title="solar system_01" /></p>

<p>pointLight inside the sun + ambientLight: (not perfect effect):
<img src="https://forum.processing.org/two/uploads/imageupload/152/TXQZ0US22RK0.png" alt="solar system_02" title="solar system_02" /></p>
]]></description>
   </item>
   <item>
      <title>lights and Shapes3D library</title>
      <link>https://forum.processing.org/two/discussion/25211/lights-and-shapes3d-library</link>
      <pubDate>Sun, 26 Nov 2017 17:27:26 +0000</pubDate>
      <dc:creator>GLV</dc:creator>
      <guid isPermaLink="false">25211@/two/discussions</guid>
      <description><![CDATA[<p>lights() adds light to the opposite side expected on the tubes I create with shapes3D.
The box and sphere have the expected light.</p>

<p>If I add scale(-1, 1, 1); to the tubes, the light appears correct except for the end caps (you must observe each end cap to see this).</p>

<p>Can someone please help with this? <a href="/two/profile/quark">@quark</a></p>

<p><a rel="nofollow" href="http://lagers.org.uk/s3d4p/index.html">lagers.org.uk/s3d4p/index.html</a></p>

<pre><code>// Requires the Shapes3D library.

import shapes3d.utils.*;
import shapes3d.animation.*;
import shapes3d.*;

Tube tube02;
Tube tube01;

float angleX, angleY, angleZ;

void setup() 
  {
  size(1000, 1000, P3D);

  tube01 = new Tube(this, 4, 50);
  tube01.setSize(50, 50, 50, 50, 400);
  tube01.fill(color(255, 255, 0));
//  tube01.fill(#FFFF00, S3D.BOTH_CAP);
  tube01.drawMode(S3D.SOLID);
  tube01.visible(false, S3D.BOTH_CAP);

  tube02 = new Tube(this, 4, 50);
  tube02.setSize(50, 50, 50, 50, 400);
  tube02.fill(color(255, 255, 0));
  tube02.fill(#FFFF00, S3D.BOTH_CAP);
  tube02.drawMode(S3D.SOLID);
  tube02.visible(true, S3D.BOTH_CAP);
  }

void draw() 
  {
  background(0);    
  //  scale(1, 1, 1);
  translate(width/2, height/2);
  //  lights();
  ambientLight(128, 128, 128);                  //default
  //  directionalLight(128, 128, 128, 0, 0, -1);    //default
  directionalLight(128, 128, 128, -1, 0, 0);    //custom
  lightFalloff(1, 0, 0);                        //default 
  lightSpecular(0, 0, 0);                       //default

//  translate(width/2, height/2);

  pushMatrix();  
  noStroke();
  strokeWeight(0);
  fill(color(255, 255, 0));
  angleX += PI/1000;
  angleY += PI/1000;
  angleZ += PI/1000;
  rotateX(angleX);
  rotateY(angleY);
  rotateZ(angleZ);

  pushMatrix();
  translate(-300,0, 0);
  fill(255, 255, 0);
  sphere(50); 
  popMatrix();

  pushMatrix();
  translate(300, 0, 0);
  fill(255, 255, 0);
  box(100, 400, 100);  
  popMatrix();

  pushMatrix();
  translate(100, 0, 0);
//  scale(-1, 1, 1);
  tube01.draw();
  popMatrix();

  pushMatrix();
  translate(-100, 0, 0);
//  scale(-1, 1, 1);
  tube02.draw();
  popMatrix(); 
  popMatrix();
  } 
</code></pre>
]]></description>
   </item>
   <item>
      <title>set the dark color when using light falloff.</title>
      <link>https://forum.processing.org/two/discussion/23929/set-the-dark-color-when-using-light-falloff</link>
      <pubDate>Sat, 26 Aug 2017 02:00:18 +0000</pubDate>
      <dc:creator>Abotics99</dc:creator>
      <guid isPermaLink="false">23929@/two/discussions</guid>
      <description><![CDATA[<p>hi there, I'm currently working on a 3d game in processing 3.  I am trying to use an ambient light at the camera position and light falloff to fake a fog falloff effect. it's working great except I want to be able to set the color of the "fog" instead of the world just fading off into infinite darkness. I'm not trying to make a horror game just trying to hide object culling. Is there something I'm missing?</p>
]]></description>
   </item>
   <item>
      <title>How can I optimize Box drawing ?</title>
      <link>https://forum.processing.org/two/discussion/23220/how-can-i-optimize-box-drawing</link>
      <pubDate>Mon, 26 Jun 2017 22:13:07 +0000</pubDate>
      <dc:creator>Nath7009</dc:creator>
      <guid isPermaLink="false">23220@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I've tried to make a program that shows a 2D image in 3D, using the brightness of each pixel. So I draw a box at each x and y, the z is the birghtness. Unfortunately, the only way I've found to see the image is to draw boxes in draw(), but it gets really slow for images bigger than 400*400. I think that there are ways to make that better, so how can I do it ?</p>

<p>Code :</p>

<pre><code>import peasy.*;
import peasy.org.apache.commons.math.*;
import peasy.org.apache.commons.math.geometry.*;
PeasyCam camera;
PImage img;

void setup() {
  size(800, 800, P3D);
  ambientLight(255, 255, 255, 0, 0, 0);
  img = loadImage("download.jpg");
  camera = new PeasyCam(this, img.width/2, img.height/2, 0, 1000);
  img.loadPixels();
}
void draw() {
  background(0);
  for (int i=0; i&lt;img.pixels.length; i++) {
    color c = img.pixels[i];
    float b = map(brightness(c), 0, 255, -100, 100);
    fill(c);
    noStroke();
    int x = i%(img.width);
    int y = (i-x)/img.width;
    translate(x, y, b);
    box(1);
    translate(-x, -y, -b);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Drawing the human silhouette with bezier</title>
      <link>https://forum.processing.org/two/discussion/18544/drawing-the-human-silhouette-with-bezier</link>
      <pubDate>Fri, 14 Oct 2016 18:00:46 +0000</pubDate>
      <dc:creator>Jose_Aparecido</dc:creator>
      <guid isPermaLink="false">18544@/two/discussions</guid>
      <description><![CDATA[<p>Hello guys,</p>

<p>Sorry but I will try to ask something complicated again ... (laughs) ...</p>

<p>Below are two code snippets in the first example has a "silhouette" human, designed with bezier, the example I took in OpenProcessing.</p>

<p>Then there is another code, which like to do something similar, ie have the outline of the human body, but only in 3D, with proscene library could to facilitate rotacionamento, I got an example here in the forum.</p>

<p>Someone would know where I FIND tips on how to facilitate to mount coordinated the human body? (Build the mesh ...) to make these contours in 3D?</p>

<p>If anyone can help me with any tips, I thank the attention.</p>

<p>Thank you very much</p>

<p>first Program</p>

<pre><code>int neckThick, headShape, shoulderSize, armSize, hipSize, lowerSize, upperSize, thighSize, handSize, legSize, footSize; 

void setup() {
  size(displayWidth, displayHeight, P3D);
  smooth();
  strokeWeight(2);
  noFill();
  stroke(10,50,255,80);

  atualizaPontos();
}

void draw() {
  background(255);
  desenhaCorpo();;
}

void atualizaPontos(){
  neckThick    = 3;
  headShape    = 0;
  shoulderSize = 5;
  armSize      = -1;
  hipSize      = -3;
  lowerSize    = -5;
  upperSize    = 2;
  thighSize    = -5;
  handSize     = 15;
  legSize      = 0;
  footSize     = 14;
}

void desenhaCorpo() {
  head(headShape);
  neck(neckThick);
  shoulders(shoulderSize); 
  upperArms(armSize);
  hips(hipSize); 
  lowerBody(lowerSize); 
  upperBody(upperSize);  
  thighs(thighSize); 
  kneecaps();
  hands(handSize);  
  legs(legSize); 
  feet(footSize);
}

void head(int headSize) { 
  bezier(300, 70, 308, 30, 372, 30, 385, 70); //scalp
  bezier(300, 70, 300-headSize, 120, 315-headSize, 135, 320, 140); //side
  bezier(385, 70, 385+headSize, 120, 370+headSize, 135, 365, 140); //side
  bezier(320, 140, 340, 155, 345, 155, 365, 140); //chin
}
void neck(int neckWidth) {
  bezier(320, 140, 325-neckWidth, 170, 320-neckWidth, 180, 315, 180); //left neck
  bezier(365, 140, 355+neckWidth, 170, 365+neckWidth, 180, 365, 180); //right neck
}
void shoulders(int shoulderWidth) {
  bezier(210, 200, 305, 190-shoulderWidth, 310, 185-shoulderWidth, 315, 180); //left trapezius
  bezier(365, 180, 370, 190-shoulderWidth, 380, 195-shoulderWidth, 480, 200); //right trapezius
  bezier(210, 200, 205, 205, 205, 205, 200, 220); // left shoulder
  bezier(480, 200, 485, 205, 485, 205, 490, 220); // right shoulder
} 
void upperBody(int upperWidth) {
  bezier(240, 250, 245-upperWidth, 300+upperWidth, 250-upperWidth, 325+upperWidth, 275, 325); //left pectoral 
  bezier(450, 250, 450+upperWidth, 300+upperWidth, 430+upperWidth, 325+upperWidth, 415, 325); //right pectoral
  bezier(330, 300, 325, 320, 320, 320, 300, 325); //inner boob
  bezier(360, 300, 370, 320, 375, 320, 390, 325); //inner boob
}
void lowerBody(int lowerWidth) {
  bezier (260, 320, 260-lowerWidth, 350+lowerWidth/2, 270-lowerWidth, 380+lowerWidth/2, 265, 415); // left side 
  bezier (430, 320, 430+lowerWidth, 350+lowerWidth/2, 420+lowerWidth, 380+lowerWidth/2, 425, 415); // right side
}
void hips(int hipWidth) {
  bezier(265, 410, 265-hipWidth, 430, 255-hipWidth, 435, 260, 450); //left hip 
  bezier(425, 410, 425+hipWidth, 430, 435+hipWidth, 435, 430, 450); //left hip
}
void thighs(int thighWidth) {
  bezier(260, 450, 240-thighWidth, 500, 250-thighWidth, 525, 270, 650); //left thigh side
  bezier(335, 480, 340+thighWidth, 500, 330+thighWidth, 525, 320, 650); //right thigh side
  bezier(430, 450, 445+thighWidth, 500, 440+thighWidth, 525, 420, 650); //left thigh side
  bezier(360, 480, 355-thighWidth, 500, 355-thighWidth, 525, 370, 650); //right thigh side
  bezier(335, 480, 340, 483, 340, 483, 360, 480);
}
void kneecaps() {
  bezier(270, 650, 270, 655, 265, 655, 270, 690); // left kneecap side 
  bezier(320, 650, 320, 655, 325, 655, 320, 690); // right kneecap side
  bezier(420, 650, 420, 655, 425, 655, 420, 690); // left kneecap side 
  bezier(370, 650, 370, 655, 365, 655, 370, 690); // right kneecap side
}
void upperArms(int armWidth) {
  bezier(200, 220, 190-armWidth, 300, 200-armWidth, 310, 200, 350); // left forearm side 
  bezier(200, 350, 180-armWidth, 425, 200-armWidth, 500, 200, 500); // left arm side 
  bezier(240, 250, 240+armWidth, 300, 235+armWidth, 310, 235, 350); // left forearm inside 
  bezier(235, 350, 240+armWidth, 425, 230+armWidth, 450, 225, 500); // left arm inside 
  bezier(490, 220, 500+armWidth, 300, 490+armWidth, 310, 490, 350); // right forearm 
  bezier(490, 350, 510+armWidth, 425, 490+armWidth, 500, 490, 500); // right arm 
  bezier(450, 250, 450-armWidth, 300, 455-armWidth, 310, 455, 350); // right forearm inside
  bezier(455, 350, 460-armWidth, 425, 455-armWidth, 450, 465, 500); // right arm inside
}
void hands(int handWidth) {
  bezier(200, 500, 210-handWidth, 530, 175-handWidth, 560, 220, 575); // left hand 
  bezier(220, 575, 225+handWidth, 575, 220+handWidth, 560, 225, 500); // left hand 
  bezier(490, 500, 480+handWidth, 530, 500+handWidth, 560, 490, 575); // right hand 
  bezier(465, 500, 460-handWidth, 575, 455-handWidth, 560, 490, 575); // right hand
}
void legs(int legWidth) {
  bezier(270, 690, 255-legWidth, 775, 265-legWidth, 800, 275, 850); //left calf 
  bezier(320, 690, 320+legWidth, 775, 300+legWidth, 800, 300, 850); //left calf 
  bezier(420, 690, 435+legWidth, 775, 415+legWidth, 800, 405, 850); //right calf 
  bezier(370, 690, 370-legWidth, 775, 380-legWidth, 800, 380, 850); //left calf
}
void feet(int footWidth) {
  bezier(275, 850, 250-footWidth, 900+footWidth, 280-footWidth, 900+footWidth, 300, 850); // left foot 
  bezier(405, 850, 430+footWidth, 900+footWidth, 400+footWidth, 900+footWidth, 380, 850); // left foot
}
</code></pre>

<p>second program</p>

<pre><code>import remixlab.proscene.*;

Scene scene;
float px[], py[], mesh[][][];

void setup() {
  size(displayWidth, displayHeight, P3D);
  smooth(); //Suavição de Contorno
  lights(); //Inicia Luzes no ambiente

  //Inicia ambiente para Cena
  scene = new Scene(this);
  scene.setAxesVisualHint(false);
  scene.setGridVisualHint(false);
  scene.showAll();

  //Cria Matriz para a malha 
  px = new float[40];
  py = new float[40];
  float t = 0;

  for(int i = 0; i &lt; px.length; i++) {
    px[i] = bezierPoint(50, 130, 130, 50, t);
    py[i] = bezierPoint(450, 350, 150, 50, t);
    //px[i] = bezierPoint(300, 308, 370, 300, t);
    //py[i] = bezierPoint(70, 30, 30, 70, t);
    t += (1.0/(float)(px.length-1));
    ellipse(px[i], py[i], 5, 5);
    println(t);
  }

  //Cria Malha
  mesh = createMesh(px,py,20, -60,60);
  //mesh = createMesh(px,py,170, -360,360);

  scene.startAnimation();
}

void draw() {
  background(0);
  ambientLight(128, 128, 128);
  directionalLight(255, 255, 255, 0, 1, -100);

  //head(-3);
  stroke(255);
  //noStroke();
  //fill(255,120,0);
  drawMesh(mesh);
}

void head(int headSize) { 
  fill(255);
  bezier(300, 70, 30, 308, 30, 30, 372, 30, 30, 385, 70, 30); //scalp
  bezier(300, 70, 30, 300-headSize, 120, 30, 315-headSize, 135, 30, 320, 140, 30); //side
  bezier(385, 70, 30, 385+headSize, 120, 30, 370+headSize, 135, 30, 365, 140, 30); //side
  bezier(320, 140, 30, 340, 155, 30, 345, 155, 30, 365, 140, 30); //chin
}

//Desenha Malha
void drawMesh(float mesh[][][]) {
  //println(mesh.length+" "+mesh[0].length+" "+mesh[0][0].length);
  for(int i = 0; i &lt; mesh.length-1; i++) {
    beginShape(QUAD_STRIP);
    for(int j = 0; j &lt; mesh[0].length; j++) {
      vertex(mesh[i][j][0], mesh[i][j][1], mesh[i][j][2]);
      vertex(mesh[i+1][j][0], mesh[i+1][j][1], mesh[i+1][j][2]);
    }
    endShape();
  }
}

//Cria malha
float [][][] createMesh(float px[],float py[],int numrot, float startDeg,float endDeg) {
  float deg, x, z;
  double cosval, sinval, tmp1, tmp2;

  float [][][] mesh = new float[numrot][px.length][3];
  endDeg -= startDeg;

  for(int i = 0; i &lt; numrot; i++) {
    deg = radians(startDeg + (endDeg/(float)(numrot-1)) * (float)i);
    for(int j = 0; j &lt; px.length; j++) {
      x = px[j];
      z = 0;
      cosval = Math.cos(deg);
      sinval = Math.sin(deg);
      tmp1   = x * cosval - z * sinval;
      tmp2   = x * sinval + z * cosval;
      mesh[i][j][0] = (float) tmp1;
      mesh[i][j][1] = py[j];
      mesh[i][j][2] = (float) tmp2;
    }
  }
  return mesh;
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Can I set a video as my background();</title>
      <link>https://forum.processing.org/two/discussion/18070/can-i-set-a-video-as-my-background</link>
      <pubDate>Sun, 04 Sep 2016 22:24:35 +0000</pubDate>
      <dc:creator>Brendan_Wilson</dc:creator>
      <guid isPermaLink="false">18070@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>Here is what I;m trying to do. I would like to set a looping video as my background() image in my processing sketch. Then I want to import an OBJ and be able to rotate it in 3D space with my mouse. What I have so far is the video and the OBJ in the sketch but both acting as one piece. Here is my code so far. Any ideas?</p>

<p>import peasy.*;
import processing.video.*;</p>

<p>PShape s;</p>

<p>String PATH = "/Users/brendanwilson/Desktop/Vidoe_Processing/video/data/comp.mov";
Movie mov;</p>

<p>PeasyCam cam;</p>

<p>void setup() {
  size(800, 800, P3D);
  smooth();
  s = loadShape("rise.obj");
  frameRate(30);
  mov = new Movie(this, PATH);
  mov.loop();</p>

<p>//CAMERA Click &amp; Drag for rotation - Command &amp; Drag for panning
  cam = new PeasyCam(this, 0, 0, 0, 50);
  cam.setMinimumDistance(0);
  cam.setMaximumDistance(1800);</p>

<p>}</p>

<p>void movieEvent(Movie m) {
  m.read();</p>

<p>}</p>

<p>void draw() {</p>

<p>directionalLight(126, 126, 126, 0, 0, -1);
  ambientLight(102, 102, 102); 
  background(0);
  pushMatrix();
  shape(s, 10, 10, 80, 80);
  popMatrix();
  image(mov, 0, 0, width, height);
}</p>
]]></description>
   </item>
   <item>
      <title>Shining a spotlight at the background</title>
      <link>https://forum.processing.org/two/discussion/16148/shining-a-spotlight-at-the-background</link>
      <pubDate>Wed, 20 Apr 2016 23:02:53 +0000</pubDate>
      <dc:creator>EliTheIceMan</dc:creator>
      <guid isPermaLink="false">16148@/two/discussions</guid>
      <description><![CDATA[<p>I want to be able to simply shine a spotlight straight into the screen onto the background in a sort of 2D manner.  I found that using ortho() eliminates the perspective which is good.  The next issue is that the lights need a surface to shine onto.  I found that shining onto a sphere creates the effect I need but I want to shine onto the entire window so I tried to use a square but I get really weird results.  Below is simple code which shows a spotlight shining straight down (Z) onto a sphere but I try to shine down onto a square (XY plane) it only shows up near the corners.  Ellipse has interesting black hole light results.
Any ideas?  I basically want a 2D program but want to use lights to control translucent areas of color.</p>

<pre><code>void setup()
{
  size(1240, 660, P3D);
  ortho();
  //noStroke();
  sphereDetail(120);
  colorMode(RGB, 255);
  rectMode(CENTER);
}

int A, B, Ax, Ay, Bx, By;

void draw()
{
  background(20);
  ambientLight(50, 50, 50);

  spotLight(255, 0, 0, width/2, height/2, 600, 0, 0, -1, PI/2, 100);

  spotLight(0, A, 0, Ax, Ay, 600, 0, 0, -1, PI/2, 100);
  spotLight(0, 0, B, Bx, By, 600, 0, 0, -1, PI/2, 100);

  translate(mouseX, mouseY, 0);

  sphere(300);
  //ellipse(0,0,300,300);
  //box(300);
  //rect(0,0,300,300);


    /*if (A &gt; 0)
   A-=5;
   if (B &gt; 0)
   B-=5;
   */
}

boolean alt;
void mouseClicked()
{
  alt = !alt;
  if (alt)
  {
    Ax = mouseX;
    Ay = mouseY;
    A = 255;
  } else
  {
    Bx = mouseX;
    By = mouseY;
    B = 255;
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Shining Sphere as spotLight (like the sun)</title>
      <link>https://forum.processing.org/two/discussion/14848/shining-sphere-as-spotlight-like-the-sun</link>
      <pubDate>Wed, 10 Feb 2016 20:21:36 +0000</pubDate>
      <dc:creator>0llum</dc:creator>
      <guid isPermaLink="false">14848@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys, I'm creating a model of our solar system. Everthing works fine except for the sun. I want the sun to be a spot light so it shines in all direction. But when I do so the sun itself is dark because the spotlight is at the same position as the sun sphere. I've tried all the other types of light sources but nothing is working well. Do you have an idea how to achieve this?
I want the sun to emit light or at least be bright without affecting all the other planets.</p>

<p>On the picture you can see what it looks like using a spotlight in the center of the sun.</p>

<p>Hope you can help me. I really didn't find anything on the web. Thanks in advance!</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/358/O663GKXKHOPL.jpg" alt="Solar System 3D" title="Solar System 3D" /></p>
]]></description>
   </item>
   <item>
      <title>WebGL material transparency</title>
      <link>https://forum.processing.org/two/discussion/14842/webgl-material-transparency</link>
      <pubDate>Wed, 10 Feb 2016 14:40:10 +0000</pubDate>
      <dc:creator>zachrkn</dc:creator>
      <guid isPermaLink="false">14842@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>The P5JS reference claims that alpha is property for the various WebGL materials.  However, as far as I can tell, the only effect decreased alpha has it to increase the brightness.  That is, the material simply gets more white as the alpha is decreased.  This was raised as an issue here:
<a href="https://github.com/processing/p5.js/issues/1117" target="_blank" rel="nofollow">https://github.com/processing/p5.js/issues/1117</a>
and marked as fixed, but I'm still not getting transparency.</p>

<p>I have tested this with basicMaterial and specularMaterial in Chrome, Firefox, and Safari.</p>

<p>Can anyone point me in the right direction or confirm that this is still an issue?</p>

<p>Thanks,
Zach</p>
]]></description>
   </item>
   <item>
      <title>fill() in P3D mode leads to some weird behavior.</title>
      <link>https://forum.processing.org/two/discussion/4537/fill-in-p3d-mode-leads-to-some-weird-behavior</link>
      <pubDate>Sat, 19 Apr 2014 15:39:58 +0000</pubDate>
      <dc:creator>billautomata</dc:creator>
      <guid isPermaLink="false">4537@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to wrap my head around lights and materials for a blog post that I am doing, and I can't seem to figure out what exactly is going on when I use <code>fill()</code> in <code>P3D</code> mode.</p>

<pre><code>void setup(){
  size(800,800,P3D);
  smooth(8);
}
void draw(){

  noStroke();

  background(0);

  ambientLight(128, 128, 128);

  lightSpecular(128,128,128);
  directionalLight(128,128,128, 0, 1, -1);

  pushMatrix();
    translate(width * 0.5, height * 0.5, 0);

    ambient(128,128,128);

    specular(255,255,0);  // yellow specular light
    shininess(10.0);

    sphere(width * 0.2);

  popMatrix();

}
</code></pre>

<p>produces...</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/912/3INDG0XZIBGU.png" alt="ambient" title="ambient" /></p>

<p>If I replace the call to <code>ambient(128,128,128);</code> with <code>fill(128,128,128);</code> I get this:</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/570/2CZEUXANWCNR.png" alt="fill" title="fill" /></p>

<p>Calling <code>fill</code> seems to nullify other settings like <code>shininess</code>.  What exactly is going on in <code>P3D</code> mode when I am calling <code>fill</code>?  Thanks!</p>
]]></description>
   </item>
   </channel>
</rss>