하이어라키에 Sphere 구체 추가

ㅏ이어

폴더를 만든 후 Materials와 Shaders를 추가해준다

그 후

NewSurfaceShader를 New Material로 드래그해서 Assign

그 후

New Material을 Sphere에 드래그해서 Assign

코드 안에 내용들을 지워주는데 Input에 아무것도 없으면 오류가 난다.

이런식으로 프로티에 작성해주면 인스펙터에 생성이된다.

드래그한 코드

즉 o오브젝트에 Albedo를 float3(red, green, blue)를 할당하는데 red에만 1을 선언한 상태와 결과

 

Emission으로 바구면 평면으로 볼 수 있다.

 

Emission에 컬러속성을 할당 한후 값을 넣어주면

인스펙터에서 컬러창으로 색을 변경할 수 있다.

r g b에 각각 red blue green 변수를 선언후 할당한후

pow를 사용 pow(x,y) => x를 y 제곱

Red, Greed, Blue를 각각 이동하여 색을 변경할 수 있다.

BrightDarkness 변수 선언후 + 를 사용해서

Emission값을 flat(r,g,b)와 함께 사용

 

Texture 2D속성을 사용

float4 c = tex2D(_MainTex, IN.uv_MainTex);

그 후 만들어진 텍스쳐 필드에 텍스쳐 할당

https://docs.unity3d.com/Manual/SL-SurfaceShaders.html

 

Unity - Manual: Writing Surface Shaders

Surface Shaders and rendering paths Writing Surface Shaders In the Built-in Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. Mo

docs.unity3d.com

 

+ Recent posts