219 private links
(free for up to 15 people)
OnAudioFilterRead is called everytime a chunk of audio is routed through the filter (this happens frequently, every ~20ms depending on the samplerate and platform). The audio data is an array of floats ranging from [-1.0f;1.0f] and contains audio from the previous filter in the chain or the AudioClip on the AudioSource. If this is the first filter in the chain and a clip isn't attached to the audio source this filter will be 'played'. That way you can use the filter as the audio clip, procedurally generating audio.
Dialogue system à la Twine, but works in Unity too!
Shader "KRZ" { Properties { _Color ("Main Color", Color) = (1.0, 1.0, 1.0, 1.0) _MainTex ("Color (RGBA)", 2D) = "white" {} _LightCutoff ("Light Cutoff", Range(0.0, 1.0)) = 0.2 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf KRZ fullforwardshadows sampler2D _MainTex; float4 _Color; float _LightCutoff; struct SurfaceOutputKRZ { fixed3 Albedo; fixed Alpha; fixed3 Emission; fixed3 Normal; fixed Specular; }; struct Input { float2 uv_MainTex; }; void surf (Input IN, inout SurfaceOutputKRZ o) { fixed4 tex = tex2D(_MainTex, IN.uv_MainTex) _Color; o.Albedo = tex.rgb; o.Alpha = tex.a; o.Emission = fixed3(0.0,0.0,0.0); // Stop DX11 complaining. } inline fixed4 LightingKRZ (SurfaceOutputKRZ s, fixed3 lightDir, fixed3 viewDir, fixed atten) { atten = step(_LightCutoff, atten) atten; float4 c; c.rgb = (_LightColor0.rgb s.Albedo) (atten * 2); c.a = s.Alpha; return c; } ENDCG } FallBack "VertexLit" }
Covering the topics too dull to be covered by more exciting gamedev blogs.