# Lights and colours in 3D?

**URL:** https://discourse.processing.org/t/lights-and-colours-in-3d/40862
**Category:** Coding Questions
**Created:** [February 7, 2023, 2:49pm UTC](https://discourse.processing.org/t/lights-and-colours-in-3d/40862 "2023-02-07T14:49:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Raul](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@Raul](https://discourse.processing.org/u/Raul)
#### Post date: [February 7, 2023, 2:49pm UTC](https://discourse.processing.org/t/lights-and-colours-in-3d/40862/1 "2023-02-07T14:49:45Z")

</div>

Hi!

This shouldn’t be complicated, but I can’t figure out how to solve it. I though it would be related to lights in 3D, but I don’t find the solution.

When I draw a white line in a 3D space this line - sometimes, it depends on the translation - appears gray = 127. Is it possibe to control this level of gray? For example, could this line be gray = 200? I though this would be related to the default ligthing, but I can’t change it.

This ‘gray’ effect can be avoided with noSmooth(), but I just want to control the gray level, not to remove it.

Any suggestion?

```auto
void settings() {
  size(800, 800, P3D);
}

void setup() {
}

void draw() {
  background(0);
  stroke(255);
  
  pushMatrix();
  translate(0, 0, -10);
  line (50, 400, 750, 400);
  popMatrix();
}

```

Thanks!  
r

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [February 7, 2023, 3:41pm UTC](https://discourse.processing.org/t/lights-and-colours-in-3d/40862/2 "2023-02-07T15:41:29Z")

</div>

You can always change the line colour with stroke() **BUT** the line will be **blended** with the background colour to give it a smooth edge making it appear to be a different colour. This is called anti-aliasing, `noSmooth()` worked because it switched off anti-aliasing.

There is not a lot you can do about it if you want smooth lines although increasing the strokeWeight can help.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [February 7, 2023, 4:39pm UTC](https://discourse.processing.org/t/lights-and-colours-in-3d/40862/3 "2023-02-07T16:39:07Z")

</div>

First you can use line as 3D line with 6 parameters xyz and xyz

See [Random walker through points - #15 by Chrisir](https://discourse.processing.org/t/random-walker-through-points/18040/15)

---

<div class="post-metadata">

### Author: ![Raul](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@Raul](https://discourse.processing.org/u/Raul)
#### Post date: [February 8, 2023, 5:27am UTC](https://discourse.processing.org/t/lights-and-colours-in-3d/40862/4 "2023-02-08T05:27:26Z")

</div>

Thanks quark.

I realize that my question could be rephrased as: Is it possible to control the color of the gradient generated at the edges of shapes, lines, pixels, etc. by anti-aliasing?

It seems that there is not much we can do.

Best,  
r

quote=“quark, post:2, topic:40862, full:true”]  
You can always change the line colour with stroke() **BUT** the line will be **blended** with the background colour to give it a smooth edge making it appear to be a different colour. This is called anti-aliasing, `noSmooth()` worked because it switched off anti-aliasing.

There is not a lot you can do about it if you want smooth lines although increasing the strokeWeight can help.  
[/quote]
