using UnityEngine.Rendering ;
Material m_SkyProceduralMaterial ;
Material m_ProceduralSkyMaterial ;
MaterialPropertyBlock m_PropertyBlock ;
ProceduralSky m_ProceduralSkyParams ;
public override void Build ( )
{
m_SkyProceduralMaterial = CoreUtils . CreateEngineMaterial ( "Hidden/HDRenderPipeline/Sky/SkyProcedural" ) ;
var hdrp = GraphicsSettings . renderPipelineAsset as HDRenderPipelineAsset ;
m_ProceduralSkyMaterial = CoreUtils . CreateEngineMaterial ( hdrp . renderPipelineResources . proceduralSky ) ;
CoreUtils . Destroy ( m_SkyProceduralMaterial ) ;
CoreUtils . Destroy ( m_ProceduralSkyMaterial ) ;
}
public override void SetRenderTargets ( BuiltinSkyParameters builtinParams )
public override void RenderSky ( BuiltinSkyParameters builtinParams , bool renderForCubemap )
{
CoreUtils . SetKeyword ( m_Sky ProceduralMaterial , "_ENABLE_SUN_DISK" , m_ProceduralSkyParams . enableSunDisk ) ;
CoreUtils . SetKeyword ( m_ProceduralSky Material , "_ENABLE_SUN_DISK" , m_ProceduralSkyParams . enableSunDisk ) ;
Color sunColor = Color . white ;
Vector3 sunDirection = Vector3 . zero ;
sunDirection = - builtinParams . sunLight . transform . forward ;
}
m_Sky ProceduralMaterial . SetVector ( HDShaderIDs . _SkyParam , new Vector4 ( m_ProceduralSkyParams . exposure , m_ProceduralSkyParams . multiplier , 0.0f , 0.0f ) ) ;
m_Sky ProceduralMaterial . SetFloat ( _SunSizeParam , m_ProceduralSkyParams . sunSize ) ;
m_Sky ProceduralMaterial . SetFloat ( _SunSizeConvergenceParam , m_ProceduralSkyParams . sunSizeConvergence ) ;
m_Sky ProceduralMaterial . SetFloat ( _AtmoshpereThicknessParam , m_ProceduralSkyParams . atmosphereThickness ) ;
m_Sky ProceduralMaterial . SetColor ( _SkyTintParam , m_ProceduralSkyParams . skyTint ) ;
m_Sky ProceduralMaterial . SetColor ( _GroundColorParam , m_ProceduralSkyParams . groundColor ) ;
m_Sky ProceduralMaterial . SetColor ( _SunColorParam , sunColor ) ;
m_Sky ProceduralMaterial . SetVector ( _SunDirectionParam , sunDirection ) ;
m_ProceduralSky Material . SetVector ( HDShaderIDs . _SkyParam , new Vector4 ( m_ProceduralSkyParams . exposure , m_ProceduralSkyParams . multiplier , 0.0f , 0.0f ) ) ;
m_ProceduralSky Material . SetFloat ( _SunSizeParam , m_ProceduralSkyParams . sunSize ) ;
m_ProceduralSky Material . SetFloat ( _SunSizeConvergenceParam , m_ProceduralSkyParams . sunSizeConvergence ) ;
m_ProceduralSky Material . SetFloat ( _AtmoshpereThicknessParam , m_ProceduralSkyParams . atmosphereThickness ) ;
m_ProceduralSky Material . SetColor ( _SkyTintParam , m_ProceduralSkyParams . skyTint ) ;
m_ProceduralSky Material . SetColor ( _GroundColorParam , m_ProceduralSkyParams . groundColor ) ;
m_ProceduralSky Material . SetColor ( _SunColorParam , sunColor ) ;
m_ProceduralSky Material . SetVector ( _SunDirectionParam , sunDirection ) ;
CoreUtils . DrawFullScreen ( builtinParams . commandBuffer , m_Sky ProceduralMaterial , m_PropertyBlock , renderForCubemap ? 0 : 1 ) ;
CoreUtils . DrawFullScreen ( builtinParams . commandBuffer , m_ProceduralSky Material , m_PropertyBlock , renderForCubemap ? 0 : 1 ) ;
}
public override bool IsValid ( )