fixed glow script

This commit is contained in:
Steven 2017-10-03 13:36:57 -05:00
parent 3c72f37ac6
commit b48c5c1f49
13 changed files with 115 additions and 9 deletions

View file

@ -72,5 +72,5 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 0.2352941, g: 0.2352941, b: 0.2352941, a: 1} - _Color: {r: 0.7352941, g: 0.7352941, b: 0.7352941, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: GlowCompositeMat
m_Shader: {fileID: 4800000, guid: 874640b11a2bbe24a8655c75d3544e5a, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2d8d66073dfbcdc439112857865d4e28
timeCreated: 1507054354
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -247,6 +247,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Intensity: 2 Intensity: 2
glowCompositeShader: {fileID: 4800000, guid: 874640b11a2bbe24a8655c75d3544e5a, type: 3}
--- !u!114 &114680313401496292 --- !u!114 &114680313401496292
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -258,6 +259,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 618a83da395ad1d43ae9fa7ed4c1febe, type: 3} m_Script: {fileID: 11500000, guid: 618a83da395ad1d43ae9fa7ed4c1febe, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
glowShader: {fileID: 4800000, guid: 39d85d8c36c331e46af6e70a2b4e8d80, type: 3}
blurShader: {fileID: 4800000, guid: f956270686a9d9e45bea04cd985135cc, type: 3}
--- !u!114 &114906276905213650 --- !u!114 &114906276905213650
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -2120,7 +2120,8 @@ MonoBehaviour:
ownershipTransfer: 0 ownershipTransfer: 0
ObservedComponents: ObservedComponents:
- {fileID: 114492707522239788} - {fileID: 114492707522239788}
ObservedComponentsFoldoutOpen: 1 - {fileID: 114063469203119278}
ObservedComponentsFoldoutOpen: 0
viewIdField: 0 viewIdField: 0
instantiationId: -1 instantiationId: -1
currentMasterID: -1 currentMasterID: -1
@ -2150,6 +2151,7 @@ MonoBehaviour:
currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2} currentState: {fileID: 11400000, guid: 78ec31c429ad5074bb50d001b1a49a77, type: 2}
remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2} remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2}
idleState: {fileID: 0} idleState: {fileID: 0}
INTERACT_RANGE: 2
navMeshAgent: {fileID: 0} navMeshAgent: {fileID: 0}
animator: {fileID: 0} animator: {fileID: 0}
characterAnimator: {fileID: 0} characterAnimator: {fileID: 0}

View file

@ -2130,6 +2130,7 @@ MonoBehaviour:
ownershipTransfer: 0 ownershipTransfer: 0
ObservedComponents: ObservedComponents:
- {fileID: 114542938676306540} - {fileID: 114542938676306540}
- {fileID: 114077578116518258}
ObservedComponentsFoldoutOpen: 1 ObservedComponentsFoldoutOpen: 1
viewIdField: 0 viewIdField: 0
instantiationId: -1 instantiationId: -1
@ -2149,6 +2150,7 @@ MonoBehaviour:
currentState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2} currentState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2}
remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2} remainState: {fileID: 11400000, guid: 5eb84557ff3e09f42b843e0b09653774, type: 2}
idleState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2} idleState: {fileID: 11400000, guid: 1c694dfd46dd4e44b94f7853724fa1c0, type: 2}
INTERACT_RANGE: 2
navMeshAgent: {fileID: 0} navMeshAgent: {fileID: 0}
animator: {fileID: 0} animator: {fileID: 0}
characterAnimator: {fileID: 0} characterAnimator: {fileID: 0}

View file

@ -989,7 +989,7 @@ MeshRenderer:
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_Materials: m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 2100000, guid: 88dd65666a636bf4fa2a7e8f159f6013, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0

View file

@ -27,6 +27,18 @@ public class CharacterAnimator : Photon.PunBehaviour
} }
} }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
stream.SendNext(controller.navMeshAgent.velocity.magnitude);
}
else
{
animator.SetFloat(paramHashes[(int)Params.MoveSpeed], (float)stream.ReceiveNext());
}
}
protected virtual void Update() protected virtual void Update()
{ {
animator.SetFloat(paramHashes[(int)Params.MoveSpeed], controller.navMeshAgent.velocity.magnitude); animator.SetFloat(paramHashes[(int)Params.MoveSpeed], controller.navMeshAgent.velocity.magnitude);

View file

@ -8,10 +8,11 @@ public class GlowComposite : MonoBehaviour
public float Intensity = 2; public float Intensity = 2;
private Material _compositeMat; private Material _compositeMat;
public Shader glowCompositeShader;
void OnEnable() void OnEnable()
{ {
_compositeMat = new Material(Shader.Find("Hidden/GlowComposite")); _compositeMat = new Material(glowCompositeShader);
} }
void OnRenderImage(RenderTexture src, RenderTexture dst) void OnRenderImage(RenderTexture src, RenderTexture dst)

View file

@ -8,6 +8,7 @@ public class GlowPrePass : MonoBehaviour
private static RenderTexture Blurred; private static RenderTexture Blurred;
private Material _blurMat; private Material _blurMat;
public Shader glowShader, blurShader;
void OnEnable() void OnEnable()
{ {
@ -16,14 +17,14 @@ public class GlowPrePass : MonoBehaviour
Blurred = new RenderTexture(Screen.width >> 1, Screen.height >> 1, 0); Blurred = new RenderTexture(Screen.width >> 1, Screen.height >> 1, 0);
var camera = GetComponent<Camera>(); var camera = GetComponent<Camera>();
var glowShader = Shader.Find("Hidden/GlowReplace"); //var glowShader = Shader.Find("Hidden/GlowReplace");
camera.targetTexture = PrePass; camera.targetTexture = PrePass;
camera.SetReplacementShader(glowShader, "Glowable"); camera.SetReplacementShader(glowShader, "Glowable");
Shader.SetGlobalTexture("_GlowPrePassTex", PrePass); Shader.SetGlobalTexture("_GlowPrePassTex", PrePass);
Shader.SetGlobalTexture("_GlowBlurredTex", Blurred); Shader.SetGlobalTexture("_GlowBlurredTex", Blurred);
_blurMat = new Material(Shader.Find("Hidden/Blur")); _blurMat = new Material(blurShader);
_blurMat.SetVector("_BlurSize", new Vector2(Blurred.texelSize.x * 1.5f, Blurred.texelSize.y * 1.5f)); _blurMat.SetVector("_BlurSize", new Vector2(Blurred.texelSize.x * 1.5f, Blurred.texelSize.y * 1.5f));
} }

View file

@ -1,6 +1,6 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Hidden/GlowComposite" Shader "GlowComposite"
{ {
Properties Properties
{ {

View file

@ -11,7 +11,7 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Lobby.unity path: Assets/Scenes/Lobby.unity
guid: 9d65756f3d12ef647aea0782245fc241 guid: 9d65756f3d12ef647aea0782245fc241
- enabled: 1 - enabled: 0
path: Assets/Scenes/scene.unity path: Assets/Scenes/scene.unity
guid: b679f50ae448b0642b9887e440a00e0f guid: b679f50ae448b0642b9887e440a00e0f
- enabled: 1 - enabled: 1