본문 바로가기
게임 개발 일지/내일배움캠프 TIL

3D - Light / AnimationCurve / 글꼴 생성

by 빛하_ 2023. 12. 14.

 

 

드디어 3D 게임으로 넘어왔다!

 

Unity_3D project 주요 포인트

 

1. 3D 에서 사용하는 Light

3D 에서 Light 는 입체감을 주는 매우 중요한 요소.

하지만 메모리 사용을 많이 하는 소스이기 때문에 남발하면 프로젝트에 부하가 걸릴 수 있으니 주의할 것.

 

3D에서 빛을 조절할 때 사용하는 변수들

RenderSettings.ambientIntensity : 풍경광

RenderSettings.reflectionIntensity : 반사광

 

 

2.  Light, Gradient, AnimationCurve 이용해 낮/밤 표현하기

    private void Update()
    {
        time = (time + timeRate * Time.deltaTime) % 1.0f;

        UpdateLighting(sun, sunColor, sunIntensity);
        UpdateLighting(moon, moonColor, moonIntensity);

        RenderSettings.ambientIntensity = lightingIntensityMultiplier.Evaluate(time);
        RenderSettings.reflectionIntensity = reflectionIntensityMultiplier.Evaluate(time);
    }
    
    void UpdateLighting(Light lightSource, Gradient colorGradiant, AnimationCurve intensityCurve)
    {
        float intensity = intensityCurve.Evaluate(time);

        lightSource.transform.eulerAngles = (time - (lightSource == sun ? 0.25f : 0.75f)) * noon * 4.0f;
        lightSource.color = colorGradiant.Evaluate(time);
        lightSource.intensity = intensity;

        GameObject go = lightSource.gameObject;
        if (lightSource.intensity == 0 && go.activeInHierarchy)
            go.SetActive(false);
        else if (lightSource.intensity > 0 && !go.activeInHierarchy)
            go.SetActive(true);
    }

 

curve 에 key를 처음 찍어봐서 헷갈렸다.

곡선-직선도 제멋대로 나가서 수정하느라 시간이 걸렸다.

코딩에 수학적 지식 또한 중요하다는 것을 깨닫는 하루!

 

 

3. 글꼴 생성 시 유의사항

글꼴 적용할 때 OTF 쓰지 말자!

TTF 사용해야 윈도우에서 깨지지 않는다.

 

 


내일부터 시작할 팀 프로젝트도 파이팅!!

 

 

댓글