카메라 이미지 이펙트 만들기 - 기초지식, 반전효과

[공부한 걸 정리하는 글이므로 자세한 내용은 알아갈 수 없습니다.]

[혹시라도 배우기 위해 제 블로그를 찾아주신거라면 다른 블로그를 찾아주시면 감사드리겠습니다.]

 

 

 

필요한 사전 이해가 필요한 API

https://docs.unity3d.com/kr/530/ScriptReference/Graphics.Blit.html

 

Unity - 스크립팅 API: Graphics.Blit

This is mostly used for implementing image effects. Blit sets dest as the render target, sets source _MainTex property on the material, and draws a full-screen quad. Note that if you want to use depth or stencil buffer that is part of the source (Render)te

docs.unity3d.com

 

Graphics.Blit

카메라에 랜더링할 이미지를 교체해주는 작업이라고 생각하면 됨 자세한 내용은 확인

 

https://docs.unity3d.com/kr/530/ScriptReference/MonoBehaviour.OnRenderImage.html

 

Unity - 스크립팅 API: MonoBehaviour.OnRenderImage(RenderTexture,RenderTexture)

포스트프로세싱 효과. 쉐이더 기반의 필터로 처리하여 최종 이미지를 변경할 수 있습니다. incoming 이미지는 source 렌더텍스쳐입니다. 결과로는 destination render texture. You must always issue a Graphics.Blit()

docs.unity3d.com

OnRenderImage()

OnDestroy()나 Update같이 특정 상황에 발동되는 함수로 화면에 랜더링 될때

최종이미지를 변경하기 위해 사용되는 함수

 

 

 

 

 

 

 

 

위의 스크립트들을 이용해서  이미지 이펙트 쉐이더작성하고 머테리얼로 만들어 넣어주면 된다.

 

1번째 결과물 인버스 쉐이더

 

 

이미지 이펙트 쉐이더 작성시 주의할 점

 

Cull off ( 모델의 앞 뒤 모두 랜더링 해야하고)

ZWrite off ( 뒤에있는 오브젝트들이 랜더링 되도록 해야한다)

자세한 내용

https://m.blog.naver.com/PostView.nhn?blogId=ateliersera&logNo=220398051030&proxyReferer=https:%2F%2Fwww.google.com%2F

 

알기 쉬운 유니티 쉐이더 강좌 #004 -ShaderLab : Culling & Depth Testing / Blending / Tags / Pass Tags

이번엔 앞에서 언급한 컬링과 뎁스 테스팅, 블랜딩 등에 대해서 알아보겠습니다. Culling & Depth T...

blog.naver.com

 

 

  Comments,     Trackbacks