JBT27
August 11, 2016, 9:46pm
1
I’ve been getting this on the previous build and now on the current one, using Windows Unity 5.4.0f3.
The project uses Helios to record frames. Although the game view displays, output frames are black with this error.
I’ve spoken with the dev of Helios who says this is not a Helios problem, and that the error of course is entirely from the noise and grain script. Would appreciate any ideas.
Thanks.
Moj
November 17, 2016, 3:48am
2
I get the same thing if I run the game view at 1024x768. Index out of range in NoiseAndGrain.cs (Unity Windows 5.4.2f2)
The problem seems to be 4:3 resolutions.
(Filename: Assets/Standard Assets/Effects/ImageEffects/Scripts/NoiseAndGrain.cs Line: 185)
IndexOutOfRangeException: Array index is out of range.
at UnityStandardAssets.ImageEffects.NoiseAndGrain.BuildMesh (UnityEngine.Mesh mesh, UnityEngine.RenderTexture source, UnityEngine.Texture2D noise) [0x000c0] in D:\repos\CosmosTactics\CosmosTactics\Assets\Standard Assets\Effects\ImageEffects\Scripts\NoiseAndGrain.cs:185
at UnityStandardAssets.ImageEffects.NoiseAndGrain.DrawNoiseQuadGrid (UnityEngine.RenderTexture source, UnityEngine.RenderTexture dest, UnityEngine.Material fxMaterial, UnityEngine.Texture2D noise, UnityEngine.Mesh mesh, Int32 passNr) [0x00025] in D:\repos\CosmosTactics\CosmosTactics\Assets\Standard Assets\Effects\ImageEffects\Scripts\NoiseAndGrain.cs:141
at UnityStandardAssets.ImageEffects.NoiseAndGrain.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) [0x00187] in D:\repos\CosmosTactics\CosmosTactics\Assets\Standard Assets\Effects\ImageEffects\Scripts\NoiseAndGrain.cs:93
UnityEditor.EditorGUIUtility:INTERNAL_CALL_RenderGameViewCamerasInternal(RenderTexture, Int32, Rect&, Vector2&, Boolean)
UnityEditor.EditorGUIUtility:RenderGameViewCamerasInternal(RenderTexture, Int32, Rect, Vector2, Boolean) (at C:\buildslave\unity\build\artifacts\generated\common\editor\EditorGUIUtilityBindings.gen.cs:606)
UnityEditor.GameView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GameView\GameView.cs:680)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[ ]) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:187)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:180)
UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:355)
JBT27
November 21, 2016, 11:12am
3
I’m getting the error on 16:9 as well. Still no change on 5.4.1p4.
It seems an algorithm of the shader couldn’t deal with floating-point calculation correctly.
So I modified the script.
float x1 = 0;
float y1 = 0;
for (int w = 0; w < meshWidth; w++, x1 += stepSizeX)
{
y1 = 0;
for (int h = 0; h < meshHeight; h++, y1 += stepSizeY)
{