public SetupCameraCubeFace ( System.Vector3 origin, CubeFace cubeFace, float near, float far ) : void | ||
origin | System.Vector3 | |
cubeFace | CubeFace | |
near | float | |
far | float | |
Résultat | void |
/// <summary> /// /// </summary> /// <param name="gameTime"></param> public void RenderRadiance() { var sw = new Stopwatch(); Log.Message("Radiance capture..."); sw.Start(); using (new PixEvent("Capture Radiance")) { var sun = SkySettings.SunGlowIntensity; SkySettings.SunGlowIntensity = 0; int index = 0; foreach (var envLight in LightSet.EnvLights) { for (int i = 0; i < 6; i++) { ClearBuffers(radianceFrame); var camera = new Camera(); camera.SetupCameraCubeFace(envLight.Position, (CubeFace)i, 0.125f, 5000); // render g-buffer : rs.SceneRenderer.RenderGBuffer(new GameTime(0, 0, 0), StereoEye.Mono, camera, radianceFrame, this, true); // render sky : rs.Sky.Render(camera, StereoEye.Mono, radianceFrame, SkySettings); // render lights : rs.LightRenderer.RenderLighting(StereoEye.Mono, camera, radianceFrame, this, rs.Sky.SkyCube); // downsample captured frame to cube face. rs.Filter.StretchRect4x4(Radiance.GetSurface(0, (CubeFace)i), radianceFrame.HdrBuffer, SamplerState.LinearClamp, true); } // prefilter cubemap : rs.Filter.PrefilterEnvMap(Radiance); RadianceCache.CopyFromRenderTargetCube(index, Radiance); index++; } sw.Stop(); SkySettings.SunGlowIntensity = sun; } Log.Message("{0} light probes - {1} ms", LightSet.EnvLights.Count, sw.ElapsedMilliseconds); }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> public void RenderRadiance () { var sw = new Stopwatch(); Log.Message("Radiance capture..."); sw.Start(); using (new PixEvent("Capture Radiance")) { var sun = SkySettings.SunGlowIntensity; SkySettings.SunGlowIntensity = 0; int index = 0; foreach ( var envLight in LightSet.EnvLights ) { for (int i=0; i<6; i++) { ClearBuffers( radianceFrame ); var camera = new Camera(); camera.SetupCameraCubeFace( envLight.Position, (CubeFace)i, 0.125f, 5000 ); // render g-buffer : rs.SceneRenderer.RenderGBuffer( StereoEye.Mono, camera, radianceFrame, this ); // render sky : rs.Sky.Render( camera, StereoEye.Mono, radianceFrame, SkySettings ); // render lights : rs.LightRenderer.RenderLighting( StereoEye.Mono, camera, radianceFrame, this, rs.Sky.SkyCube ); // downsample captured frame to cube face. rs.Filter.StretchRect4x4( Radiance.GetSurface( 0, (CubeFace)i ), radianceFrame.HdrBuffer, SamplerState.LinearClamp, true ); // prefilter cubemap : rs.Filter.PrefilterEnvMap( Radiance ); } RadianceCache.CopyFromRenderTargetCube( index, Radiance ); index ++; } sw.Stop(); SkySettings.SunGlowIntensity = sun; } Log.Message("{0} light probes - {1} ms", LightSet.EnvLights.Count, sw.ElapsedMilliseconds); }