plotly / plotly/plotly.py

change default lighting attributes to prevent mesh3d rendering bug

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

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

feature P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Mesh3D seems to have a shading bug, not sure how to describe it more precisely, but the images should help. This is the minimal example produced with the code below:

Image

import plotly.graph_objects as go
import numpy as np

vertices = np.array([[-1.0, -1.0, 0.0], [-1.0, 1.0, 0.0], [1.0, -1.0, 0.0], [1.0, 1.0, 0.0], [-1.0, 0.0, 1.0], [0.0, 0.0, 0.0], [0.0, -1.0, -1.0], [1.0, 0.0, 1.0], [0.0, 1.0, -1.0], [-1.0, -0.5, 0.75], [-0.5, -0.5, 0.0], [-0.5, -1.0, -0.75], [-0.5, 0.5, 0.0], [-0.5, 0.0, 0.25], [-1.0, 0.5, 0.75], [0.5, -1.0, -0.75], [0.0, -0.5, -0.25], [0.5, -0.5, 0.0], [0.0, 0.5, -0.25], [-0.5, 1.0, -0.75], [1.0, -0.5, 0.75], [0.5, 0.0, 0.25], [0.5, 1.0, -0.75], [0.5, 0.5, 0.0], [1.0, 0.5, 0.75]])
faces = np.array([[0, 9, 11], [4, 10, 9], [6, 11, 10], [9, 10, 11], [1, 12, 14], [5, 13, 12], [4, 14, 13], [12, 13, 14], [2, 15, 17], [6, 16, 15], [5, 17, 16], [15, 16, 17], [4, 13, 10], [5, 16, 13], [6, 10, 16], [13, 16, 10], [1, 12, 19], [5, 18, 12], [8, 19, 18], [12, 18, 19], [2, 20, 17], [7, 21, 20], [5, 17, 21], [20, 21, 17], [3, 22, 24], [8, 23, 22], [7, 24, 23], [22, 23, 24], [5, 21, 18], [7, 23, 21], [8, 18, 23], [21, 23, 18]])

x, y, z = vertices.T
i, j, k = faces.T

fig = go.Figure(data=[go.Mesh3d(x=x, y=y, z=z,
                                i=i, j=j, k=k,
                                flatshading=False)])
fig.show()

This is not related to the saddle point per se and it is also not just an interpolation issue, as similar problems occur with flatshading=True on a parabola:

Image

Interestingly, when I tried to get a minimal example with flatshading by isolating the problematic triangles around the centre of the parabola, the problem disappeared. So it seems to be related to some kind of scaling issue (like min/max slope or similar). Not sure whether this is actually plotly.py or rather plotly.js.

Any ideas?

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

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

はじめの一歩

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

調査の方向性

まず issue にある最小の Python Mesh3d 例を実行し、放物線の例で flatshading を有効にした場合のレンダリングと比較します。Mesh3d のライティングのデフォルトを追跡し、どの属性の変更によってシェーディングのアーティファクトを防げるかを特定します。完了とは、報告された両方の例が説明されたバグなしでレンダリングされることです。

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

評価

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

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

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