Lights and colours in 3D?

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?

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

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.

2 Likes

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

See Random walker through points - #15 by Chrisir

1 Like

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]