I found that only if i uncheck in the inspector the blur script there is no blur effect at all.
I tried to set the blur properties in the inspector all values to 0 but still the blur effect is still on.
Only if i disable the blur it self it back to normal. But i don’t want to make it right away without the blur effect but slowly to return from blur to normal.
There is two scripts attached to my FPSController: Blur and Blur Optimized
I can’t find the values to make that the blur effect will not be at all. Tried to reset everything on both scripts to 0 all values but it didn’t change much. Only if u uncheck and disable the Blur script the blur effect is gone.
But what i want to do is to make the blur effect gone slowly.
This is a script i did attached to another gameobject:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
public class FadeScript : MonoBehaviour
{
public FirstPersonController fpc;
public float fadeDuration = 5;
public float speed;
private Material material;
private float targetAlpha = 0;
private float lerpParam;
private float startAlpha = 1;
private bool rotated = false;
void Start()
{
material = GetComponent<Renderer>().material;
SetMaterialAlpha(1);
fpc.enabled = false;
}
void Update()
{
lerpParam += Time.deltaTime;
float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
SetMaterialAlpha(alpha);
if (alpha == 0)
{
fpc.enabled = true;
if (rotated == false)
{
fpc.GetComponent<FirstPersonController>().enabled = false;
fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
}
if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
{
fpc.GetComponent<FirstPersonController>().enabled = true;
rotated = true;
}
//FadeTo(1, 3);
}
}
public void FadeTo(float alpha, float duration)
{
startAlpha = material.color.a;
targetAlpha = alpha;
fadeDuration = duration;
lerpParam = 0;
}
private void SetMaterialAlpha(float alpha)
{
Color color = material.color;
color.a = alpha;
material.color = color;
}
}
And what i want to do is somehow in this script in the part where it’s making the fading effect:
lerpParam += Time.deltaTime;
float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
SetMaterialAlpha(alpha);
In this part i want to make that the blur effect will gone slowly.
Same like the fading effect but for the blur effect in the blur script.
This is a screenshot showing when it’s blur and while doing the fading effect when i’m running the game and this is where i want to make the blur slowly gone: