public ShadowImplementationParameters(Light light) { Light = light; var LightSpaceModelviewProvider = ValueProvider.Create(() => Matrix4.LookAt(- Light.Direction * 300, Light.Direction * 300, Vector3.UnitZ)); var LightSpaceProjectionProvider = ValueProvider.Create( () => { if(Light.Type == LightType.Directional) { return Matrix4.CreateOrthographic(300, 300, 0, 600); } else { return Matrix4.CreateTranslation(- Light.Position); } }); LightMvp = new ModelViewProjectionParameters ( "", LightSpaceModelviewProvider, LightSpaceProjectionProvider ); // LightIlluminationTransformProvider = ValueProvider.Create( () => { if(Light.Type == LightType.Directional) { return Matrix4.CreateTranslation(Light.Direction); } else { return Matrix4.CreateTranslation(- Light.Position); } }); }
protected virtual void ParameterSetup() { // SsaoEffect = new SsaoEffect { TextureSize = 1024, OccConstantArea = false, OccMaxDist = 40, OccMinSampleRatio = 0.5f, OccPixmax = 44, OccPixmin = 2, SamplesCount = 32, Strength = 1, Bias = 0.2f, BlurEdgeAvoidance = 0.2f }; // m_SunLight = new Light { Direction = new Vector3(1, 1, 1), Type = LightType.Directional }; SunLightImpl = new ShadowImplementationParameters(m_SunLight); SunLightImpl.ImplementationType = ShadowImplementationType.Soft2; // ShadowTextureSize = 1024; SolidModeTextureSize = 1024; LightSize = 0.1f; //ExpMapLevel = 1; ShadowSampleCount = 15; //ExpMapRange = 0.0055f; //ExpMapRangeK = 0.85f; }