Unity(3)
-
Blinn Phong, rim light를 이용한 specular
Blinn phong은 라이팅의 한 방법인데 reflection vector와 view vector간의 내적을 이용한 빛 표현이다. 그런데 reflection vector 구하는 방법이 까다롭고 오래걸리기 때문에 H vector과 Normal vector을 내적해서 구하기도 한다 그러면 실제 Blinn phong과 별로 차이가 나지 않은 결과를 얻을 수 있어서 많이 이용한다고 한다. H vector는 (L+v) / 2로 구할 수 있다. Unity에서는 Blinn phong 의 구현을 H = lightvector + viewvector로 구해주고 normalize하여 h vector를 구한다. 그리고는 normal과 h를 내적한다. float3 H = normalize(lightDir + viewDir);..
2023.02.20 -
CustomLight
Lambert 라이팅 빛의 음영만 계산하고 specular는 계산하지 않는 라이팅이다. Shader "Custom/CustomLight" { Properties { _Color ("Color", Color) = (1,1,1,1) _MainTex ("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } CGPROGRAM #pragma surface surf Lambert noambient sampler2D _MainTex; struct Input { float2 uv_MainTex; }; fixed4 _Color; void surf (Input IN, inout SurfaceOutput o) { // Albedo comes..
2023.02.13 -
두 개의 texture 섞기, texture coordinate, 텍스쳐 time 설정하기
해당 내용은 유니티 쉐이더 스타트업 책을 바탕으로 만들어졌습니다. http://www.yes24.com/Product/Goods/58495827 유니티 쉐이더 스타트업 - YES24 유니티 쉐이더 스타트업 www.yes24.com 유니티 texture 두 개를 섞어서 표현해주기 https://assetstore.unity.com/packages/2d/textures-materials/tiling-textures-3d-microgame-add-ons-174461 Tiling Textures - 3D Microgame Add-Ons | 2D 텍스처 및 소재 | Unity Asset Store Elevate your workflow with the Tiling Textures - 3D Microgame Add..
2023.02.04