processing / processing/processing4

Flat rendering on PGraphics3D of PShapes created from PGraphics2D

オープン
#833 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug core
主要言語
Java
スター
494
フォーク
183
平均マージ
4時間 39分
マージ済み PR(30日)
3

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず提供された sketch を実行し、beginDraw() のケースを含めて createShape() と g3D.createShape() を比較します。createShape()、PGraphics2D、PGraphics3D、PShape のエントリポイントを追跡し、平面形状がどこで選択されるかを特定します。P3D のユースケースが、要求された警告または明確にサポートされた 3D 形状作成パスによって明示的に処理されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
computer-graphics
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。