processing / processing/processing4

Flat rendering on PGraphics3D of PShapes created from PGraphics2D

Abierto
#833 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug core
Lenguaje dominante
Java
Estrellas
494
Forks
183
Merge medio
4 h 39 min
PR fusionados (30 d)
3

Descripción

Created by: onimatrix

Calling createShape() directly will use the Applet renderer.
If this renderer is set to be of type P2D, the resulting shape seems to ignore any z value set to it's vertices.
I'm guessing that this shape contains some optimizations aimed at 2D rendering.

There should be a warning when using this kind of "flat" PShape on a P3D renderer.
Maybe even a different PShape class to make it foolproof.
Also, it would be great if 3D PShapes could be created without needing to reference a PGraphics3D that is in the "draw state".

Here's a piece of code to replicate the issue:

PGraphics g3D;
PShape shape;

void setup()
{
  size(800, 600, P2D);
  g3D = createGraphics(width, height, P3D);
  
  //g3D.beginDraw(); // uncomment to fix flatness
    shape = createShape(); // change to g3D.createShape(); to fix flatness
  //g3D.endDraw(); // uncomment to fix flatness

  shape.beginShape(LINE_STRIP);
    shape.vertex(0, 0, 0);
    shape.vertex(200, 0, 0);
    shape.vertex(200, 0, 200);
  shape.endShape(CLOSE);
}

void draw()
{
  g3D.beginDraw();
    g3D.background(255);
    g3D.translate(width / 2, height / 3, 0);
    g3D.rotateY(((frameCount % 400) / 400.0f) * TWO_PI);
    g3D.shape(shape);
  g3D.endDraw();
  
  image(g3D, 0, 0, width, height);
}
  • Processing version: 4.2
  • Operating System and OS version: Windows 10

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza ejecutando el sketch proporcionado y compara createShape() con g3D.createShape(), incluido el caso de beginDraw(). Sigue los puntos de entrada createShape(), PGraphics2D, PGraphics3D y PShape para determinar dónde se selecciona la forma plana; se considera terminado cuando el caso de uso de P3D se gestiona explícitamente, con la advertencia solicitada o con una ruta claramente compatible para la creación de formas 3D.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
computer-graphics
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.