In working with Cinemachine & PostProcessing package I encountered an issue with using multiple virtual camera’s with different post processing overrides. My setup is as follows:
- Global Virtual Camera (A)
- Camera Zone B (inside building)
- Camera Zone C (inside another area inside the building)
In blending the camera’s between B & C, I noticed that most post processing settings were “snapping” instead! I would have expected the weight of volumes to be used so I looked into the CinemachinePostProcessing code, and found this:
CameraState state = brain.CurrentCameraState;
int numBlendables = state.NumCustomBlendables;
List<PostProcessVolume> volumes = GetDynamicBrainVolumes(brain, ppLayer, numBlendables);
for (int i = 0; i < volumes.Count; ++i)
{
volumes[i].weight = 0;
volumes[i].sharedProfile = null;
volumes[i].profile = null;
}
PostProcessVolume firstVolume = null;
int numPPblendables = 0;
for (int i = 0; i < numBlendables; ++i)
{
var b = state.GetCustomBlendable(i);
var profile = b.m_Custom as PostProcessProfile;
if (!(profile == null)) // in case it was deleted
{
PostProcessVolume v = volumes[i];
if (firstVolume == null)
firstVolume = v;
v.sharedProfile = profile;
v.isGlobal = true;
v.priority = s_VolumePriority - (numBlendables - i) - 1;
v.weight = b.m_Weight;
++numPPblendables;
}
#if true // set this to true to force first weight to 1
// If more than one volume, then set the frst one's weight to 1
if (numPPblendables > 1)
firstVolume.weight = 1;
#endif
At the bottom, note the #if true definition. Once I set this to false the blending seems to work as I would expect it to. However, I’m afraid of any unintended consequences that I may not be aware of. (and why this is “true by default”).
Is there a specific reason for this solution? Are there any known issues as to why this is set to TRUE? Couldn’t this just be a setting, what am I missing?