Solve 'self overlap' with transparent 3D objects

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
unity

調査の方向性

まず、リンクされている Unity depth、transparent shader、SetShaderPassEnabled のドキュメントを確認し、次に issue に記載されている URP と built-in パイプラインの制約を比較します。完了条件は、透明な非凸メッシュが両方のパイプラインで自己重複を回避し、追加の depth pass がデフォルトで無効のままであることです。

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

説明

enhancement

Describe the problem

Usually semitransparent shaders do not write into the depth buffer. However, this can create draw order problems, especially with complex non-convex meshes. If you want to fade in & out meshes like that, then using a shader that fills in the depth buffer before rendering transparency might be useful.

image

Semitransparent object; left: standard Transparent/Diffuse shader; right: shader that writes to depth buffer.

Describe the solution you'd like

Unity recomends a solution like below: https://docs.unity3d.com/2017.2/Documentation/Manual/SL-CullAndDepth.html

Shader "Transparent/Diffuse ZWrite" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
    Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    LOD 200

    // extra pass that renders to depth buffer only
    Pass {
        ZWrite On
        ColorMask 0
    }

    // paste in forward rendering passes from Transparent/Diffuse
    UsePass "Transparent/Diffuse/FORWARD"
}
Fallback "Transparent/VertexLit"
}

But! Multi-pass shaders are not supported by URP. There are some alternatives like using the draw objects render pass with light tags. But we'll need to find a solution that works for both URP and built-in pipelines.

Describe alternatives you've considered

n/a

Additional context

Original issue: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/6285

If adding an extra depth pass we need to ensure it's not enabled by default. This API might be able to do that? But it is still unclear.

主要言語
C#
スター
209
フォーク
49
PR マージ指標
30日以内にマージされた PR はありません

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

microsoft/MixedReality-GraphicsTools-Unity のほかの issue

microsoft/MixedReality-GraphicsTools-Unity の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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