/// <summary> /// キューブマップからSH係数を取得 /// </summary> static public Vector4[] GetSphericalHarmonics(Texture cubemap, uint band) { SHCalcData shData = new SHCalcData(cubemap); SHHelper shHelper = new SHHelper(band, shData.MapSize); Vector3[] shCoef = shHelper.CompressRGB(shData); int coefNum = s_SHCoefNum[band]; Vector4[] shScalingCoef = new Vector4[coefNum]; for (uint i = 0; i < coefNum; i++) { SHHelper.GetSphericalHarmonics(out shScalingCoef[i], ref shCoef[i], i); } return(shScalingCoef); }
/// <summary> /// /// </summary> public void Capture(GraphicsContext context, Action renderFunc, uint shBand = 0) { // レンダリング CubemapHelper.RenderingCubeMap(context, cubeMap_, depth_, Position, renderFunc); // PMREM if (radianceMap_ != null) { CubemapHelper.PrefilterRadiance(radianceMap_, cubeMap_); } // SH計算 if (shBand > 0) { SHCoef = SHHelper.GetSphericalHarmonics(cubeMap_, shBand); } }