유니티B과정224 [팀 프로젝트] - 랜덤 워크와 이진 공간 분할 알고리즘(맵 생성2) using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using Random = UnityEngine.Random; public class SimpleRandomWalkDungeonGenerator : MonoBehaviour { [SerializeField] protected Vector2Int startPosition = Vector2Int.zero; [SerializeField] private int iterations = 10; [SerializeField] public int walkLenght = 10; [SerializeField] public b.. 2021. 11. 29. [팀 프로젝트] - 랜덤 워크와 이진 공간 분할 알고리즘(맵 생성) 맵을 생성하기 위한 절차적 생성 알고리즘 using System.Collections; using System.Collections.Generic; using UnityEngine; public static class ProceduralGenerationAlgorithms { public static HashSet SimpleRandomWalk(Vector2Int startPosition, int walkLenght) { HashSet path = new HashSet(); path.Add(startPosition); //시작 var previousPosition = startPosition; for (int i = 0; i < walkLenght; i++) { var newPosition = previ.. 2021. 11. 26. [팀 프로젝트] - 랜덤 워크와 이진 공간 분할 알고리즘 맵(셋팅) Procedural 2D Dungeon In Unity P1 - Introduction - YouTube 참고 유튜브 맵 리소스 확인 스프라이트 에디터 확인 프로그램 세팅즈에서 안티앨리어싱 없게 한다 셋팅 끝 2021. 11. 26. [팀 프로젝트] Enemy Animation 2021. 11. 24. [게임 그래픽] Shader - Polybrush 패키기 매니저에서 Unity Registry에서 poly를 치면 Polybrush가 있다 1.1.2 최신 버전을 다운 받는다 유니티 화면에서 Tool을 보면 polybrush가 생겨 있다 3번째를 눌러서 Brush로 색을 칠 할 수 있다 outer Radius : 브러쉬 크기 조정 Flood : 한꺼번에 전부 칠하기 색깔을 이용해서 이런 식으로 만들 수 있다 '*'사용 o.Emission = c.rgb * IN.color.rgb; '+' 사용 o.Emission = c.rgb + IN.color.rgb; 1950 2021. 11. 18. [게임 그래픽] Shader - UV(Fire) Qued 오브젝트생성 Fire Meterial 만들고 Fire Shader 만들어 Shader -> Meterial에 넣어주고 Meterial -> Qued를 넣어준다 Texture 넣어준다 코드 Shader "Custom/Fire" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" { } _Texture2 ("texture2", 2D) = "white" { } } SubShader { Tags { "RenderType"="Opaque" "Queue"="Transparent"} CGPROGRAM #pragma surface surf Standard alpha:fade sampler2D _MainTex; sampler2D _Texture2; struct In.. 2021. 11. 18. [게임 그래픽] Shader - UV(좌표계) 3D -> Qued 오브젝트 생성 MyMeterial을 Qued 오브젝트에 넣어준다 코드 Shader "Custom/MyShader" { Properties { _Texture ("texture", 2D) = "white" {} _UValue ("u value", Range(0, 1)) = 0 } SubShader { Tags { "RenderType"="Opaque" } CGPROGRAM #pragma surface surf Standard struct Input { float2 uv_Texture; }; sampler2D _Texture; float _UValue; void surf (Input IN, inout SurfaceOutputStandard o) { float2 a = float2(IN.u.. 2021. 11. 18. [게임 그래픽] Shader - Lerp Red Shader 에서 Cube를 지워준다 Plane 오브젝트 생성 에셋 다운 받고 넣어주고 코드창에 Properties 내부에 작성 _Lerp는 tecture1 -> tecture2 로 0~1로 넘어간다 Properties { _Texture1 ("texture 1", 2D) = "white" {} _Texture2 ("texture 2", 2D) = "white" {} _Lerp ("lerp", Range(0, 1)) = 0 } texture1, texture2 공간이 생기고 에셋을 각각 넣어준다 struct Input //Input이 비어있으면 에러가 난다 (아무거나 라도 써야함) { float2 uv_Texture1; float2 uv_Texture2; }; sampler2D _Texture1;.. 2021. 11. 18. [게임 그래픽] Shader - Red Meterials 생성 Shaders 생성 Meterials 폴더 안에 MyMeterial 생성 -> 색상 레드 Shaders 폴더 안에 MtShader 생성 Cube 오브젝트 생성 재료로 MyMeterial을 넣어주고 MyShader를 MyMeterial에 넣어 준다 제일 간단하게 만든 코드 Shader "Custom/MyShader" // (/)경로 (반드시 같을 필요는 없다.) { Properties //inspector창 { _Color ("Color", Color) = (1,1,1,1) //_MainTex ("Albedo (RGB)", 2D) = "white" {} //_Glossiness ("Smoothness", Range(0,1)) = 0.5 //매끈해짐 //_Metallic ("Metal.. 2021. 11. 17. [게임 그래픽] Shader 모를 때 참고 ShaderLab: 프로퍼티 - 작성 https://docs.unity3d.com/kr/530/Manual/SL-Properties.html 서피스 쉐이더 작성 - 인풋 아웃풋 https://docs.unity3d.com/kr/530/Manual/SL-SurfaceShaders.html 표면 쉐이더의 예시 https://docs.unity3d.com/kr/530/Manual/SL-SurfaceShaderExamples.html 표면 쉐이더 라이팅의 예시 https://docs.unity3d.com/kr/530/Manual/SL-SurfaceShaderLightingExamples.html cg 다큐 cg programming tex2D 쉐이더란? -화면에 출력 하는 필셀의 색을 정해주는 함.. 2021. 11. 17. 이전 1 2 3 4 5 6 ··· 23 다음