Skip to content

Instantly share code, notes, and snippets.

@hvent90
Created April 9, 2020 17:30
Show Gist options
  • Save hvent90/c0c9aca703415d6d60b96b5b886bfcc4 to your computer and use it in GitHub Desktop.
Save hvent90/c0c9aca703415d6d60b96b5b886bfcc4 to your computer and use it in GitHub Desktop.
Editing Volumetric Fog during runtime
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
public class VolumetricController : MonoBehaviour
{
[Range(-1f, 1f)]
public float anistropy;
[Range(0, 1)]
public float ambientLightProbedimmer = 1;
Volume volume;
Fog fog;
void Start()
{
volume = GetComponent<Volume>();
volume.profile.TryGet<Fog>(out fog);
}
void Update()
{
fog.anisotropy.value = anistropy;
fog.globalLightProbeDimmer.value = ambientLightProbedimmer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment