For your viewing pleasure here’s the whole dump when an error pops up.
[java]
Jul 18, 2012 2:42:20 PM com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData
WARNING: Bad compile of:
1 #version 130
//
Noise4D.glsllib starts here
2 //
3 // Description : Array and textureless GLSL 2D/3D/4D simplex
4 // noise functions.
5 // Author : Ian McEwan, Ashima Arts.
6 // Maintainer : ijm
7 // Lastmod : 20110822 (ijm)
8 // License : Copyright (C) 2011 Ashima Arts. All rights reserved.
9 // Distributed under the MIT License. See LICENSE file.
10 // https://github.com/ashima/webgl-noise
11 //
12
13 float noise4d(vec4 v) {
14 const vec4 C = vec4( 0.138196601125011, // (5 - sqrt(5))/20 G4
15 0.276393202250021, // 2 * G4
16 0.414589803375032, // 3 * G4
17 -0.447213595499958); // -1 + 4 * G4
18
19 // (sqrt(5) - 1)/4 = F4, used once below
20 #define F4 0.309016994374947451
21
22 // First corner
23 vec4 i = floor(v + dot(v, vec4(F4)) );
24 vec4 x0 = v - i + dot(i, C.xxxx);
25
26 // Other corners
27
28 // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
29 vec4 i0;
30 vec3 isX = step( x0.yzw, x0.xxx );
31 vec3 isYZ = step( x0.zww, x0.yyz );
32 // i0.x = dot( isX, vec3( 1.0 ) );
33 i0.x = isX.x + isX.y + isX.z;
34 i0.yzw = 1.0 - isX;
35 // i0.y += dot( isYZ.xy, vec2( 1.0 ) );
36 i0.y += isYZ.x + isYZ.y;
37 i0.zw += 1.0 - isYZ.xy;
38 i0.z += isYZ.z;
39 i0.w += 1.0 - isYZ.z;
40
41 // i0 now contains the unique values 0,1,2,3 in each channel
42 vec4 i3 = clamp( i0, 0.0, 1.0 );
43 vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );
44 vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );
45
46 // x0 = x0 - 0.0 + 0.0 * C.xxxx
47 // x1 = x0 - i1 + 1.0 * C.xxxx
48 // x2 = x0 - i2 + 2.0 * C.xxxx
49 // x3 = x0 - i3 + 3.0 * C.xxxx
50 // x4 = x0 - 1.0 + 4.0 * C.xxxx
51 vec4 x1 = x0 - i1 + C.xxxx;
52 vec4 x2 = x0 - i2 + C.yyyy;
53 vec4 x3 = x0 - i3 + C.zzzz;
54 vec4 x4 = x0 + C.wwww;
55
56 // Permutations
57 i = mod289(i);
58 float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);
59 vec4 j1 = permute( permute( permute( permute (
60 i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))
61 + i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))
62 + i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))
63 + i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));
64
65 // Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
66 // 7*7*6 = 294, which is close to the ring size 17*17 = 289.
67 vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;
68
69 vec4 p0 = grad4(j0, ip);
70 vec4 p1 = grad4(j1.x, ip);
71 vec4 p2 = grad4(j1.y, ip);
72 vec4 p3 = grad4(j1.z, ip);
73 vec4 p4 = grad4(j1.w, ip);
74
75 // Normalise gradients
76 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
77 p0 *= norm.x;
78 p1 *= norm.y;
79 p2 *= norm.z;
80 p3 *= norm.w;
81 p4 *= taylorInvSqrt(dot(p4,p4));
82
83 // Mix contributions from the five corners
84 vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);
85 vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);
86 m0 = m0 * m0;
87 m1 = m1 * m1;
88 return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))
89 + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;
90
91 }
92
93 //
NoiseUtils.glsllib starts here
94 // Noise Functions used in Noise2D, Noise3D and Noise4D glsllib
95
96 vec2 mod289(vec2 x) {
97 return x - floor(x * (1.0 / 289.0)) * 289.0;
98 }
99
100 vec3 mod289(vec3 x) {
101 return x - floor(x * (1.0 / 289.0)) * 289.0;
102 }
103
104 vec4 mod289(vec4 x) {
105 return x - floor(x * (1.0 / 289.0)) * 289.0;
106 }
107
108 float mod289(float x) {
109 return x - floor(x * (1.0 / 289.0)) * 289.0;
110 }
111
112 vec3 permute(vec3 x) {
113 return mod289(((x*34.0)+1.0)*x);
114 }
115
116 vec4 permute(vec4 x) {
117 return mod289(((x*34.0)+1.0)*x);
118 }
119
120 float permute(float x) {
121 return mod289(((x*34.0)+1.0)*x);
122 }
123
124 vec4 taylorInvSqrt(vec4 r) {
125 return 1.79284291400159 - 0.85373472095314 * r;
126 }
127
128 float taylorInvSqrt(float r) {
129 return 1.79284291400159 - 0.85373472095314 * r;
130 }
131
132 vec4 grad4(float j, vec4 ip) {
133 const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);
134 vec4 p,s;
135
136 p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;
137 p.w = 1.5 - dot(abs(p.xyz), ones.xyz);
138 s = vec4(lessThan(p, vec4(0.0)));
139 p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;
140
141 return p;
142 }
143
144
//
sun.frag starts here
145 uniform vec4 m_Color;
146 uniform float g_Time;
147
148 in vec4 texCoord4D;
149
150 out vec4 outTex;
151
152 void main( void ) {
153 // Make texel turbulence.
154 float n = abs(noise4d(vec4(texCoord4D.xyz, g_Time * 0.15)) - 0.5) +
155 abs(noise4d(vec4(texCoord4D.xyz * 2.0, g_Time * 0.15)) - 0.25) +
156 abs(noise4d(vec4(texCoord4D.xyz * 4.0, g_Time * 0.15)) - 0.125) +
157 abs(noise4d(vec4(texCoord4D.xyz * 8.0, g_Time * 0.15)) - 0.0625) +
158 abs(noise4d(vec4(texCoord4D.xyz * 16.0, g_Time * 0.15)) - 0.03125);
159
160 // colorize to sun's color then return.
161 outTex = vec4(n * m_Color.rgb * vec3(0.50), m_Color.a);
162 }
Jul 18, 2012 2:42:20 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.renderer.RendererException: compile error in:ShaderSource[name=CustomShader/Stars/sun.frag, defines, type=Fragment, language=GLSL130] error:0(57) : error C1008: undefined variable "mod289"
0(58) : error C1008: undefined variable "permute"
0(58) : error C1008: undefined variable "permute"
0(58) : error C1008: undefined variable "permute"
0(58) : error C1008: undefined variable "permute"
0(63) : error C1008: undefined variable "permute"
0(63) : error C1008: undefined variable "permute"
0(63) : error C1008: undefined variable "permute"
0(63) : error C1008: undefined variable "permute"
0(69) : error C1008: undefined variable "grad4"
0(70) : error C1008: undefined variable "grad4"
0(71) : error C1008: undefined variable "grad4"
0(72) : error C1008: undefined variable "grad4"
0(73) : error C1008: undefined variable "grad4"
0(76) : error C1008: undefined variable "taylorInvSqrt"
0(81) : error C1008: undefined variable "taylorInvSqrt"
[/java]
Relevant line numbers are: 1, 57 (where error occurs), 93, 145 are commented with ownership.
The sun.frag is simple.
[java]
#import "Shaders/NoiseUtils.glsllib"
#import "Shaders/Noise4D.glsllib"
uniform vec4 m_Color;
uniform float g_Time;
in vec4 texCoord4D;
out vec4 outTex;
void main( void ) {
// [noise generation goes here]
}
[/java]