Get it on Google Play


Wm뮤 :: 유니티 쉐이더 오류 모음

블로그 이미지
가끔 그림그리거나 3D모델링하거나
취미로 로봇만드는
퇴직한 전자과 게임프로그래머
2020.3.48f1 , 2022.3.6f1 주로 사용
모카쨩
@Ahzkwid

Recent Comment

Archive


2023. 12. 18. 13:42 Unity/shader

 

 

Shader error in 'Ahzkwid/Toon': Output variable vert contains a system-interpreted value (SV_RenderTargetArrayIndex) which must be written in every execution path of the shader.  Unconditional initialization may help. at line 586 (on d3d11)

유니티 2019에서는 발생 안 하다가 2022에서 급작스럽게 발생했다.

원인은 struct v2f의 UNITY_VERTEX_OUTPUT_STEREO 구조변경 때문이다.

 

appdata와 vert에 아래구문을 추가한다

struct appdata
{
    UNITY_VERTEX_INPUT_INSTANCE_ID
};
v2f vert (appdata v)
{
    v2f o;

    UNITY_SETUP_INSTANCE_ID(v);
    UNITY_INITIALIZE_OUTPUT(v2f, o); 
    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
}

 

참고링크 : https://docs.unity3d.com/kr/2019.4/Manual/SinglePassInstancing.html

 

 

 

 

 

Shader error in 'Ahzkwid/KotatsuFuton': invalid subscript 'instanceID' at line 339 (on d3d11)
Compiling Subshader: 0, Pass: FORWARD, Vertex program with DIRECTIONAL STEREO_INSTANCING_ON VERTEXLIGHT_ON

 

위와 같은 문제이다.

위와 다른점은 위에건 버텍스 프래그 쉐이더를 썼지만 이건 서피스와 버텍스 혼합 쉐이더에서 발생한 차이점이 있다.

내 경우엔 프래그를 안 가져와서 void vert이기 때문에 appdata에 아래 구문 추가하는거로 끝났다.

struct appdata
{
    UNITY_VERTEX_INPUT_INSTANCE_ID
};

'Unity > shader' 카테고리의 다른 글

DepthCameraTexture를 _CameraDepthTexture처럼 쓰기  (0) 2023.10.14
PerlinNoise HLSL  (0) 2023.04.25
스크린 오버레이 샘플  (0) 2023.01.20
posted by 모카쨩

  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입