본문으로 바로가기
반응형

시그라프 2007년도 자료.

Decal system 찾다가 발견. 적은 알파 테스팅 소스로 효과를 내기 좋을듯...


원문 : https://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf


//

     
       float distAlphaMask =  baseColor . a ;

              

        if (OUTLINE &&
        ( distAlphaMask >= OUTLINE_MIN_VALUE0 ) &&
        ( distAlphaMask <= OUTLINE_MAX_VALUE1 )  )
       
         {
 
      float oFactor =1.0;


      if ( distAlphaMask <= OUTLINE_MIN_VALUE1 )
        {
        oFactor=smoothstep ( OUTLINE_MIN_VALUE0,
                                      OUTLINE_MIN_VALUE1,
                                     distAlphaMask  ) ;
        }


          else

        {
        oFactor=smoothstep ( OUTLINE_MAX_VALUE1,
                                      OUTLINE_MAX_VALUE0,
                                      distAlphaMask  ) ;
         }

          baseColor = lerp ( baseColor ,  OUTLINE_COLOR,  oFactor  ) ;
        }


         if ( SOFT_EDGES ) {
            baseColor . a ∗ = smoothstep ( SOFT_EDGE_MIN,
                                                        SOFT_EDGE_MAX,
                                                       distAlphaMask  ) ;
          } else {
         baseColor . a = distAlphaMask >= 0.5;


         }


         if ( OUTER_GLOW ) {
 
         float4 glowTexel = tex2D (  BaseTextureSampler, i.baseTexCoord . xy+GLOW_UV_OFFSET  ) ;
         float4 glowc = OUTER_GLOW_COLOR ∗ smoothstep (
                             OUTER_GLOW_MIN_DVALUE,
                             OUTER_GLOW_MAX_DVALUE,
                             glowTexel . a  ) ;
 
          baseColor  =  lerp (  glowc ,  baseColor ,  mskUsed  );

반응형

'Technical Report > Graphics Tech Reports' 카테고리의 다른 글

Unity Special folder Name in Assets Folder  (0) 2016.06.13
Normal Blend  (0) 2016.04.01
splatting texture  (0) 2015.05.13
Mobile BumpMapping test  (0) 2015.04.30
Unity5 Preserve UVs 및 offset 처리  (0) 2015.04.10