资源简介
unity中基于Projector和Rendertexture实现的实时阴影,包括shader和脚本
代码片段和文件信息
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class BlurDemo : MonoBehaviour {
public Material blurMat;
public float offset;
public int times = 3;
public bool useBlur;
private RenderTexture rt;
void OnDisable()
{
if (rt != null)
{
DestroyImmediate(rt);
rt = null;
}
}
bool InitRT()
{
if (rt == null)
{
if (camera.targetTexture == null)
return false;
}
else
rt = new RenderTexture(camera.targetTexture.width camera.targetTexture.height 24);
return true;
}
// Update is called once per frame
void Update () {
}
void OnRenderImage(RenderTexture src RenderTexture dst)
{
if (!InitRT()) return;
if (blurMat == null)
Graphics.Blit(src dst);
else
{
if (!useBlur)
{
Graphics.Blit(src dst);
return;
}
blurMat.SetFloat(“offset“ offset);
RenderTexture rt = RenderTexture.GetTemporary(src.width / 4 src.height / 4 0);
Graphics.Blit(src rt blurMat);
for (int i = 0; i <= times; i++)
{
RenderTexture rt2 = RenderTexture.GetTemporary(src.width / 4 src.height / 4 0);
Graphics.Blit(rt rt2 blurMat);
RenderTexture.ReleaseTemporary(rt);
rt = rt2;
}
Graphics.Blit(rt dst blurMat);
RenderTexture.ReleaseTemporary(rt);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
I.A.... 29084 2015-12-08 20:40 PJShadow\Assets\Example.unity
..A..H. 90 2015-12-07 20:38 PJShadow\Assets\Example.unity.me
I.A.... 4216 2015-12-08 20:40 PJShadow\Assets\Materials\blur.mat
..A..H. 95 2015-12-07 22:06 PJShadow\Assets\Materials\blur.mat.me
I.A.... 4300 2015-12-08 20:40 PJShadow\Assets\Materials\New Material.mat
..A..H. 95 2015-12-07 20:25 PJShadow\Assets\Materials\New Material.mat.me
..A..H. 107 2015-12-07 20:25 PJShadow\Assets\Materials.me
I.A.... 4228 2015-12-07 20:38 PJShadow\Assets\Models\Materials\New Material 1.mat
..A..H. 95 2015-12-07 20:05 PJShadow\Assets\Models\Materials\New Material 1.mat.me
I.A.... 4228 2015-12-07 21:34 PJShadow\Assets\Models\Materials\New Material 2.mat
..A..H. 95 2015-12-07 21:34 PJShadow\Assets\Models\Materials\New Material 2.mat.me
I.A.... 4224 2015-12-07 20:38 PJShadow\Assets\Models\Materials\New Material.mat
..A..H. 95 2015-12-07 20:04 PJShadow\Assets\Models\Materials\New Material.mat.me
I.A.... 4312 2015-12-07 22:09 PJShadow\Assets\Models\Materials\ob
..A..H. 95 2015-12-07 20:01 PJShadow\Assets\Models\Materials\ob
I.A.... 4312 2015-12-07 22:09 PJShadow\Assets\Models\Materials\____001Mat.mat
..A..H. 95 2015-12-07 20:01 PJShadow\Assets\Models\Materials\____001Mat.mat.me
..A..H. 107 2015-12-07 20:01 PJShadow\Assets\Models\Materials.me
文件 158062 2015-10-11 15:56 PJShadow\Assets\Models\taikongren.obj
..A..H. 1684 2015-12-07 20:01 PJShadow\Assets\Models\taikongren.obj.me
..A..H. 107 2015-12-07 19:59 PJShadow\Assets\Models.me
文件 1681 2015-12-08 20:07 PJShadow\Assets\sc
..A..H. 178 2015-12-07 22:01 PJShadow\Assets\sc
文件 3305 2015-12-08 20:11 PJShadow\Assets\sc
..A..H. 178 2015-12-07 20:09 PJShadow\Assets\sc
..A..H. 107 2015-12-07 20:06 PJShadow\Assets\sc
文件 1313 2015-07-02 17:15 PJShadow\Assets\Shaders\Blur_2.shader
..A..H. 111 2015-12-07 22:00 PJShadow\Assets\Shaders\Blur_2.shader.me
文件 456 2015-12-07 21:58 PJShadow\Assets\Shaders\diffuse.shader
..A..H. 111 2015-12-07 21:58 PJShadow\Assets\Shaders\diffuse.shader.me
............此处省略452个文件信息
相关资源
- 《Unity Animation Essentials》《Unity游戏动
- 微软雅黑字体精简版Unity手游用
- Curved UI - VR Ready v2.2.unitypackage
- unity After Effect Importer 3.0(1).zip
- Unity内实现单个物体GLOW方案
- TextMesh Pro - Release 1.0.55.2017.1.0b10 (d
- NetDemo.unitypackage
- Find Reference 2 - 2.5.1.unitypackage
- shadow map范例
- Entitas.rar
- sheely.unitypackage
- unity太空飞船小游戏的制作
- Zdanmaku.unitypackage
- Jiggly Bubble 1.31.unitypackage
- 转盘实现demo
- Odin Inspector Source Code 2.1.4.unitypackage
- vs2017安装包community
- Basic Weapon System.unitypackage122875
- Multi-Touch Piano Complete Audio Keyboard
- Odin - Inspector and Serializer 2.1.4.unitypac
- unity-protobuf3
- unity物体边缘高亮插件
- Unity应用MVC模式
- Unity 2018 Artificial Intelligence Cookbook 2n
- Primitives.unitypackage unity的各种形状的模
- Unity 雷达效果实现
- unity3d战争迷雾插件
- VRTK - SteamVR Unity Toolkit.unitypackageV2.2.
- KGFDebug_v.1.2
- unity连连看
评论
共有 条评论