浏览代码

Make single scattering albedo a color for better GUI

/sample_game
Evgenii Golubev 7 年前
当前提交
420ba926
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 16
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs
  2. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute

16
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs


public class VolumeParameters
{
public Bounds bounds; // Position and dimensions in meters
public Vector3 albedo; // Single scattering albedo [0, 1]
public Color albedo; // Single scattering albedo [0, 1]
public Vector3 meanFreePath; // In meters [0.01, inf]
public float asymmetry; // [-1, 1]; 0 = isotropic

albedo = new Vector3(0.5f, 0.5f, 0.5f);
albedo = new Color(0.5f, 0.5f, 0.5f);
asymmetry = 0.0f;
asymmetry = 0.0f;
}
public bool IsVolumeUnbounded()

public Vector3 GetScatteringCoefficient()
{
return new Vector3(albedo.x / meanFreePath.x, albedo.y / meanFreePath.y, albedo.z / meanFreePath.z);
return new Vector3(albedo.r / meanFreePath.x, albedo.g / meanFreePath.y, albedo.b / meanFreePath.z);
}
public Vector3 GetExtinctionCoefficient()

Vector3 extinction = absorption + scattering;
meanFreePath = new Vector3(1.0f / extinction.x, 1.0f / extinction.y, 1.0f / extinction.z);
albedo = new Vector3(scattering.x * meanFreePath.x, scattering.y * meanFreePath.y, scattering.z * meanFreePath.z);
albedo = new Color(scattering.x * meanFreePath.x, scattering.y * meanFreePath.y, scattering.z * meanFreePath.z);
Constrain();
}

bounds.size = Vector3.Max(bounds.size, Vector3.zero);
albedo.x = Mathf.Clamp01(albedo.x);
albedo.y = Mathf.Clamp01(albedo.y);
albedo.z = Mathf.Clamp01(albedo.z);
albedo.r = Mathf.Clamp01(albedo.r);
albedo.g = Mathf.Clamp01(albedo.g);
albedo.b = Mathf.Clamp01(albedo.b);
meanFreePath.x = Mathf.Max(meanFreePath.x, 0.01f);
meanFreePath.y = Mathf.Max(meanFreePath.y, 0.01f);

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute


// Inputs & outputs
//--------------------------------------------------------------------------------------------------
TEXTURE2D(_DepthTexture); // Z-buffer
TEXTURE2D(_DepthTexture); // Z-buffer
RW_TEXTURE2D(float4, _CameraColorTexture); // Updated texture
//--------------------------------------------------------------------------------------------------

正在加载...
取消
保存