본문 바로가기
[ Unity ]/- 유니티 실습

유니티 FogEffect

by MRG 2024. 10. 11.
728x90
반응형

 

 

 

안개 효과 설정 방법
Unity 메뉴에서 설정하기: 안개 효과는 Lighting 설정 창에서 활성화할 수 있습니다.
Window > Rendering > Lighting 메뉴로 들어갑니다.
Scene 탭에서 Environment 섹션을 찾고, Fog 항목을 활성화합니다.

 

 

 

▣ 코드 설명
RenderSettings.fog = true;: 안개 효과를 활성화합니다.


RenderSettings.fogColor = Color.gray;: 안개의 색상을 설정합니다. 이 예시에서는 회색을 사용했습니다.


RenderSettings.fogDensity = 0.02f;: 안개의 밀도를 설정합니다. 값이 클수록 안개가 짙어집니다.


RenderSettings.fogStartDistance = 10f;, RenderSettings.fogEndDistance = 100f;: 안개가 적용되기 시작하는 거리와 끝나는 거리를 설정합니다. 이 설정은 안개가 선형으로 적용될 때 사용됩니다.


FogMode.Exponential: 거리에 따라 안개 밀도가 지수적으로 증가합니다. 이 방식은 안개가 거리가 멀어질수록 점진적으로 더 짙어지게 합니다.


mainCamera.clearFlags = CameraClearFlags.SolidColor;: 카메라가 Skybox 대신 Solid Color(단색)를 배경으로 사용하게 설정합니다.


mainCamera.backgroundColor = RenderSettings.fogColor;: 카메라의 배경색을 안개 색상과 일치시킵니다. 이렇게 하면 배경도 안개와 자연스럽게 어우러지는 효과를 얻을 수 있습니다.

 

 

 

https://docs.unity3d.com/2018.4/Documentation/Manual/PostProcessing-Fog.html

 

Unity - Manual: Deferred Fog

Deferred Fog The Fog effect overlays a color onto objects depending on how far away they are from the CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More

docs.unity3d.com

 

https://docs.unity3d.com/ScriptReference/RenderSettings-fogMode.html

 

Unity - Scripting API: RenderSettings.fogMode

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

https://docs.unity3d.com/ScriptReference/RenderSettings-fogColor.html

 

Unity - Scripting API: RenderSettings.fogColor

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

https://docs.unity3d.com/ScriptReference/RenderSettings-fogStartDistance.html

 

Unity - Scripting API: RenderSettings.fogStartDistance

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

728x90
반응형

댓글