Closed
Description
After perspective() is called, stroke weights become unexpectedly thin near the camera while objects far away are stroked too thickly. I noticed this on another sketch I was building with a roving camera. For reporting purposes, I've created a minimal sketch to illustrate the problem.
Nature of issue?
- Found a bug
Most appropriate sub-area of p5.js?
- Core/Environment/Rendering
- WebGL
Which platform were you using when you encountered this?
- Mobile/Tablet (touch devices)
- Desktop/Laptop
Details about the bug:
- p5.js version: v0.10.2
- Web browser and version: Chrome 79.0.3945.88, Firefox 71.0, Safari 12.1.1
- Operating System: Windows 7 Pro, macOS 10.13.6, Android 7
- Steps to reproduce this:
- Run this repro sketch https://editor.p5js.org/jwdunn1/sketches/VGEuB8mTP
- Note the stroke weights - these are rendered correctly at this point. Stroke weight is set to 3 for emphasis.
- Now, click on the sketch canvas to invoke perspective()
- Note the change in stroke weights (items closer to the camera become too thin while those further away become too thick) This is not the expected behavior.
The stroke weights work correctly with perspective() in v0.9.0 and earlier.
Sketch code is below:
function setup() {
createCanvas(400, 400, WEBGL);
strokeWeight(3);
}
function draw() {
background(220);
rotateY(PI/8);
rotateZ(PI/8);
translate(0,0,300);
for(let i=0; i<12; i++){
translate(0,0,-100);
box();
}
}
function mousePressed(){
perspective(PI/3, width/height, 1, 10000);
}
Metadata
Metadata
Assignees
Type
Projects
Status
DONE! 🎉