모바일에 대응 할수있는 가벼운 vertex 셰이더인 유니티 고정 함수 셰이더 이고......

SetTexture 는 이미 적용된 텍스쳐와 빛 기타 결과물을 합성해주는 구문이라고 생각하면 된다.

몇가지 방법을 레퍼런스에서 제시 해 두었는데 어떤 결과인지 예상은 되지만 눈으로 보고 기록을 해두면 더 좋겠지...

 

빛 계산은 별 의미가 없을것 같고 텍스쳐 위주로 합성을 해보자.

모든 material 사용

주광(흰색), 역광(푸른색) 사용

 

////   -------test Set Texture--------

//  combine src1 * src2
  SetTexture[_MainTex]{
   combine Texture * Texture
  }

src1과src2를 함께 곱합니다. 결과는 입력값보다 더 어두울 것입니다.

 

 

 

 


//  combine src1 + src2
  SetTexture[_MainTex]{
   combine Texture + Texture
  }

src1과src2를 함께 더합니다. 결과는 입력값보다 더 밝을 것입니다.

 

 

 

 


//  combine src1 - src2
  SetTexture[_MainTex]{
   combine Texture - Texture
  }

src1에서 src2를 뺍니다.

 

 

 

 


//  combine src1 +- src2
  SetTexture[_MainTex]{
   combine Texture +- Texture
  }

src1과src2를 함께 더하고나서 0.5를 뺍니다 (부호가 적용되는 덧셈).

 

 

 

 


//  combine src1 lerp (src2) src3
  SetTexture[_MainTex]{
   combine Texture * primary
  }
  SetTexture[_Blend]{
   combine Texture lerp (Texture)previous
  }

src2의 알파를 사용해서 src3와src1 사이에서 보간합니다. 보간은 반대 방향임을 주의하시기 바랍니다: 알파가 1일 때src1가 사용되고 알파가 0일 때src3에서 사용됩니다.

 

 

 

 


//  combine src1 * src2 + src3
  SetTexture[_MainTex]{
   combine Texture * Texture + Texture
  }

src1을src2의 알파 컴포넌트에 곱하고 나서 src3을 더합니다.

 

 

 

 


//  combine src1 * src2 +- src3
  SetTexture[_MainTex]{
   combine Texture *Texture +- Texture
  }

 src1을src2의 알파 컴포넌트에 곱하고 나서src3과 함께 부호를 적용하는 덧셈을 합니다.

 

 

 

 


//  combine src1 * src2 - src3
  SetTexture[_MainTex]{
   combine Texture * Texture - Texture
  }

src1을src2의 알파 컴포넌트에 곱하고 나서src3을 뺍니다.

 

 

 

 

 

-결론-

다들 차이가있네... 눈으로 보니까 확실하다 대비, 블랜딩 보간, 발광 기타등등 알파 블랜딩 넣어주면 이팩트 셰이더넹....열라 편하다...ㅎ

 

 

 

-전체 테스트 셰이더 코드-

Shader "FF/SetTest" {
 Properties {
  _Color("Color",Color)=(1,1,1,0)
  _MainTex ("Base (RGB)", 2D) = "white" {}
  _Blend("Blend(RGBA)",2D) = "White"{}
  _SpecColor("SpecColor",Color)=(1,1,1,1)
  _Shininess("Shininess",Range(0.01,1))=0.5
  _Emission("Emission",Color)=(0,0,0,0)
 }
 SubShader {
 
  pass{
  Lighting On
  SeparateSpecular On
  
  Material{
   Diffuse[_Color]
   Ambient[_Color]
   Specular[_SpecColor]
   Shininess[_Shininess]
   Emission[_Emission]
  }
////   -------test Set Texture--------

////  combine src1 * src2
//  SetTexture[_MainTex]{
//   combine Texture * Texture
//  }
////  combine src1 + src2
//  SetTexture[_MainTex]{
//   combine Texture + Texture
//  }
////  combine src1 - src2
//  SetTexture[_MainTex]{
//   combine Texture - Texture
//  }
////  combine src1 +- src2
//  SetTexture[_MainTex]{
//   combine Texture +- Texture
//  }
////  combine src1 lerp (src2) src3
//  SetTexture[_MainTex]{
//   combine Texture * primary
//  }
//  SetTexture[_Blend]{
//   combine Texture lerp (Texture)previous
//  }
////  combine src1 * src2 + src3
//  SetTexture[_MainTex]{
//   combine Texture * Texture + Texture
//  }
////  combine src1 * src2 +- src3
//  SetTexture[_MainTex]{
//   combine Texture *Texture +- Texture
//  }
////  combine src1 * src2 - src3
  SetTexture[_MainTex]{
   combine Texture * Texture - Texture
  }
//
  }//pass
 }//subshader
}//shader

 

 

 

 

 

 

 

 

 

Posted by 프리랜서 디자이너