/// <summary> /// Unhighlights a button with an outline from the ButtonTypes enum. /// </summary> /// <param name="buttonType">The type of button to unhighlight.</param> public void UnhighlightButton(ButtonTypes buttonType) { Outline outline = null; switch (buttonType) { case ButtonTypes.BlockButton: outline = _blockButton.gameObject.GetComponent <Outline>(); break; case ButtonTypes.HomeButton: outline = _homeButton.gameObject.GetComponent <Outline>(); break; case ButtonTypes.GridButton: outline = _gridButton.gameObject.GetComponent <Outline>(); break; } if (!outline) { return; } OutlineEffect outlineEffect = outline.GetComponent <OutlineEffect>(); if (!outlineEffect) { return; } outlineEffect.FadeOutAndDestroy(); }
private void FadeInOutline() { // Setup the color to use for the flash Color color = effectColor; ButtonSound sound = ButtonSound.Hover; // If we have an operation source then instead set the color to the intended operation type color if (OperationInProgress) { color = UISettings.GetOperatorColor(operationSource.MatrixParent.IntendedNextOperationType); sound = ButtonSound.Preview; } // Create the pop effect for hovering PunchSize(sound); // If wer still have an outline then make it invisible if (currentOutline) { currentOutline.Remove(); } // Fade in a new outline currentOutline = OutlineManager.FadeInOutline(transform, effectType, color); }
public void startIdle() { GameObject mainCamera = GameObject.Find("Main Camera"); OutlineEffect outliner = mainCamera.GetComponent <OutlineEffect> (); outliner.outlineRenderers.Remove(gameObject.GetComponent <SpriteRenderer> ()); }
private void OnValidate() { if (_outlineEffect == null) { _outlineEffect = GetComponent <OutlineEffect>(); } if (_outlineEffect.OutlineLayers.Count > 0) { _outlineLayer = _outlineEffect.OutlineLayers[0]; } else { _outlineLayer = new OutlineLayer(); _outlineEffect.OutlineLayers.Add(_outlineLayer); } foreach (var go in _outlineGos) { if (go) { _outlineLayer.Add(go); } } }
private void Start() { if (effect == null) { effect = GetComponent <OutlineEffect>(); } }
private void InitializeHighlightCapabilityOnBothCameras() { // if you're run an Oculus device, ensure that (OVRCameraRig.usePerEyeCameras == true) foreach (Camera cam in Camera.allCameras) { if (cam.stereoTargetEye == StereoTargetEyeMask.Left) { leftCam = cam; } if (cam.stereoTargetEye == StereoTargetEyeMask.Right) { rightCam = cam; } } if (leftCam == null || rightCam == null) { Debug.LogError("Unity is not rendering both eyes at the moment."); } else { OutlineEffect leftEyeHighlightEffect = leftCam.gameObject.AddComponent <OutlineEffect>(); leftEyeHighlightEffect.sourceCamera = leftCam; OutlineEffect rightEyeHighlightEffect = rightCam.gameObject.AddComponent <OutlineEffect>(); rightEyeHighlightEffect.sourceCamera = rightCam; } }
/**************************************************** * Unity Functions * *************************************************/ // Use this for initialization void Start() { if (cam == null) { cam = Camera.main; } if (cam == null) { Debug.LogError("Missing Camera, please add one"); } camT = cam.transform; //add outline component to camera if missing OutlineEffect of = cam.GetComponent <OutlineEffect>(); if (of == null) { of = cam.gameObject.AddComponent <OutlineEffect>(); } //set outline color if the user want to if (useCustomOutlineColor) { of.lineColor0 = outlineColor; } object_placer = GetComponent <ObjectPlacer>(); object_selector = GetComponent <ObjectSelector>(); }
private void Start() { _lineRenderer = GetComponent <LineRenderer>(); if (_lineRenderer == null) { _lineRenderer = gameObject.AddComponent <LineRenderer>(); } _inputPoints = new Vector3[_arcResolution]; _lineRenderer.positionCount = _arcResolution; _lineRenderer.enabled = false; _outlineEffect = Camera.main.GetComponent <OutlineEffect>(); if (_outlineEffect == null) { _outlineEffect = Camera.main.gameObject.AddComponent <OutlineEffect>(); } _attachEffect.gameObject.SetActive(false); _physicsGun = FindObjectOfType <PhysicsGunInteractionBehavior>(); if (_physicsGun == null) { return; } _physicsGun.OnObjectGrabbed.AddListener(OnObjectGrabbed); }
//Set reference private void Start() { player = FindObjectOfType <PlayerController>().gameObject; controller = player.GetComponent <PlayerController>(); interactionRange = controller.interactionRange; playerCamera = player.transform.GetChild(0); outlineFX = playerCamera.GetComponent <OutlineEffect>(); }
protected override void Start() { base.Start(); mainCam = Camera.main; outline = mainCam.GetComponent <OutlineEffect>(); ScreenToShow = loginScreen; Debug.Log("Intializing opening monitor screen to show = " + loginScreen); }
void OnEnable() { if (outlineEffect == null) { outlineEffect = Camera.main.GetComponent <OutlineEffect>(); } outlineEffect.AddOutline(this); }
//void Start() //{ //} void OnEnable() { if (outlineEffect == null) { outlineEffect = Camera.main.transform.GetChild(0).GetComponent <Camera>().GetComponent <OutlineEffect>(); } outlineEffect.AddOutline(this); }
/// <summary> /// Show building control panel over specified building /// </summary> /// <param name="building">Building</param> public void Show(Building building) { if (Visible) //Close already opened menu before opening "new" one { Hide(); } this.buildingLogic = building; //Get logic //Building highlight OutlineEffect.SetColor(buildingLogic.Owner.Color); buildingLogic.HighlightBuilding(true); Visible = true; //Show window gameObject.transform.Find("Name").GetComponent <Text>().text = string.Format("Budova: {0}", buildingLogic.ActualBuilding.GetName()); //Set name of building gameObject.transform.Find("Profit").GetComponent <Text>().text = string.Format("V tomto kole: {0},000,000 Kč", ProfitCalculation(buildingLogic)); //Set profit wait = true; //Buttons text string[,] buttonLabels = new string[, ] { { "POSTAVIT", "NIC" }, { "ZMĚNIT ↑/↔", "ZBOURAT" }, { "ZMĚNIT ↑/↔", "ZMĚNIT ↓" }, { "ZMĚNIT ↔", "ZMĚNIT ↓" } }; //Buttons Button upgrade = GameObject.Find("Upgrade").GetComponent <Button>(); Button downgrade = GameObject.Find("Downgrade").GetComponent <Button>(); //Own building filter NetworkIdentity identity = building.gameObject.GetComponent <NetworkIdentity>(); int display = building.transform.parent.name == "Player" + GameLogic.HasTurn.ID && (identity.hasAuthority || (identity.clientAuthorityOwner == null && identity.isServer)) ? 1 : 0; //Set buttons visibility VisibleButtons = building.transform.parent.name == "Player" + GameLogic.HasTurn.ID && (identity.hasAuthority || (identity.clientAuthorityOwner == null && identity.isServer)); //Set buttons interactibility upgrade.interactable = display != 0 && GameLogic.actions > 0; downgrade.interactable = display != 0 && buildingLogic.ActualBuilding.GetGrade() != 0 && GameLogic.actions > 0; //Set buttons text GameObject.Find("UpgradeTag").GetComponent <Text>().text = buttonLabels[buildingLogic.ActualBuilding.GetGrade(), 0]; GameObject.Find("DowngradeTag").GetComponent <Text>().text = buttonLabels[buildingLogic.ActualBuilding.GetGrade(), 1]; //Display production & consumption rates DisplayPC(buildingLogic.ActualBuilding); }
void Start() { OutlineEffect effect = GetComponent <OutlineEffect>(); if (effect != null) { effect.enabled = false; } }
public void OutlineEffect2 () { var src = GetSourceImage ("input.png"); var effect = new OutlineEffect (25, 20); effect.Render (src); Compare (src, "outline2.png"); }
public static OutlineEffect FadeInOutline(Transform transform, OutlineType type, Color color) { OutlineEffect outline = instance.pools.Get(type).Get(); outline.transform.SetParent(transform, false); outline.UpdateUI(); outline.FadeIn(color); return(outline); }
private void Awake() { if (Instance != null) { Destroy(this); throw new System.Exception("you can only have one outline camera in the scene"); } Instance = this; }
public void OutlineEffect2() { var src = GetSourceImage("input.png"); var effect = new OutlineEffect(25, 20); effect.Render(src); Compare(src, "outline2.png"); }
public override void OnEnter() { var go = Fsm.GetOwnerDefaultTarget(gameObject); theScript = go.GetComponent <OutlineEffect>(); if (!everyFrame.Value) { MakeItSo(); Finish(); } }
void OnEnable() { m_OutlineEffect = ScriptableObject.CreateInstance <OutlineEffect>(); m_OutlineEffect.enabled.Override(true); m_OutlineEffect.color.Override(color); m_OutlineEffect.size.Override(size); m_OutlineEffect.softness.Override(softness); m_OutlineEffect.drawOnTop.Override(drawOnTop); m_OutlineEffect.downSample.Override(downSample); m_OutlineEffect.Tag.Override(Tag); m_Volume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, m_OutlineEffect); }
public void OnTriggerEnter(Collider other) { if (other.tag == "Item") { collidedWithItem = other.GetComponent <Item>(); //collidedWithItem.GetComponent<MeshRenderer>().material.color = new Color32(100, 100, 100, 100); OutlineEffect effect = other.GetComponent <OutlineEffect>(); if (effect != null) { effect.enabled = true; } } }
public void OnTriggerExit(Collider other) { if (other.tag == "Item") { if (collidedWithItem != null) { //collidedWithItem.GetComponent<MeshRenderer>().material.color = new Color32(255, 255, 255, 255); OutlineEffect effect = other.GetComponent <OutlineEffect>(); if (effect != null) { effect.enabled = false; } collidedWithItem = null; } } }
private void OnEnable() { lineGo = transform.Find("Line").gameObject; //lightGo = transform.Find("Light").gameObject; var camera = GameObject.FindGameObjectWithTag("MainCamera"); if (camera.GetComponent <OutlineEffect>() != null) { ole = camera.GetComponent <OutlineEffect>(); } else { ole = camera.AddComponent <OutlineEffect>(); } line = GetComponent <Line>(); OL = GetLineGoComponent <Outline>(); click = GameObject.FindGameObjectWithTag("GameController").GetComponent <Click>(); }
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { Predicate <Outlinable> editorPredicate = obj => { #if UNITY_EDITOR var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); return(stage == null || stage.IsPartOfPrefabContents(obj.gameObject)); #else return(true); #endif }; Predicate <Outlinable> gamePredicate = obj => { #if UNITY_EDITOR var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); return(stage == null || !stage.IsPartOfPrefabContents(obj.gameObject)); #else return(true); #endif }; Parameters.DrawPredicate = renderingData.cameraData.isSceneViewCamera ? editorPredicate : gamePredicate; var buffer = CommandBufferPool.Get("Outline"); outlinables.Clear(); Parameters.Layers.Clear(); Outlinable.GetAllActiveOutlinables(outlinables); foreach (var outlinable in outlinables) { Parameters.Layers.Add(outlinable.Layer); } Parameters.Buffer = buffer; OutlineEffect.SetupBuffer(Parameters); context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); }
private void Awake() { if (_outlineEffect == null) { _outlineEffect = GetComponent <OutlineEffect>(); } if (_outlineLayer == null) { if (_outlineEffect.OutlineLayers.Count > 0) { _outlineLayer = _outlineEffect.OutlineLayers[0]; } else { _outlineLayer = new OutlineLayer(); _outlineEffect.OutlineLayers.Add(_outlineLayer); } } }
//! //! Use this for initialization //! void Start() { serverAdapter = GameObject.Find("ServerAdapter").GetComponent <ServerAdapter>(); left = -1.0f * aspect; right = 1.0f * aspect; bottom = -1.0f; top = 1.0f; // outline effect outlineEffect = Camera.main.transform.GetChild(0).GetComponent <Camera>().GetComponent <OutlineEffect>(); // initialize the dictionary that keeps track of the status of controller buttons //buttonPressedState = new Dictionary<string, float>(); //cache references mainController = GameObject.Find("MainController").GetComponent <MainController>(); inputAdapter = GameObject.Find("InputAdapter").GetComponent <InputAdapter>(); crossHair = GameObject.Find("GUI/Canvas/Crosshair"); }
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { if (material == null || !renderingData.cameraData.postProcessEnabled) { return; } VolumeStack stack = VolumeManager.instance.stack; outlineEffect = stack.GetComponent <OutlineEffect>(); if (outlineEffect == null || !outlineEffect.IsActive()) { return; } CommandBuffer buffer = CommandBufferPool.Get(OUTLINE_EFFECT_TAG); Render(buffer, ref renderingData); context.ExecuteCommandBuffer(buffer); CommandBufferPool.Release(buffer); }
void Awake () { instance = this; }
private void UpdateOutliner(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, Outliner outlineEffect, HDCamera hdCamera) { if (outlineEffect == null || !outlineEffect.enabled) { return; } if (pool == null) { pool = new Queue <OutlineParameters>(); } if (parametersInUse == null) { parametersInUse = new Queue <OutlineParameters>(); } if (pool.Count == 0) { pool.Enqueue(new OutlineParameters()); } var parameters = pool.Dequeue(); parametersInUse.Enqueue(parameters); parameters.Buffer = cmd; outlineEffect.UpdateSharedParameters(parameters, camera, camera.cameraType == CameraType.SceneView); Outlinable.GetAllActiveOutlinables(parameters.Camera, parameters.OutlinablesToRender); RendererFilteringUtility.Filter(parameters.Camera, parameters); parameters.Buffer.EnableShaderKeyword("EPO_HDRP"); var historyProperties = hdCamera.historyRTHandleProperties; parameters.Buffer.SetGlobalVector(OutlineEffect.ScaleHash, new Vector4( (float)historyProperties.currentViewportSize.x - (float)historyProperties.currentRenderTargetSize.x, (float)historyProperties.currentViewportSize.y - (float)historyProperties.currentRenderTargetSize.y, (float)historyProperties.currentViewportSize.x / (float)historyProperties.currentRenderTargetSize.x, (float)historyProperties.currentViewportSize.y / (float)historyProperties.currentRenderTargetSize.y)); if (outlineEffect.RenderingStrategy == OutlineRenderingStrategy.Default) { outlineEffect.UpdateSharedParameters(parameters, camera, camera.cameraType == CameraType.SceneView); parameters.PrimaryBufferScale = 1.0f; parameters.InfoBufferScale = 1.0f; RTHandle colorTarget; RTHandle depthTarget; GetCameraBuffers(out colorTarget, out depthTarget); parameters.Scale = colorTarget.rtHandleProperties.rtHandleScale; SetViewport(colorTarget, parameters); parameters.Target = colorTarget; parameters.DepthTarget = depthTarget; parameters.TargetWidth = colorTarget.rt.width; parameters.TargetHeight = colorTarget.rt.height; parameters.Antialiasing = colorTarget.rt.antiAliasing; parameters.Prepare(); OutlineEffect.SetupOutline(parameters); renderContext.ExecuteCommandBuffer(parameters.Buffer); parameters.Buffer.Clear(); } else { if (tempOutlinables == null) { tempOutlinables = new List <Outlinable>(); } tempOutlinables.Clear(); tempOutlinables.AddRange(parameters.OutlinablesToRender); foreach (var outlinable in tempOutlinables) { outlineEffect.UpdateSharedParameters(parameters, camera, camera.cameraType == CameraType.SceneView); RTHandle colorTarget; RTHandle depthTarget; GetCameraBuffers(out colorTarget, out depthTarget); parameters.Scale = colorTarget.rtHandleProperties.rtHandleScale; SetViewport(colorTarget, parameters); parameters.Target = colorTarget; parameters.DepthTarget = depthTarget; parameters.TargetWidth = colorTarget.rt.width; parameters.TargetHeight = colorTarget.rt.height; parameters.Antialiasing = colorTarget.rt.antiAliasing; parameters.OutlinablesToRender.Clear(); parameters.OutlinablesToRender.Add(outlinable); parameters.BlitMesh = null; parameters.Prepare(); cmd.SetViewport(new Rect(Vector2.zero, colorTarget.rtHandleProperties.currentViewportSize)); OutlineEffect.SetupOutline(parameters); renderContext.ExecuteCommandBuffer(parameters.Buffer); parameters.Buffer.Clear(); } parameters.MeshPool.ReleaseAllMeshes(); } parameters.Buffer.Clear(); }
void Awake() { outlineEffect = GetComponent <OutlineEffect>(); }
protected override void DrawCore(RenderDrawContext context) { var input = GetInput(0); var output = GetOutput(0); if (input == null || output == null) { return; } var inputDepthTexture = GetInput(1); // Depth // Update the parameters for this post effect if (!Enabled) { if (input != output) { Scaler.SetInput(input); Scaler.SetOutput(output); Scaler.Draw(context); } return; } // If input == output, than copy the input to a temporary texture if (input == output) { var newInput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); context.CommandList.Copy(input, newInput); input = newInput; } var currentInput = input; var fxaa = Antialiasing as FXAAEffect; bool aaFirst = Bloom != null && Bloom.StableConvolution; bool needAA = Antialiasing != null && Antialiasing.Enabled; if (OutlineEffect.Enabled && inputDepthTexture != null) { // Outline var outlineOutput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); OutlineEffect.SetColorDepthInput(currentInput, inputDepthTexture, context.RenderContext.RenderView.NearClipPlane, context.RenderContext.RenderView.FarClipPlane); OutlineEffect.SetOutput(outlineOutput); OutlineEffect.Draw(context); currentInput = outlineOutput; } // do AA here, first. (hybrid method from Karis2013) if (aaFirst && needAA) { // do AA: if (fxaa != null) { fxaa.InputLuminanceInAlpha = true; } Antialiasing.SetInput(1, inputDepthTexture); bool requiresVelocityBuffer = Antialiasing.RequiresVelocityBuffer; if (requiresVelocityBuffer) { Antialiasing.SetInput(2, GetInput(6)); } var aaSurface = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); if (Antialiasing.NeedRangeDecompress) { // explanation: // The Karis method (Unreal Engine 4.1x), uses a hybrid pipeline to execute AA. // The AA is usually done at the end of the pipeline, but we don't benefit from // AA for the posteffects, which is a shame. // The Karis method, executes AA at the beginning, but for AA to be correct, it must work post tonemapping, // and even more in fact, in gamma space too. Plus, it waits for the alpha=luma to be a "perceptive luma" so also gamma space. // in our case, working in gamma space created monstruous outlining artefacts around eggageratedely strong constrasted objects (way in hdr range). // so AA works in linear space, but still with gamma luma, as a light tradeoff to supress artefacts. // create a 16 bits target for FXAA: // render range compression & perceptual luma to alpha channel: rangeCompress.SetInput(currentInput); rangeCompress.SetOutput(aaSurface); rangeCompress.Draw(context); Antialiasing.SetInput(0, aaSurface); Antialiasing.SetOutput(currentInput); Antialiasing.Draw(context); // reverse tone LDR to HDR: rangeDecompress.SetInput(currentInput); rangeDecompress.SetOutput(aaSurface); rangeDecompress.Draw(context); } else { Antialiasing.SetInput(0, currentInput); Antialiasing.SetOutput(aaSurface); Antialiasing.Draw(context); } currentInput = aaSurface; } if (AmbientOcclusion.Enabled && inputDepthTexture != null) { // Ambient Occlusion var aoOutput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); AmbientOcclusion.SetColorDepthInput(currentInput, inputDepthTexture); AmbientOcclusion.SetOutput(aoOutput); AmbientOcclusion.Draw(context); currentInput = aoOutput; } if (LocalReflections.Enabled && inputDepthTexture != null) { var normalsBuffer = GetInput(2); var specularRoughnessBuffer = GetInput(3); if (normalsBuffer != null && specularRoughnessBuffer != null) { // Local reflections var rlrOutput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); LocalReflections.SetInputSurfaces(currentInput, inputDepthTexture, normalsBuffer, specularRoughnessBuffer); LocalReflections.SetOutput(rlrOutput); LocalReflections.Draw(context); currentInput = rlrOutput; } } if (DepthOfField.Enabled && inputDepthTexture != null) { // DoF var dofOutput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); DepthOfField.SetColorDepthInput(currentInput, inputDepthTexture); DepthOfField.SetOutput(dofOutput); DepthOfField.Draw(context); currentInput = dofOutput; } if (FogEffect.Enabled && inputDepthTexture != null) { // Fog var fogOutput = NewScopedRenderTarget2D(input.Width, input.Height, input.Format); FogEffect.SetColorDepthInput(currentInput, inputDepthTexture, context.RenderContext.RenderView.NearClipPlane, context.RenderContext.RenderView.FarClipPlane); FogEffect.SetOutput(fogOutput); FogEffect.Draw(context); currentInput = fogOutput; } // Luminance pass (only if tone mapping is enabled) // TODO: This is not super pluggable to have this kind of dependencies. Check how to improve this var toneMap = colorTransformsGroup.Transforms.Get <ToneMap>(); if (colorTransformsGroup.Enabled && toneMap != null && toneMap.Enabled) { Texture luminanceTexture = null; if (toneMap.UseLocalLuminance) { const int localLuminanceDownScale = 3; // The luminance chain uses power-of-two intermediate targets, so it expects to output to one as well var lumWidth = Math.Min(MathUtil.NextPowerOfTwo(currentInput.Size.Width), MathUtil.NextPowerOfTwo(currentInput.Size.Height)); lumWidth = Math.Max(1, lumWidth / 2); var lumSize = new Size3(lumWidth, lumWidth, 1).Down2(localLuminanceDownScale); luminanceTexture = NewScopedRenderTarget2D(lumSize.Width, lumSize.Height, PixelFormat.R16_Float, 1); luminanceEffect.SetOutput(luminanceTexture); } luminanceEffect.EnableLocalLuminanceCalculation = toneMap.UseLocalLuminance; luminanceEffect.SetInput(currentInput); luminanceEffect.Draw(context); // Set this parameter that will be used by the tone mapping colorTransformsGroup.Parameters.Set(LuminanceEffect.LuminanceResult, new LuminanceResult(luminanceEffect.AverageLuminance, luminanceTexture)); } if (BrightFilter.Enabled && (Bloom.Enabled || LightStreak.Enabled || LensFlare.Enabled)) { Texture brightTexture = NewScopedRenderTarget2D(currentInput.Width, currentInput.Height, currentInput.Format, 1); // Bright filter pass BrightFilter.SetInput(currentInput); BrightFilter.SetOutput(brightTexture); BrightFilter.Draw(context); // Bloom pass if (Bloom.Enabled) { Bloom.SetInput(brightTexture); Bloom.SetOutput(currentInput); Bloom.Draw(context); } // Light streak pass if (LightStreak.Enabled) { LightStreak.SetInput(brightTexture); LightStreak.SetOutput(currentInput); LightStreak.Draw(context); } // Lens flare pass if (LensFlare.Enabled) { LensFlare.SetInput(brightTexture); LensFlare.SetOutput(currentInput); LensFlare.Draw(context); } } bool aaLast = needAA && !aaFirst; var toneOutput = aaLast ? NewScopedRenderTarget2D(input.Width, input.Height, input.Format) : output; // When FXAA is enabled we need to detect whether the ColorTransformGroup should output the Luminance into the alpha or not var luminanceToChannelTransform = colorTransformsGroup.PostTransforms.Get <LuminanceToChannelTransform>(); if (fxaa != null) { if (luminanceToChannelTransform == null) { luminanceToChannelTransform = new LuminanceToChannelTransform { ColorChannel = ColorChannel.A }; colorTransformsGroup.PostTransforms.Add(luminanceToChannelTransform); } // Only enabled when FXAA is enabled and InputLuminanceInAlpha is true luminanceToChannelTransform.Enabled = fxaa.Enabled && fxaa.InputLuminanceInAlpha; } else if (luminanceToChannelTransform != null) { luminanceToChannelTransform.Enabled = false; } // Color transform group pass (tonemap, color grading) var lastEffect = colorTransformsGroup.Enabled ? (ImageEffect)colorTransformsGroup : Scaler; lastEffect.SetInput(currentInput); lastEffect.SetOutput(toneOutput); lastEffect.Draw(context); // do AA here, last, if not already done. if (aaLast) { Antialiasing.SetInput(toneOutput); Antialiasing.SetOutput(output); Antialiasing.Draw(context); } }
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { var camera = renderingData.cameraData.camera; var outlineEffect = Outliner; if (outlineEffect == null || !outlineEffect.enabled) { return; } #if UNITY_EDITOR Parameters.Buffer.name = renderingData.cameraData.camera.name; #endif Outlinable.GetAllActiveOutlinables(renderingData.cameraData.camera, Parameters.OutlinablesToRender); RendererFilteringUtility.Filter(renderingData.cameraData.camera, Parameters); Outliner.UpdateSharedParameters(Parameters, renderingData.cameraData.camera, renderingData.cameraData.isSceneViewCamera); var targetTexture = camera.targetTexture == null ? camera.activeTexture : camera.targetTexture; if (UnityEngine.XR.XRSettings.enabled && !Parameters.IsEditorCamera && Parameters.EyeMask != StereoTargetEyeMask.None) { var descriptor = UnityEngine.XR.XRSettings.eyeTextureDesc; Parameters.TargetWidth = descriptor.width; Parameters.TargetHeight = descriptor.height; } else { Parameters.TargetWidth = targetTexture != null ? targetTexture.width : (int)(camera.scaledPixelWidth * renderingData.cameraData.renderScale); Parameters.TargetHeight = targetTexture != null ? targetTexture.height : (int)(camera.scaledPixelHeight * renderingData.cameraData.renderScale); } Parameters.Antialiasing = renderingData.cameraData.cameraTargetDescriptor.msaaSamples; var useCustomRenderTarget = Outliner.HasCutomRenderTarget && !renderingData.cameraData.isSceneViewCamera; Parameters.Target = RenderTargetUtility.ComposeTarget(Parameters, useCustomRenderTarget ? Outliner.GetRenderTarget(Parameters) : Renderer.cameraColorTarget); Parameters.DepthTarget = #if UNITY_2019_3_OR_NEWER && !UNITY_2019_3_0 && !UNITY_2019_3_1 && !UNITY_2019_3_2 && !UNITY_2019_3_3 && !UNITY_2019_3_4 && !UNITY_2019_3_5 && !UNITY_2019_3_6 && !UNITY_2019_3_7 && !UNITY_2019_3_8 RenderTargetUtility.ComposeTarget(Parameters, UseColorTargetForDepth ? Renderer.cameraColorTarget : #if UNITY_2020_2_OR_NEWER Renderer.cameraDepthTarget); #else Renderer.cameraDepth); #endif #else RenderTargetUtility.ComposeTarget(Parameters, Renderer.cameraColorTarget); #endif Parameters.Buffer.Clear(); if (Outliner.RenderingStrategy == OutlineRenderingStrategy.Default) { OutlineEffect.SetupOutline(Parameters); Parameters.BlitMesh = null; Parameters.MeshPool.ReleaseAllMeshes(); } else { temporaryOutlinables.Clear(); temporaryOutlinables.AddRange(Parameters.OutlinablesToRender); Parameters.OutlinablesToRender.Clear(); Parameters.OutlinablesToRender.Add(null); foreach (var outlinable in temporaryOutlinables) { Parameters.OutlinablesToRender[0] = outlinable; OutlineEffect.SetupOutline(Parameters); Parameters.BlitMesh = null; } Parameters.MeshPool.ReleaseAllMeshes(); } context.ExecuteCommandBuffer(Parameters.Buffer); }
void Start () { cameraOutlineEffect = OutlineEffect.Instance; spriteRenderer = GetComponent<SpriteRenderer>(); }