|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var cmd = new CommandBuffer { name = "" }; |
|
|
|
|
|
|
|
// All parameters are neutral because exposure/multiplier have already been applied in the first copy.
|
|
|
|
SkyParameters skyParams = new SkyParameters(); |
|
|
|
skyParams.exposure = 0.0f; |
|
|
|
skyParams.multiplier = 1.0f; |
|
|
|
skyParams.rotation = 0.0f; |
|
|
|
skyParams.skyHDRI = input; |
|
|
|
RenderSkyToCubemap(skyParams, target, renderLoop); |
|
|
|
cmd.CopyTexture(input, target); |
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
// 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); |
|
|
|
|
|
|
|
var cmd = new CommandBuffer { name = "" }; |
|
|
|
|
|
|
|
cmd.DrawMesh(m_CubemapFaceMesh[face], Matrix4x4.identity, m_GGXConvolveMaterial, 0, 0, propertyBlock); |
|
|
|
renderLoop.ExecuteCommandBuffer(cmd); |
|
|
|
cmd.Dispose(); |
|
|
|