public void Start() { // Create it: Filter = new SurfaceTexture(); // Apply initial properties (inputs into the filter): Filter.Set("contours", Contours); Filter.Set("uniformity", Uniformity); Filter.Set("frequency", Frequency); // Start building our voronoi node. // Voronoi is, in short, a kind of cellular noise. Voronoi v = new Voronoi(); // *All* are required: v.Frequency = new Property(Filter, "frequency"); v.Distance = new Property((int)VoronoiDistance.Euclidean); v.DrawMode = new Property((int)VoronoiDraw.Normal); v.MinkowskiNumber = new Property(0f); v.Function = new Property((int)VoronoiMethod.F2minusF1); v.Jitter = new Property(Filter, "uniformity"); // If we just displayed 'v' as our root node, we'd just // get some voronoi noise which looks like a bunch of black and white balls. // So, next, we'll tonemap for interesting effects. // Create a sine wave with a variable frequency (to be used by the tonemapper): TextureNode graph = new ScaleInput( new SineWave(), new Property(Filter, "contours") ); // Create the tonemapper node now. // -> We're mapping the black->white range of pixels from the voronoi noise via our sine graph. // That creates a kind of hypnotic black-and-white 'rippling' effect. ToneMap map = new ToneMap(v, graph); // Let's make it some more exciting colours. // Create a gradient from a background->foreground colour, and use lookup to map from our b+w to that gradient. Blaze.Gradient2D rawGradient = new Blaze.Gradient2D(); rawGradient.Add(0f, Color.blue); rawGradient.Add(1f, Color.white); // Create that lookup now: Filter.Root = new Lookup( new Loonim.Gradient(rawGradient, null), map ); // Create the draw information: // - GPU mode // - Size px square // - HDR (true) DrawInfo = new DrawInfo((int)Size); }
/// <summary> /// Initializes a new instance of the <see cref="YebisPlugin"/> class. /// </summary> /// <param name="name">The name.</param> public YebisPlugin(string name) : base(name) { yebis = new Manager(); ToneMap = yebis.Config.ToneMap; Glare = yebis.Config.Glare; ColorCorrection = yebis.Config.ColorCorrection; Lens = yebis.Config.Lens; DepthOfField = yebis.Config.DepthOfField; HeatShimmer = yebis.Config.HeatShimmer; LightShaft = yebis.Config.LightShaft; PreferredFormat = PixelFormat.R16G16B16A16_Float; // Make sure that the Depth Stencil will be created with ShaderResource Tags.Set(RenderTargetKeys.RequireDepthStencilShaderResource, true); }
/// <summary> /// /// </summary> public GameScene() { viewModel_ = new MainWindowViewModel(); viewModel_.LightCount = 2048; lightMgr_ = new LightManager(viewModel_.LightCount); toneMap_ = new ToneMap(); shadowMap_ = new ShadowMap(1024, 1024, ShadowMap.Type.VSM); csMgr_ = new ComputeManager(); csMgr_.ShadowMap = shadowMap_; csMgr_.LightManager = lightMgr_; // シャドウマップの撮影設定 Vector3 lightPos = -lightMgr_.DirectionalLightDir * 50; shadowMap_.Camera.SetPosition(ref lightPos); shadowMap_.Camera.Update(); // カメラ操作 GraphicsCore.Camera3D.SetAt(ref camera_at_); cameraCtrl_ = new CameraController(GraphicsCore.Camera3D); // キューブマップ撮影 cubeMapRendered_ = false; cubeMapInfo_ = new CubeMapGenInfo() { numX = 4, numY = 16, numZ = 9, boundingMin = new Vector3(-28, 1, -12), boundingMax = new Vector3(28, 30, 12), }; cubeMapRenderEnable_ = true; csMgr_.CubeMapInfo = cubeMapInfo_; InitializeTarget(); InitialzeSceneObject(); }