protected override void LoadContent(ContentState state)
		{
			//load the default font.
			drawStats.Font = state.Load<SpriteFont>("Arial");

			//load the character model
			model.ModelData = state.Load<Xen.Ex.Graphics.Content.ModelData>(@"xna_dude/dude");

			//set the shader on the model
			model.ShaderProvider = new CharacterShaderProvider(characterRenderShader, model.ModelData, state.ContentRegister, "xna_dude");

			//setup the render configuration
			this.renderConfig = new RenderConfiguration(this);
			renderConfig.UseGammaCorrection = true;
			renderConfig.UseExposureTonemapping = true;
			renderConfig.AmbientSphericalHarmonicScale = 1;
			renderConfig.DiffuseLightingScale = 1;
			renderConfig.SpecularLightingScale = 1;
			renderConfig.AlbedoTextureScale = 1;
			renderConfig.AmbientOcclusionTextureScale = 1;
			renderConfig.ShadowMapTermScale = 1;
			renderConfig.SkinLightScatteringScale = 1;
			renderConfig.ShowBloomRenderTarget = false;
			renderConfig.ShowEncodedRgbmRenderTarget = false;
			renderConfig.PauseModelAnimation = false;
			renderConfig.PauseModelRotation = false;
			renderConfig.TargetLensExposure = 0.3f;


			//setup common defaults for the scene configs.
			SceneConfiguration defaultSC = new SceneConfiguration();
			defaultSC.RgbmImageScale = 20.0f;
			defaultSC.BloomThreshold = 1.5f;
			defaultSC.BloomScale = 1.0f;
			defaultSC.SunSpecularPower = 32.0f;
			defaultSC.SunSpecularIntensity = 30.0f;
			defaultSC.RgbmRenderScale = 200.0f;
			defaultSC.SkinLightScattering = new Vector3(0.15f, 0.02f, 0.002f); // 15% of the red channel is transferred under the skin


			//Load the source cubemap scene textures.

			//Note: To make it easier to view the source images, the RGBM images have been split into two images,
			//One store the RGB portion, one stores the M portion. This makes it much easier to view the textures
			//and see how they are stored - but it is also extremely wasteful, using 2x the texture data.
			
			//Ideally, the images would be loaded directly as a PNG, however this cannot easily be done on the Xbox.

			//Because these textures are only uses locally as an image data source, they are loaded in a temporary 
			//content manager, which is disposed at the end of this method.
			ContentManager localManager = new ContentManager(this.Services, state.ContentRegister.RootDirectory);

			Texture2D textureDirtroad = localManager.Load<Texture2D>("LightProbes/DirtRoadHDR.rgb");
			Texture2D textureWaterfront = localManager.Load<Texture2D>("LightProbes/WaterfrontHDR.rgb");
			Texture2D textureArches = localManager.Load<Texture2D>("LightProbes/ArchesHDR.rgb");
			Texture2D textureMill = localManager.Load<Texture2D>("LightProbes/MillHDR.rgb");

			Texture2D textureDirtroadAlpha = localManager.Load<Texture2D>("LightProbes/DirtRoadHDR.m");
			Texture2D textureWaterfrontAlpha = localManager.Load<Texture2D>("LightProbes/WaterfrontHDR.m");
			Texture2D textureArchesAlpha = localManager.Load<Texture2D>("LightProbes/ArchesHDR.m");
			Texture2D textureMillAlpha = localManager.Load<Texture2D>("LightProbes/MillHDR.m");


			//setup DirtRoadHDR specifics
			this.DirtRoadConfig = defaultSC.Clone();
			this.DirtRoadConfig.BackgroundScene = new RgbmCubeMap(textureDirtroad, textureDirtroadAlpha, this.DirtRoadConfig.RgbmImageScale);
			this.DirtRoadConfig.SunColour = new Vector3(1, 0.9f, 0.75f);
			this.DirtRoadConfig.SunDirection = Vector3.Normalize(new Vector3(0, 0.1f, 1));
			this.DirtRoadConfig.SunIntensity = 20.0f;
			this.DirtRoadConfig.DefaultLensExposure = 0.15f;
			this.DirtRoadConfig.DefaultCamPos = new Vector3(6.062489f, 4.9959f, -0.6131198f);
			this.DirtRoadConfig.DefaultCamViewPos = new Vector3(5.147717f, 5.02338f, -0.2100832f);

			//setup Arches specifics
			this.ArchesConfig = defaultSC.Clone();
			this.ArchesConfig.BackgroundScene = new RgbmCubeMap(textureArches, textureArchesAlpha, this.ArchesConfig.RgbmImageScale);
			this.ArchesConfig.SunColour = new Vector3(1, 1, 1);
			this.ArchesConfig.SunDirection = Vector3.Normalize(new Vector3(-0.4f, 0.4f, 0.5f));
			this.ArchesConfig.SunIntensity = 15.0f;
			this.ArchesConfig.DefaultLensExposure = 0.15f;
			this.ArchesConfig.DefaultCamPos = new Vector3(-2.667145f, 6.280345f, 4.98485f); 
			this.ArchesConfig.DefaultCamViewPos = new Vector3(-2.470318f, 6.176862f, 4.009888f);

			//setup WaterfrontHDR specifics
			this.WaterfrontConfig = defaultSC.Clone();
			this.WaterfrontConfig.BackgroundScene = new RgbmCubeMap(textureWaterfront, textureWaterfrontAlpha, this.WaterfrontConfig.RgbmImageScale);
			this.WaterfrontConfig.SunColour = new Vector3(0.9f, 0.95f, 1);
			this.WaterfrontConfig.SunDirection = Vector3.Normalize(new Vector3(-0.2f, 1, 0));
			this.WaterfrontConfig.SunIntensity = 15.0f;
			this.WaterfrontConfig.DefaultLensExposure = 0.35f;
			this.WaterfrontConfig.DefaultCamPos = new Vector3(5.251021f,5.877438f,-2.74239f);
			this.WaterfrontConfig.DefaultCamViewPos = new Vector3(4.579107f, 5.783906f, -2.007691f);

			//setup MillHDR specifics
			this.MillConfig = defaultSC.Clone();
			this.MillConfig.BackgroundScene = new RgbmCubeMap(textureMill, textureMillAlpha, this.MillConfig.RgbmImageScale);
			this.MillConfig.SunColour = new Vector3(1, 0.975f, 0.95f);
			this.MillConfig.SunDirection = Vector3.Normalize(new Vector3(-1, 1, -1));
			this.MillConfig.SunIntensity = 25.0f;
			this.MillConfig.DefaultLensExposure = 0.5f;
			this.MillConfig.BloomScale = 0.5f;
			this.MillConfig.BloomThreshold = 1.0f;
			this.MillConfig.DefaultCamPos = new Vector3(6.087461f,6.132507f,-0.8147218f); 
			this.MillConfig.DefaultCamViewPos = new Vector3(5.203656f,5.989332f,-0.3693113f);

			//Textures are no longer needed. 
			localManager.Dispose();

			this.sceneConfig = this.ArchesConfig;
		}
示例#2
0
        protected override void LoadContent(DrawState state, ContentManager manager)
        {
            //load the default font.
            drawStats.Font = manager.Load <SpriteFont>("Arial");

            //load the character model
            model.ModelData = manager.Load <Xen.Ex.Graphics.Content.ModelData>(@"xna_dude/dude");

            //set the shader on the model
            model.SetShaderOverride(new CharacterShaderProvider(characterRenderShader, characterBlendRenderShader, model.ModelData, manager, "xna_dude"));

            //setup the render configuration
            this.renderConfig = new RenderConfiguration(this);
            renderConfig.UseGammaCorrection            = true;
            renderConfig.UseExposureTonemapping        = true;
            renderConfig.AmbientSphericalHarmonicScale = 1;
            renderConfig.DiffuseLightingScale          = 1;
            renderConfig.SpecularLightingScale         = 1;
            renderConfig.AlbedoTextureScale            = 1;
            renderConfig.AmbientOcclusionTextureScale  = 1;
            renderConfig.ShadowMapTermScale            = 1;
            renderConfig.SkinLightScatteringScale      = 1;
            renderConfig.ShowBloomRenderTarget         = false;
            renderConfig.ShowEncodedRgbmRenderTarget   = false;
            renderConfig.PauseModelAnimation           = false;
            renderConfig.PauseModelRotation            = false;
            renderConfig.TargetLensExposure            = 0.3f;


            //setup common defaults for the scene configs.
            SceneConfiguration defaultSC = new SceneConfiguration();

            defaultSC.RgbmImageScale       = 20.0f;
            defaultSC.BloomThreshold       = 1.5f;
            defaultSC.BloomScale           = 1.0f;
            defaultSC.SunSpecularPower     = 32.0f;
            defaultSC.SunSpecularIntensity = 30.0f;
            defaultSC.RgbmRenderScale      = 200.0f;
            defaultSC.SkinLightScattering  = new Vector3(0.15f, 0.02f, 0.002f);            // 15% of the red channel is transferred under the skin



            //Load the source cubemap scene textures.

            //Note: To make it easier to view the source images, the RGBM images have been split into two images,
            //One store the RGB portion, one stores the M portion. This makes it much easier to view the textures
            //and see how they are stored - but it is also extremely wasteful, using 2x the texture data.

            //Ideally, the images would be loaded directly as a PNG, however this cannot easily be done on the Xbox.

            //Because these textures are only uses locally as an image data source, they are loaded in a temporary
            //content manager, which is disposed at the end of this method.
            ContentManager localManager = new ContentManager(manager.ServiceProvider, manager.RootDirectory);

            Texture2D textureDirtroad   = localManager.Load <Texture2D>("LightProbes/DirtRoadHDR.rgb");
            Texture2D textureWaterfront = localManager.Load <Texture2D>("LightProbes/WaterfrontHDR.rgb");
            Texture2D textureArches     = localManager.Load <Texture2D>("LightProbes/ArchesHDR.rgb");
            Texture2D textureMill       = localManager.Load <Texture2D>("LightProbes/MillHDR.rgb");

            Texture2D textureDirtroadAlpha   = localManager.Load <Texture2D>("LightProbes/DirtRoadHDR.m");
            Texture2D textureWaterfrontAlpha = localManager.Load <Texture2D>("LightProbes/WaterfrontHDR.m");
            Texture2D textureArchesAlpha     = localManager.Load <Texture2D>("LightProbes/ArchesHDR.m");
            Texture2D textureMillAlpha       = localManager.Load <Texture2D>("LightProbes/MillHDR.m");


            //setup DirtRoadHDR specifics
            this.DirtRoadConfig = defaultSC.Clone();
            this.DirtRoadConfig.BackgroundScene     = new RgbmCubeMap(textureDirtroad, textureDirtroadAlpha, this.DirtRoadConfig.RgbmImageScale);
            this.DirtRoadConfig.SunColour           = new Vector3(1, 0.9f, 0.75f);
            this.DirtRoadConfig.SunDirection        = Vector3.Normalize(new Vector3(0, 0.1f, 1));
            this.DirtRoadConfig.SunIntensity        = 20.0f;
            this.DirtRoadConfig.DefaultLensExposure = 0.15f;
            this.DirtRoadConfig.DefaultCamPos       = new Vector3(6.062489f, 4.9959f, -0.6131198f);
            this.DirtRoadConfig.DefaultCamViewPos   = new Vector3(5.147717f, 5.02338f, -0.2100832f);

            //setup Arches specifics
            this.ArchesConfig = defaultSC.Clone();
            this.ArchesConfig.BackgroundScene     = new RgbmCubeMap(textureArches, textureArchesAlpha, this.ArchesConfig.RgbmImageScale);
            this.ArchesConfig.SunColour           = new Vector3(1, 1, 1);
            this.ArchesConfig.SunDirection        = Vector3.Normalize(new Vector3(-0.4f, 0.4f, 0.5f));
            this.ArchesConfig.SunIntensity        = 15.0f;
            this.ArchesConfig.DefaultLensExposure = 0.15f;
            this.ArchesConfig.DefaultCamPos       = new Vector3(-2.667145f, 6.280345f, 4.98485f);
            this.ArchesConfig.DefaultCamViewPos   = new Vector3(-2.470318f, 6.176862f, 4.009888f);

            //setup WaterfrontHDR specifics
            this.WaterfrontConfig = defaultSC.Clone();
            this.WaterfrontConfig.BackgroundScene     = new RgbmCubeMap(textureWaterfront, textureWaterfrontAlpha, this.WaterfrontConfig.RgbmImageScale);
            this.WaterfrontConfig.SunColour           = new Vector3(0.9f, 0.95f, 1);
            this.WaterfrontConfig.SunDirection        = Vector3.Normalize(new Vector3(-0.2f, 1, 0));
            this.WaterfrontConfig.SunIntensity        = 15.0f;
            this.WaterfrontConfig.DefaultLensExposure = 0.35f;
            this.WaterfrontConfig.DefaultCamPos       = new Vector3(5.251021f, 5.877438f, -2.74239f);
            this.WaterfrontConfig.DefaultCamViewPos   = new Vector3(4.579107f, 5.783906f, -2.007691f);

            //setup MillHDR specifics
            this.MillConfig = defaultSC.Clone();
            this.MillConfig.BackgroundScene     = new RgbmCubeMap(textureMill, textureMillAlpha, this.MillConfig.RgbmImageScale);
            this.MillConfig.SunColour           = new Vector3(1, 0.975f, 0.95f);
            this.MillConfig.SunDirection        = Vector3.Normalize(new Vector3(-1, 1, -1));
            this.MillConfig.SunIntensity        = 25.0f;
            this.MillConfig.DefaultLensExposure = 0.5f;
            this.MillConfig.BloomScale          = 0.5f;
            this.MillConfig.BloomThreshold      = 1.0f;
            this.MillConfig.DefaultCamPos       = new Vector3(6.087461f, 6.132507f, -0.8147218f);
            this.MillConfig.DefaultCamViewPos   = new Vector3(5.203656f, 5.989332f, -0.3693113f);

            //Textures are no longer needed.
            localManager.Dispose();

            this.sceneConfig = this.ArchesConfig;
        }