unity(51)
-
0504 쉐이더 특정 부분만 반짝거리게 하기
방법 #1. Shader "Custom/rock" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _MainTex2("Albedo (RGB)", 2D) = "white" {} _BumpMap("Normal Map",2D) = "bump"{} _Glossiness ("Smoothness", Range(0,1)) = 0.5 } SubShader { Tags { "RenderType"="Opaque" } CGPROGRAM #pragma surface surf Standard sampler2D _MainTex; sampler2D _MainTex2; sampler2D _BumpMap; struct Input { float2 uv_MainTex; float2 ..
2021.05.04 -
0504 버텍스에 컬러 입히고 다중 텍스쳐 반영하기
Shader "Custom/test" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _MainTex2("Albedo (RGB)", 2D) = "white" {} _MainTex3("Albedo (RGB)", 2D) = "white" {} _MainTex4("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } CGPROGRAM #pragma surface surf Standard fullforwardshadows sampler2D _MainTex; sampler2D _MainTex2; sampler2D _MainTex3; sampler2D _MainTex4; str..
2021.05.04 -
0503 쉐이더를 이용해서 불 이펙트 만들기
Shader "Custom/Test" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Transparent" "Queue"="Transparent"} LOD 200 CGPROGRAM #pragma surface surf Standard alpha:fade sampler2D _MainTex; struct Input { float2 uv_MainTex; }; void surf (Input IN, inout SurfaceOutputStandard o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex); o.Emission = c.rgb; o.Alpha = c.a; ..
2021.05.03 -
0503 쉐이더 UV
가로는 U, 세로는 V 둘을 시각적으로 나타내기 void surf (Input IN, inout SurfaceOutputStandard o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = IN.uv_MainTex.x; } ENDCG void surf (Input IN, inout SurfaceOutputStandard o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = IN.uv_MainTex.y; } ENDCG Shader "Custom/Test" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _V("v value",Range(-1,1)) ..
2021.05.03 -
0503 쉐이더 기본
픽셀의 색을 정해주는 함수 Draw Call 드로우 콜이 높아질 수록 성능이 저하된다. 텍스쳐 1장당 1개의 드로우 콜이 생겨나므로, 아틀라스를 이용해 작업하면 드로우콜이 낮아진다. 랜더링 파이프라인 3D가상 공간의 물체를 화면의 픽셀의 색으로 출력하는 과정 1. 오브젝트 데이터를 받아온다. 2. 버텍스 쉐이더를 계산한다. (점들의 좌표 위치 계산) 3. 래스터라이즈 (만들어낸 면을 쪼개어 색을 칠할 수 있도록 편집) 4. 픽셀 쉐이더/프래그먼트 쉐이더 (텍스쳐를 칠한다.) 한 개의 픽셀은 3개의 서브픽셀로 이루어져 있다. 컬러들을 숫자로 인식한다. 한 픽셀의 색을 결정하는 코드를 픽셀 쉐이더라고 부른다. Adobe RGB(255,255,255) > float3(1.0,1.0,1.0) 으로 색상 연산이 ..
2021.05.03 -
0430 조이스틱으로 움직이고, 때리는 모션
using UnityEngine; using UnityEngine.UI; public class JoyStickTest : MonoBehaviour { public VariableJoystick variableJoystick; public Transform heroTrans; public float moveSpeed=1f; public CharacterController player; private Vector3 dir; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { StartCoroutine(RunImpl()); StartCoroutine(A..
2021.04.30