質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

GLSL ES

GLSL ESは、GLSLの派生規格で、 組み込み環境向けのOpenGL ES用のシェーダー言語です。

HLSL

HLSLは、米マイクロソフト社によって開発された Direct3D APIで使われるプロプライエタリなシェーディング言語です。

Q&A

解決済

1回答

10217閲覧

WARNING: Shader Unsupported: 'Hidden/Internal-MotionVectors' - Pass '' has no vertex shader を出ないように

whaison

総合スコア8

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

GLSL ES

GLSL ESは、GLSLの派生規格で、 組み込み環境向けのOpenGL ES用のシェーダー言語です。

HLSL

HLSLは、米マイクロソフト社によって開発された Direct3D APIで使われるプロプライエタリなシェーディング言語です。

0グッド

0クリップ

投稿2016/10/14 09:43

WARNING: Shader Unsupported: 'Hidden/Internal-MotionVectors' - Pass '' has no vertex shader を出ないようにしたいです。

Unity5.4.1p4
Xcode Version 8.0 (8A218a)
iPhone 7 iOS10.0.2(14A456)
でGame用shaderを作っています。
使用しているシェーダをコンパイル時に実行中に以下のエラーメッセージが発生しました。

###発生している問題・エラーメッセージ

-------- -------- -------- -------- Xcode OutPut-------- -------- -------- -------- -------- -------- failed compiling: fragment evaluation shader WARNING: 0:4: extension 'GL_EXT_frag_depth' is not supported ERROR: 0:38: Use of undeclared identifier 'gl_FragDepthEXT' Note: Creation of internal variant of shader 'Hidden/Internal-MotionVectors' failed. WARNING: Shader Unsupported: 'Hidden/Internal-MotionVectors' - Pass '' has no vertex shader WARNING: Shader Unsupported: 'Hidden/Internal-MotionVectors' - Setting to default shader.

###該当のソースコード

Internal

1Shader "Hidden/Internal-MotionVectors" 2{ 3 SubShader 4 { 5 CGINCLUDE 6 #include "UnityCG.cginc" 7 8 // Object rendering things 9 float4x4 _NonJitteredVP; 10 float4x4 _PreviousVP; 11 float4x4 _PreviousM; 12 bool _HasLastPositionData; 13 float _MotionVectorDepthBias; 14 15 struct MotionVectorData 16 { 17 float4 transferPos : TEXCOORD0; 18 float4 transferPosOld : TEXCOORD1; 19 float4 pos : SV_POSITION; 20 }; 21 22 struct MotionVertexInput 23 { 24 float4 vertex : POSITION; 25 float3 oldPos : NORMAL; 26 }; 27 28 MotionVectorData VertMotionVectors(MotionVertexInput v) 29 { 30 MotionVectorData o; 31 o.pos = UnityObjectToClipPos(v.vertex); 32 33 // this works around an issue with dynamic batching 34 // potentially remove in 5.4 when we use instancing 35#if defined(UNITY_REVERSED_Z) 36 o.pos.z -= _MotionVectorDepthBias * o.pos.w; 37#else 38 o.pos.z += _MotionVectorDepthBias * o.pos.w; 39#endif 40 o.transferPos = mul(_NonJitteredVP, mul(unity_ObjectToWorld, v.vertex)); 41 o.transferPosOld = mul(_PreviousVP, mul(_PreviousM, _HasLastPositionData ? float4(v.oldPos, 1) : v.vertex)); 42 return o; 43 } 44 45 half4 FragMotionVectors(MotionVectorData i) : SV_Target 46 { 47 float3 hPos = (i.transferPos.xyz / i.transferPos.w); 48 float3 hPosOld = (i.transferPosOld.xyz / i.transferPosOld.w); 49 50 // V is the viewport position at this pixel in the range 0 to 1. 51 float2 vPos = (hPos.xy + 1.0f) / 2.0f; 52 float2 vPosOld = (hPosOld.xy + 1.0f) / 2.0f; 53 54#if UNITY_UV_STARTS_AT_TOP 55 vPos.y = 1.0 - vPos.y; 56 vPosOld.y = 1.0 - vPosOld.y; 57#endif 58 half2 uvDiff = vPos - vPosOld; 59 return half4(uvDiff, 0, 1); 60 } 61 62 //Camera rendering things 63 sampler2D_float _CameraDepthTexture; 64 65 struct CamMotionVectors 66 { 67 float4 pos : SV_POSITION; 68 float2 uv : TEXCOORD0; 69 float3 ray : TEXCOORD1; 70 }; 71 72 CamMotionVectors VertMotionVectorsCamera(float4 vertex : POSITION, float3 normal : NORMAL) 73 { 74 CamMotionVectors o; 75 o.pos = UnityObjectToClipPos(vertex); 76 77#ifdef UNITY_HALF_TEXEL_OFFSET 78 o.pos.xy += (_ScreenParams.zw - 1.0) * float2(-1, 1) * o.pos.w; 79#endif 80 o.uv = ComputeScreenPos(o.pos); 81 // we know we are rendering a quad, 82 // and the normal passed from C++ is the raw ray. 83 o.ray = normal; 84 return o; 85 } 86 87 inline half2 CalculateMotion(float rawDepth, float2 inUV, float3 inRay) 88 { 89 float depth = Linear01Depth(rawDepth); 90 float3 ray = inRay * (_ProjectionParams.z / inRay.z); 91 float3 vPos = ray * depth; 92 float4 worldPos = mul(unity_CameraToWorld, float4(vPos, 1.0)); 93 94 float4 prevClipPos = mul(_PreviousVP, worldPos); 95 float2 prevHPos = prevClipPos.xy / prevClipPos.w; 96 97 float4 curClipPos = mul(_NonJitteredVP, worldPos); 98 float2 curHPos = curClipPos.xy / curClipPos.w; 99 100 // V is the viewport position at this pixel in the range 0 to 1. 101 float2 vPosPrev = (prevHPos.xy + 1.0f) / 2.0f; 102 float2 vPosCur = (curHPos.xy + 1.0f) / 2.0f; 103#if UNITY_UV_STARTS_AT_TOP 104 vPosPrev.y = 1.0 - vPosPrev.y; 105 vPosCur.y = 1.0 - vPosCur.y; 106#endif 107 return vPosCur - vPosPrev; 108 } 109 110 half4 FragMotionVectorsCamera(CamMotionVectors i) : SV_Target 111 { 112 float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv); 113 return half4(CalculateMotion(depth, i.uv, i.ray), 0, 1); 114 } 115 116 half4 FragMotionVectorsCameraWithDepth(CamMotionVectors i, out float outDepth : SV_Depth) : SV_Target 117 { 118 float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv); 119 outDepth = depth; 120 return half4(CalculateMotion(depth, i.uv, i.ray), 0, 1); 121 } 122 ENDCG 123 124 // 0 - Motion vectors 125 Pass 126 { 127 Tags{ "LightMode" = "MotionVectors" } 128 129 ZTest LEqual 130 Cull Back 131 ZWrite Off 132 133 CGPROGRAM 134 #pragma vertex VertMotionVectors 135 #pragma fragment FragMotionVectors 136 ENDCG 137 } 138 139 // 1 - Camera motion vectors 140 Pass 141 { 142 ZTest Always 143 Cull Off 144 ZWrite Off 145 146 CGPROGRAM 147 #pragma vertex VertMotionVectorsCamera 148 #pragma fragment FragMotionVectorsCamera 149 ENDCG 150 } 151 152 // 2 - Camera motion vectors (With depth (msaa / no render texture)) 153 Pass 154 { 155 ZTest Always 156 Cull Off 157 ZWrite On 158 159 CGPROGRAM 160 #pragma vertex VertMotionVectorsCamera 161 #pragma fragment FragMotionVectorsCameraWithDepth 162 ENDCG 163 } 164 } 165 166 Fallback Off 167} 168

###試したこと
課題に対してアプローチしたことを記載してください
こちらのサイトに
http://answers.unity3d.com/questions/1112968/shader-unsupported-no-vertex-shader-breaking-graph.htm
Found the answer. The issue was actually in another custom shader, which contained the code "#pragma exclude_renderers gles flash". WebGL uses gles, and that line stopped the shader for compiling for it.

とあったので#pragma exclude_renderers gles を追加してみました。

l
CGPROGRAM
#pragma exclude_renderers gles を追加してみました。

よく読むと"#pragma exclude_renderers gles flash"と書いた別のカスタムシェーダがわるさをしている
マニュアルによると#pragma exclude_renderers space separated names - 指定のレンダラーのみシェーダーをコンパイルしません。
OpenGLES2.0 しか指定していないのでglsl をコンパイルしないわけにいきません
その記述に関係なく動作しました。

###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
project setting は
OpenGLES2.0、まあまあ正常な中この WARNING: Shader Unsupported: 'Hidden/Internal-MotionVectors' - Pass '' has no vertex shader
OpenGLE3.0 3Dオブジェクトはピンク たぶんよくある シェーダーが見つかりませんよエラーです。
metal 3Dオブジェクトは真っ黒です。

Rendering Path はForward
です。

Unity5.4.1p4
Xcode Version 8.0 (8A218a)
iPhone 7 iOS10.0.2(14A456)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

matsu

2016/10/14 16:13

ERROR: 0:38: Use of undeclared identifier 'gl_FragDepthEXT' の方が問題だとは思うのですが、こちらについては何か対応しているのですか?
guest

回答1

0

自己解決

イメージ説明]
プロジェクトセッティングのAuto Graphics APIs のチェックを外すと出てくる
Graphics APIs がOpenGLES 2.0だったんですが
そちらをを Metal にしたらなおりました。
そもそもなぜ今までのプロジェクトがOpenGLES 2.0 を使っていたのかはCriWareなどのプラグイン関係によるところかもしれません。

投稿2016/10/17 09:54

whaison

総合スコア8

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問