본문 바로가기
유니티 엔진

Unity 3.5 신기능 : Gamma correction

by 대마왕J 2012. 1. 27.

Linear Lighting

선형 조명 

overview 총론 

Linear lighting refers to the process of illuminating a scene with all inputs being linear. Normally textures exist with gamma pre-applied to them this means that when the textures are sampled in a material that they are non linear. If these textures are used in the standard lighting equations it will lead to the result from the equation being incorrect as they expect all input to be linearized before use.
 리니어 라이팅(선형 조명) 은 빛 계산 프로세스에서 모든 들어오는 인풋 이미지가 리니어 하다는데 기인합니다. 일반적인 텍스쳐는 감마가 미리 적용되어 있으며, 이것은 텍스쳐가 메터리얼에서 샘플링 될 때 이미 리니어한 상태가 아니라는 (역주: 리니어 영역이 아닌, 감마 영역에 있다는 것) 을 의미합니다. 만약 이 텍스쳐가 표준 조명 방정식에 사용되면 이 결과는 , 모든 이미지는 사용되기 전에 리니어화 되길 기대했던 것으로 기인하여 옳지 않게 됩니다. (역주: 라이팅 계산은 모든 이미지가 리니어 영역에 있을것이라고 생각하고 계산되기 때문에, 감마 영역으로 이미지가 들어오면 옳지 않은 계산이 나오게 된다는 말입니다. 그런데, 지금 모든 이미지는 감마 영역으로 들어오고 있습니다)  

Linear lighting refers to the process of ensuring that both inputs and outputs of a shader are in the correct color space, this results in more correct lighting. 리니어 라이팅 기능은 쉐이더에서 인풋과 아웃풋 결과가 올바른 칼라 영역에 있게 해주는 것이고, 이것의 결과로 더 정확한 라이팅을 얻게 됩니다.

Existing (Gamma) Pipeline 현존하는(감마)파이프라인

In the existing rendering pipeline all colors and textures are sampled in gamma space, that is gamma correction is not removed from images or colors before they are used in a shader.
현존하는 렌더링 파이프라인에서는 모든 칼라와 텍스쳐는 감마 영역에서 셈플링 됩니다. 이것은 쉐이더에서 이미지나 칼라가 사용되기 전에 감마 영역이 제거되지 않는다는 것을 의미합니다.
 Due to this a situation arises where the inputs to the shader are in gamma space, the lighting equation uses these inputs as if they were in linear space and finally no gamma correction is applied to the final pixel. Much of the time this looks acceptable as the two wrongs go some way to cancelling each other out. But it is not correct.
 이것에 기인하여 쉐이더에서 감마 영역의 이미지가 인풋되게 되는 일이 발생하고, 조명 방정식은  이미지를 리니어 영역에 있는 것 처럼 사용하여 최종적으로는 마지막 픽셀에 감마 코렉션이 적용되지 않게 됩니다. 많은 기간동안 이것은 두 가지의 잘못이 서로를 상쇄시켜서 이것이 적합하게 보이도록 했습니다. 그러나 이것은 틀렸습니다.

Linear Lighting Pipeline 선형 조명 파이프라인

If linear lighting is enabled inputs to the shader program are supplied with the gamma correction removed from them. For colors this conversion is applied implicitly if you are in linear space.
만약 선형 조명이 활성화 되면 쉐이더 프로그램에 제공되는 것들이 감마 코렉션이 제거된채 제공됩니다. 당신이 선형 공간에 있다면 색상의 변환은 무조건 이루어집니다.
Textures are sampled using hardware sRGB reads, the source texture is supplied in gamma space and then on sampling in the graphics hardware the result is converted automatically. These inputs are then supplied to the shader and lighting occurs as it normally would. The resultant value is then written to the framebuffer. This value will either be gamma corrected and written to the framebuffer, of left in linear space for later gamma correction; this depends on the current rendering configuration.
텍스쳐는 하드웨어 sRGB로 샘플링되고, 이 소스 텍스쳐는 감마 공간으로 제공되고 그리고 그래픽 하드웨어에서 샘플링되어 자동적으로 변환됩니다. 이들 인풋은 그리고 쉐이더와 라이팅에서는 일반적으로 제공됩니다. 결과 값은 또한 프레임 버퍼에 씌여집니다. 이 감마 코렉션 된 값과 프레임 버퍼에 씌여진 두 값은, 리니어 스페이스에 남습니다 나중의 감마 코렉션을 위해 ; 이것은 렌더링 설정에 달렸습니다.

Differences Between Linear and Gamma Lighting
선형 / 감마 라이팅의 차이

When using linear lighting input values to the lighting equations are different than in gamma space. This means that as lights striking surfaces will have a different response curve to what the existing Unity rendering pipeline has.
 리니어 인풋 값을 라이팅 방정식에 쓰면 감마 영역을 쓰는 것과 다릅니다. 이것의 의미는 기존에 존재하는 유니티의 렌더링 파이프라인의 결과 값과는 다른 조명 커브 결과물을 나타낸다는 것을 의미합니다.

Light Falloff 조명 감쇄

The falloff from distance and normal based lighting is changed in two ways.
거리에 따른 감쇄와 노말 베이스의 라이트는 두 가지로 변합니다. 
Firstly when rendering in linear mode the additional gamma correct that is performed will make light radius' appear larger.
 첫 번째로 추가적인 감마 코렉션이 적용된채 선형 모드로 렌더링 되면 빛의 영역이 커집니다.
Secondly lighting edges will also be harsher. This more correctly models lighting intensity falloff on surfaces.
 두 번째로 빛의 경계가 거칠게 됩니다. 이것은 더 정확한 모델 라이팅 밝기 감쇄가 표면에 이뤄집니다. (주: 뭔소리야)

(주: 아무래도 그림이 서로 바뀐게 아닌가...)

 

Linear Intensity Response 선형 강도 반응

When you are using gamma space lighting the colors and textures that are supplied to a shader have a gamma correction applied to them. When they are used in a shader the colors of high luminance are actually brighter then they should be for linear lighting.
당신이 감마스페이스 라이팅을 사용할때 쉐이더에 쓰이는 칼라와 텍스쳐는 감마 커랙션이 적용됩니다.
그들이 쉐이더에서 사용될 때 밝은 칼라는 실제로 리니어 영역보다 더 밝아지게 됩니다.
 
This means that as light intensity increases the surface will get brighter in a non linear way. This leads to lighting that can be too bright in many places, and can also give models and scenes a washed out feel. When you are using linear lighting, as light intensity increases the response from the surface remains linear. This leads to much more realistic surface shading and a much nicer color response in the surface.
 이것의 의미는 조명의 표면 밝기 증가는 선형 상태보다 더 밝다는 것입니다. 이것은 많은 경우에서 조명이 너무 밝게 나타나게 합니다. 그리고 모델과 신이 하얗게 타게 만듭니다. 당신이 선형 라이팅을 쓰게 되었을 때에는, 밝기 강도가 표면에 있는 선형에 반으앟여 올라갑니다. 이것은 보다 실감나는 표면 쉐이딩과 보다 괜찮은 표면 칼라 반응을 주도합니다.

Infinite, 3D Head Scan by Lee Perry-Smith is licensed under a Creative Commons Attribution 3.0 Unported License. Available from: http://www.ir-ltd.net/infinite-3d-head-scan-released

Linear and Gamma Blending 선형과 감마 블렌딩

When performing blending into the framebuffer the blending occurs in the color space or the framebuffer. When using gamma rendering this means that non linear colors get blended together. This is incorrect. When using linear space rendering blending occurs in linear space, this is correct and leads to expected results.
 프레임 버퍼에서 칼라 블렌딩이 일어날 때는 프레임 버퍼의 칼라 영역 안에서 일어납니다. 감마 렌더링이 사용되었을 때에는 이것은 블렌딩이 서로 선형 공간에서 일어나지 않는다는 것을 의미합니다. 이것은 옳지 않습니다. 만약 선형 공간 렌더링 블렌딩이 선형 공간에서 일어났을때, 이것은 옳으며 기대한 결과가 나올 것입니다.

Using Linear Lighting 선형 조명 사용하기

Linear lighting results in a different look to the rendered scene. If you author a project for linear lighting it will most likely not look correct if you change to gamma lighting. Because of this if you move to linear lighting from gamma lighting it may take some time to update the project so that it looks as good as before the switch. That being said enabling linear lighting in Unity is quite simple. The feature is implemented on a per project level and is exposed in the Player Settings which can be located at Edit -> Project Settings -> Player -> Other Settings
선형 조명 결과는 렌더된 신에서 다르게 보입니다. 만약 당신이 프로젝트를 선형 라이팅에서 만들었다면 그것은 만약 당신이 감마 라이팅으로 바꾸면 씬이 옳지 않게 보일 것입니다. 때문에  만일 당신이 감마 조명에서 선형 조명으로 이동했다면 업데이트하는데 시간이 좀 걸릴 것이고 고치기 전보다 나아 보일 것입니다. 이것은 유니티에서 선형 조명으로 만드는게 무척 간단하다는 것을 의미합니다. 이 기능은 매 프로젝트 레벨에 장착되어 있고 플레이어 셋팅에 노출되어 있습니다. 이것은 Edit -> Project Settings -> Player -> Other Settings 에 위치하고 있습니다.

Lightmapping 라이트맵핑

When you are using linear lighting all lighting and textures are linearized, this means that the values that are passed to the lightmapper also need to be modified. When you switch between linear lighting and gamma lighting or back you will need to rebake lightmaps. The Unity lightmapping interface will warn you when the lightmaps are in the incorrect color space.
 당신이 선형 조명을 사용할 때 모든 라이팅과 텍스쳐는 선형되어집니다. 이 의미는 라이트맵퍼를 지나가는 값들도 모두 수정될 필요가 있다는 말입니다. 당신이 선형 조명과 감마 조명사이를 스위치하거나 다시 돌아갈 때 당신은 라이트맵을 다시 구워야 할 필요가 있습니다. 유니티 라이트맵 인터페이스는 라이트맵이 올바르지 않은 조명 영역일 때 경고를 할 것입니다.

Supported Platforms 지원 플렛품

Linear rendering is not supported on all platforms. The build targets that currently support the feature are:
 선형 렌더링은 모든 플렛폼에서 지원하지는 않습니다. 현재 기능을 지원하는 빌드 타겟은 :

  • Standalone PC player
  • Standalone Mac player
  • OSX Webplayer
  • PC Webplayer

Even though these targets support linear lighting, it is not guaranteed that the graphics hardware on the device will be able to render the scene properly.
비록 이 타겟들이 선형 라이팅을 지원하더라도, 그래픽 하드웨어 디바이스들이 이 기능을 적당하기 지원할지는 보장되지 않습니다.
 You can check the desired color space and the active supported color space by looking at PlayerSettings.desiredColorSpace and PlayerSettings.activeSupportedColorSpace if the desired color space is linear but the active color space is gamma then the player has fallen back to gamma space.
당신은 원하는 칼라 스페이스와 실행되는 칼라 스페이스를 PlayerSettings.desiredColorSpace  와 PlayerSettings.activeSupportedColorSpace  에서 체크할 수 있습니다. 만약 원하는 칼라 스페이스가 선형인데, 실행되고 있는 칼라 스페이스는 감마라면 플레이어가 감마 스페이스로 떨어져 버린것입니다. 
 This can be used to show a warning box telling the user that the application will not look correct for them or to force an exit from the player. 이것은 유저에게 이 이미지가 제대로 보이지 않는다고 경고하거나 플레이어에서 나가게 할 때 사용될 수 있습니다.

Linear and Non HDR 선형과 non HDR (주: Non - High Dynamic Range)

When not using HDR a special framebuffer type is used that supports sRGB read and sRGB write (Degamma on read, Gamma on write).
 HDR이 사용되지 않을때 스페셜한 프레임버퍼 타입이 sRGB 읽기와 쓰기에 사용됩니다. (감마없앰으로 읽고, 감마 있음으로 쓴다)
This means that just like a texture the values in the framebuffer are gamma corrected. When this framebuffer is used for blending or bound as texture the values have the gamma removed before being used.
이 의미는 프레임버퍼 안의 텍스쳐의 값이 올바르다는 것을 의미한다. 이 프레임 버퍼가 블렌딩이나 텍스쳐 바운드에 사용되면 감마 값은 사용되기 전에 제거된다.
When these buffers are written to the value that is being written is converted from linear space to gamma space. If you are rendering in linear mode, all post process effects will have their source and target buffers created with sRGB read and write enabled so that post process and post process blending occurs in linear space.
 이런 버퍼들이 값에 씌여질 때는 선형에서 감마 영역으로 컨버팅됩니다. 만일 당신이 선형 모드에서 렌더링하면, 모든 후처리 이펙트는 그들의 소스와 타겟 버퍼를 sRGB로  읽기와 쓰기가 가능하게 만들고 그래서 이 후처리 효과들은 선형 공간 안에서 블렌딩되게 됩니다.  

Linear and HDR 선형과 HDR

When using HDR, rendering is performed into floating point buffers. These buffers have enough resolution to not require conversion to an from gamma space whenever the buffer is accessed, this means that when rendering in linear mode the render targets you use will store the colors in linear space.
HDR이 사용되면, 렌더링은 플로팅 포인트 버퍼들로 행해집니다. 이 버퍼들은 충분한 해상도를 가지고 있어서 감마 공간에서 어떤 버퍼가 접근하던지 간에 컨버팅이 필요하지 않습니다. 이 의미는 선형 모드에서 렌더링 되는 당신의 렌더 타겟은 선형 공간 안에 저장이 된다는 것을 의미합니다.
 This means that all blending and post process effects will implicitly be performed in linear space. When the the backbuffer is written to, gamma correction is applied.
 이 의미는 모든 블렌딩과 후처리 효과들은 무조건 선형 공간에서 이루어 진다는 것을 의미합니다. 백버퍼가 씌여질 때, 감마 코렉션은 적용됩니다.  (주: HDR로 사용되면 라이팅 영역이 넓어서 변환 자체가 필요 없이 그냥 쓸 수 있다는 뜻입니다)

GUI and Linear Authored Textures 인터페이스와 선형으로 제작된 텍스쳐들

When rendering Unity GUI we do not perform the rendering in linear space. This means that GUI textures should not have their gamma removed on read. This can be achieved in two ways.
 유니티 GUI가 렌더링 될 때 우리는 선형 공간으로 작업을 하지 않습니다. 이 의미는 인터페이스 텍스쳐는 읽을때 감마가 제거되지 않는다는 것을 의미합니다. 이것은 두 가지 방법을 도달할 수 있습니다.

  • Set the texture type to GUI in the texture importer
    텍스쳐 타입을 임포트 할때 GUI로 지정하시오
  • Check the 'Sample in Linear Space' checkbox int the texture importer
    임포터에서 'Sample in Linear Space' 체크박스를 체크하시오  

This will force the sampled texture to not have gamma removed before being used by the graphics hardware. This is also useful for other texture types such as masks where you wish the value that is passed to the shader to be the exact same value that is in the authored texture.
 이것은 샘플링된 텍스쳐가 그래픽 하드웨어에서 사용되기전에 감마가 제거되지 않도록 해줍니다. 이것은 또한 마스킹 같은 다른 타입의 유용한 텍스쳐들 -  여러분이 만든 값이 정확하게 쉐이더에 전달되기를 바라고 제작한 텍스쳐 - 등에 유용할 것입니다.

Page last updated: 2011-12-01
반응형

댓글