Hey guys, I’m basically making a Zoom-In Binocular script that when you zoom in, it enables the Vignetting Image effect which gives a nice black circle around the edges which gives it the effect of zooming in. However, I am not a coder and want this to happen. I want the Vignetting to have an amount of 8 so there is an integar.
I already have the script where you zoom in and the camera’s FOV goes from 60(default) to 30. I just need the image effect to apply. Can somebody please help me!
This is the kind of example I want:
var VignettingAmount : int;
var CheckVignetting : boolean;
function Update(){
if(CheckVignetting == true)
GetComponentInChildren(Vignetting).enabled = true; (SOMEHOW APPLY THE AMOUNT OF 8)
Here is a method I think gives you what you want without a lot of code work.
Create an image in your photo editor that when placed on top of your image would give you the vignette look you want. Begin with a transparent image and darken the corners might be a place to start.
Import the image into Unity. Several import settings will work, but start with a) Texture type = advanced b) Generate Mip Maps=off c) Format=RGBA 32 bit)
Add the bit of code I have at the bottom to your script.
Drag the texture you imported to the texVignette variable. You can set FStartVig and FMaxVig as well. fStartVig is the field of view when the first hint of a vignette will appear. FMaxVig is the field of view where the vignette will be completely displayed.
var texVignette : Texture;
var fStartVig : float = 40.0;
var fMaxVig : float = 10.0;