Version: 5.6
电影纹理
纹理数组

3D 纹理

Unity supports 3D Texture use and creation from shader and script. While use cases of 3D Textures might not seem as straightforward at first, they can be an integral part of implementing specific kinds of effects such as 3D Color Correction.

Currently, 3D Textures can only be created from script. The following snippet creates a “neutral” 3D texture where, if used as a lookup texture in 3D Color Correction, the performed correction will be the identity.

function CreateIdentityLut (dim : int, tex3D : Texture3D) 
{
  var newC : Color[] = new Color[dim * dim * dim];
  var oneOverDim : float = 1.0f / (1.0f * dim - 1.0f);
  for(var i : int = 0; i < dim; i++) {
    for(var j : int = 0; j < dim; j++) {
      for(var k : int = 0; k < dim; k++) {
        newC[i + (j*dim) + (k*dim*dim)] = new Color((i*1.0f)*oneOverDim, (j*1.0f)*oneOverDim, (k*1.0f)*oneOverDim, 1.0f);
      }
    }
  }
  tex3D.SetPixels (newC);
  tex3D.Apply ();
}

电影纹理
纹理数组
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961