|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Copy the first mip.
|
|
|
|
|
|
|
|
// TEMP code until CopyTexture is implemented for command buffer
|
|
|
|
// All parameters are neutral because exposure/multiplier have already been applied in the first copy.
|
|
|
|
SkyParameters skyParams = new SkyParameters(); |
|
|
|
skyParams.exposure = 0.0f; |
|
|
|
|
|
|
RenderSkyToCubemap(skyParams, target, renderLoop); |
|
|
|
// End temp
|
|
|
|
|
|
|
|
//
|
|
|
|
//for (int f = 0; f < 6; f++)
|
|
|
|
// Graphics.CopyTexture(input, f, 0, target, f, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Do the convolution on remaining mipmaps
|
|
|
|
float invOmegaP = (6.0f * input.width * input.width) / (4.0f * Mathf.PI); // Solid angle associated to a pixel of the cubemap;
|
|
|
|
|
|
|
for (int face = 0; face < 6; ++face) |
|
|
|
{ |
|
|
|
Utilities.SetRenderTarget(renderLoop, target, mip, (CubemapFace)face); |
|
|
|
Camera faceCamera = m_CubemapFaceCamera[face].GetComponent<Camera>(); |
|
|
|
|
|
|
|
|
|
|
|
var cmd = new CommandBuffer { name = "" }; |
|
|
|
cmd.DrawMesh(m_CubemapFaceMesh[face], Matrix4x4.identity, m_GGXConvolveMaterial, 0, 0, propertyBlock); |
|
|
|
renderLoop.ExecuteCommandBuffer(cmd); |
|
|
|