Fancy Background Shader

This commit is contained in:
hyperion51 2020-03-25 02:22:44 +00:00
commit 4221f304f1
18 changed files with 698 additions and 398 deletions

View file

@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackgroundRenderer : MonoBehaviour
{
public Transform Background;
// public float RotationSpeed1 = 1;
// public float RotationSpeed2 = 1;
private Camera _camera;
private float _ratio;
//private Material _material;
private float _depth;
private void Start()
{
_camera = GetComponent<Camera>();
_depth = Background.position.z;
//_material = Background.GetComponent<MeshRenderer>().material;
}
private void OnPreRender()
{
//_material.SetVector("Rot1", );
_ratio = (float) Screen.height / Screen.width;
Background.position = new Vector3(transform.position.x, transform.position.y, _depth);
var size = _camera.orthographicSize;
Background.localScale = new Vector3(size * 4, size * 4 * _ratio, 1);
}
}