Ejemplo n.º 1
0
        public static void UpdateMultiScatteringDensity(
            RenderTexture target,
            RenderTexture TransmittanceLUT,
            RenderTexture SingleScatteringLUTRayleigh,
            RenderTexture SingleScatteringLUTMie,
            RenderTexture MultiScatteringOfLastOrder,
            RenderTexture GroundDirectIrradianceLUT,
            int scatteringOrder,
            AtmLutGenerateConfig lutConfig,
            float start = 0.0f,
            float end   = 1.0f
            )
        {
            int xStart, xEnd;

            NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
            computeShader.SetInts("_ThreadOffset", xStart, 0, 0);

            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "TransmittanceLUT", TransmittanceLUT);
            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "SingleRayleighScatteringLUT", SingleScatteringLUTRayleigh);
            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "SingleMieScatteringLUT", SingleScatteringLUTMie);
            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "IrradianceLUT", GroundDirectIrradianceLUT);
            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "MultipleScatteringLUT", MultiScatteringOfLastOrder);
            computeShader.SetInt("ScatteringOrder", scatteringOrder);
            computeShader.SetTexture(CalculateMultipleScatteringDensityLUT, "MultipleScatteringDensityResult", target);
            computeShader.Dispatch(CalculateMultipleScatteringDensityLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
        }
Ejemplo n.º 2
0
 public static void CreateMultiScatteringDensityTexture(
     ref RenderTexture result,
     AtmLutGenerateConfig lutConfig
     )
 {
     CreateLUT(ref result, "MultiScatteringDensity", lutConfig.scatteringSize.x, lutConfig.scatteringSize.y, lutConfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
 }
Ejemplo n.º 3
0
 public ProgressiveLutUpdater(AtmosphereConfig atmConfig, AtmLutGenerateConfig lutConfig, ITimeLogger logger = null)
 {
     this.atmConfigToUse   = atmConfig;
     this.lutConfig        = lutConfig;
     this.logger           = logger;
     working               = false;
     atmConfigUsedToUpdate = ScriptableObject.CreateInstance <AtmosphereConfig>();
 }
Ejemplo n.º 4
0
 public static void ClearFinalCombinedIrradiance(
     RenderTexture target,
     AtmLutGenerateConfig lutConfig
     )
 {
     computeShader.SetTexture(ClearCombineGroundIrradianceLUT, "GroundIrradianceSumTarget", target);
     computeShader.Dispatch(ClearCombineGroundIrradianceLUT, lutConfig.irradianceSize.x / 32, lutConfig.irradianceSize.y / 32, 1);
 }
Ejemplo n.º 5
0
 public static void ClearFinalCombinedMultiScatter(
     RenderTexture multiScatteringTarget,
     AtmLutGenerateConfig lutConfig
     )
 {
     computeShader.SetTexture(ClearCombineMultipleScatteringLUT, "ScatteringSumTarget", multiScatteringTarget);
     computeShader.Dispatch(ClearCombineMultipleScatteringLUT, lutConfig.scatteringSize.x / 8, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
 }
Ejemplo n.º 6
0
 public static void CreateFinalCombinedTexture(
     ref RenderTexture MultipleScatteringLUT,
     ref RenderTexture IrradianceLUT,
     AtmLutGenerateConfig lutConfig
     )
 {
     CreateLUT(ref MultipleScatteringLUT, "Multiple Scattering Combined Final", lutConfig.scatteringSize.x, lutConfig.scatteringSize.y, lutConfig.scatteringSize.z, RenderTextureFormat.ARGBFloat, true);
     CreateLUT(ref IrradianceLUT, "Irradiance Combined Final", lutConfig.irradianceSize.x, lutConfig.irradianceSize.y, 0, RenderTextureFormat.ARGBFloat, true);
 }
Ejemplo n.º 7
0
 public static void UpdateFinalCombinedIrradiance(
     RenderTexture target,
     RenderTexture irradianceOfSingleOrder,
     AtmLutGenerateConfig lutConfig
     )
 {
     computeShader.SetTexture(SumGroundIrradianceLUT, "GroundIrradianceSumTarget", target);
     computeShader.SetTexture(SumGroundIrradianceLUT, "GroundIrradianceSumAdder", irradianceOfSingleOrder);
     computeShader.Dispatch(SumGroundIrradianceLUT, lutConfig.irradianceSize.x / 32, lutConfig.irradianceSize.y / 32, 1);
 }
Ejemplo n.º 8
0
 public static void UpdateFinalCombinedMultiScatter(
     RenderTexture multiScatteringTarget,
     RenderTexture multiScatteringOfSingleOrder,
     AtmLutGenerateConfig lutConfig
     )
 {
     computeShader.SetTexture(SumMultipleScatteringLUT, "ScatteringSumTarget", multiScatteringTarget);
     computeShader.SetTexture(SumMultipleScatteringLUT, "ScatteringSumAdd", multiScatteringOfSingleOrder);
     computeShader.Dispatch(SumMultipleScatteringLUT, lutConfig.scatteringSize.x / 8, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
 }
Ejemplo n.º 9
0
        public static void UpdateTransmittance(
            RenderTexture target,
            AtmLutGenerateConfig lutConfig,
            float start = 0.0f,
            float end   = 1.0f
            )
        {
            int xStart, xEnd;

            NormalizeProgressPointer(start, end, lutConfig.transmittanceSize.x / 32, out xStart, out xEnd);
            computeShader.SetInts("_ThreadOffset", xStart, 0, 0);
            computeShader.SetTexture(CalculateTransmittanceLUT, "TransmittanceLUTResult", target);
            computeShader.Dispatch(CalculateTransmittanceLUT, xEnd - xStart, lutConfig.transmittanceSize.y / 32, 1);
        }
Ejemplo n.º 10
0
        public static void UpdateMultiScatteringCombineDensity(
            RenderTexture target,
            RenderTexture TransmittanceLUT,
            RenderTexture multipleScatteringDensity,
            AtmLutGenerateConfig lutConfig,
            float start = 0.0f,
            float end   = 1.0f
            )
        {
            int xStart, xEnd;

            NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
            computeShader.SetInts("_ThreadOffset", xStart, 0, 0);

            computeShader.SetTexture(CalculateMultipleScatteringLUT, "TransmittanceLUT", TransmittanceLUT);
            computeShader.SetTexture(CalculateMultipleScatteringLUT, "MultipleScatteringDensityLUT", multipleScatteringDensity);
            computeShader.SetTexture(CalculateMultipleScatteringLUT, "MultipleScatteringResult", target);
            computeShader.Dispatch(CalculateMultipleScatteringLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
        }
Ejemplo n.º 11
0
        public static void UpdateSingleRayleighMie(
            RenderTexture rayleightarget,
            RenderTexture mietarget,
            RenderTexture TransmittanceLUT,
            AtmLutGenerateConfig lutConfig,
            float start = 0.0f,
            float end   = 1.0f
            )
        {
            int xStart, xEnd;

            NormalizeProgressPointer(start, end, lutConfig.scatteringSize.x / 8, out xStart, out xEnd);
            computeShader.SetInts("_ThreadOffset", xStart, 0, 0);

            computeShader.SetTexture(CalculateSingleScatteringLUT, "TransmittanceLUT", TransmittanceLUT);
            computeShader.SetTexture(CalculateSingleScatteringLUT, "SingleScatteringMieLUTResult", mietarget);
            computeShader.SetTexture(CalculateSingleScatteringLUT, "SingleScatteringRayleighLUTResult", rayleightarget);

            computeShader.Dispatch(CalculateSingleScatteringLUT, xEnd - xStart, lutConfig.scatteringSize.y / 8, lutConfig.scatteringSize.z / 8);
        }
Ejemplo n.º 12
0
        public static void UpdateGroundIrradiance(
            RenderTexture target,
            RenderTexture singleRayleigh,
            RenderTexture singleMie,
            RenderTexture multiScattering,
            int scatteringOrder,
            AtmLutGenerateConfig lutConfig,
            float start = 0.0f,
            float end   = 1.0f
            )
        {
            int xStart, xEnd;

            NormalizeProgressPointer(start, end, lutConfig.irradianceSize.x / 32, out xStart, out xEnd);
            computeShader.SetInts("_ThreadOffset", xStart, 0, 0);

            computeShader.SetInt("ScatteringOrder", scatteringOrder);
            computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "SingleRayleighScatteringLUT", singleRayleigh);
            computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "SingleMieScatteringLUT", singleMie);
            computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "MultipleScatteringLUT", multiScattering);
            computeShader.SetTexture(CalculateGroundIndirectIrradianceLUT, "GroundIndirectIrradianceResult", target);
            computeShader.Dispatch(CalculateGroundIndirectIrradianceLUT, xEnd - xStart, lutConfig.irradianceSize.y / 32, 1);
        }
Ejemplo n.º 13
0
 public static void CreateGroundIrradianceTexture(ref RenderTexture target, int order, AtmLutGenerateConfig lutconfig)
 {
     CreateLUT(ref target, "Ground Irrdiance Order " + order, lutconfig.irradianceSize.x, lutconfig.irradianceSize.y, 0, RenderTextureFormat.ARGBFloat);
 }
Ejemplo n.º 14
0
 public static void CreateSingleRayleighMieTexture(ref RenderTexture rayleigh, ref RenderTexture mie, AtmLutGenerateConfig lutconfig)
 {
     CreateLUT(ref rayleigh, "SingleMie", lutconfig.scatteringSize.x, lutconfig.scatteringSize.y, lutconfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
     CreateLUT(ref mie, "SingleRayleigh", lutconfig.scatteringSize.x, lutconfig.scatteringSize.y, lutconfig.scatteringSize.z, RenderTextureFormat.ARGBFloat);
 }
Ejemplo n.º 15
0
 public static void CreateTransmittanceTexture(
     ref RenderTexture target,
     AtmLutGenerateConfig lutconfig)
 {
     CreateLUT(ref target, "Transmittance", lutconfig.transmittanceSize.x, lutconfig.transmittanceSize.y, 0, RenderTextureFormat.ARGBFloat);
 }
Ejemplo n.º 16
0
 public static void ApplyComputeShaderParams(AtmLutGenerateConfig lutConfig, AtmosphereConfig atmConfig)
 {
     lutConfig.Apply(computeShader);
     atmConfig.Apply(computeShader);
 }