- Home /
Question by
RLin · Sep 19, 2015 at 07:47 PM ·
lodlodgrouprealtime reflection
Per-Camera LOD bias/max LOD
I generally have 2 cameras used in my scene, one for the actual scene rendering and another to render realtime reflections. Is it possible to have a per-camera LOD bias or max LOD so the camera rendering realtime reflections will render less detailed models?
Comment
Answer by einWikinger · Jul 20, 2017 at 08:29 AM
A solution that works for me is to change the global QualitySettings.lodBias in OnPreCull() and setting it back in OnPostRender(). It won't work when changing it in OnPreRender() because it is already too late in the render loop to change there.
class CustomLodBias : MonoBehaviour
{
public float LodBiasFactor = 1F;
float originalLodBias = 0F;
private void OnPreCull()
{
originalLodBias = QualitySettings.lodBias;
QualitySettings.lodBias = originalLodBias * LodBiasFactor;
}
private void OnPostRender()
{
QualitySettings.lodBias = originalLodBias;
}
}
Attach the script to any camera where you want to set a custom lodBias offset.