Subversion Repositories gelsvn

Rev

Rev 401 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 401 Rev 403
Line 7... Line 7...
7
 *
7
 *
8
 */
8
 */
9
 
9
 
10
#include <algorithm>
10
#include <algorithm>
11
#include <string>
11
#include <string>
12
#include "Renderer.h"
12
#include <CGLA/Mat3x3d.h>
13
#include <GLGraphics/glsl_shader.h>
13
#include <GLGraphics/glsl_shader.h>
-
 
14
#include <HMesh/FaceCirculator.h>
-
 
15
 
-
 
16
#include <GLConsole/GLConsole.h>
-
 
17
 
-
 
18
#include "Renderer.h"
-
 
19
#include "curvature.h"
14
 
20
 
15
using namespace GLGraphics;
21
using namespace GLGraphics;
16
using namespace CGLA;
22
using namespace CGLA;
17
using namespace HMesh;
23
using namespace HMesh;
18
using namespace std;
24
using namespace std;
19
 
25
 
-
 
26
GLuint get_noise_texture_id()
-
 
27
{
-
 
28
	static GLuint texname=0;
-
 
29
	static bool was_here = false;
-
 
30
	
-
 
31
	if(!was_here)
-
 
32
	{
-
 
33
		was_here = true;
-
 
34
		int width = 32;
-
 
35
		int height = 32;
-
 
36
		int depth = 32;
-
 
37
		vector<unsigned char> texels(width*height*depth);
-
 
38
		for (int i = 0; i < width*height*depth; ++i)
-
 
39
		{
-
 
40
			int intensity = 255.0 * (float(rand()) / RAND_MAX);
-
 
41
			texels[i] = (unsigned char) intensity;
-
 
42
		}
-
 
43
		
-
 
44
		glGenTextures(1, &texname);	
-
 
45
		glBindTexture(GL_TEXTURE_3D, texname);	
-
 
46
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-
 
47
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
 
48
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-
 
49
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
 
50
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
-
 
51
		glTexImage3D(GL_TEXTURE_3D, 0, GL_INTENSITY8, width, height, depth, 0, GL_RED, GL_UNSIGNED_BYTE, &texels[0]);
-
 
52
	}
-
 
53
	
-
 
54
	return texname;
-
 
55
}
-
 
56
 
-
 
57
 
20
int WireframeRenderer::maximum_face_valency(HMesh::Manifold& m)
58
int WireframeRenderer::maximum_face_valency(HMesh::Manifold& m)
21
{
59
{
22
	int max_val = 0;
60
	int max_val = 0;
23
	for(FaceIter f = m.faces_begin(); f != m.faces_end(); ++f)
61
	for(FaceIter f = m.faces_begin(); f != m.faces_end(); ++f)
24
		max_val = max(max_val, no_edges(f));
62
		max_val = max(max_val, no_edges(f));
25
	return max_val;
63
	return max_val;
26
}
64
}
27
 
65
 
28
 
-
 
29
WireframeRenderer::WireframeRenderer(HMesh::Manifold& m, bool flat): idbuff_renderer(0)
66
WireframeRenderer::WireframeRenderer(HMesh::Manifold& m, bool smooth): idbuff_renderer(0)
30
{
67
{
31
	if(GLEW_EXT_geometry_shader4 && maximum_face_valency(m) > 3)
68
	if(GLEW_EXT_geometry_shader4 && maximum_face_valency(m) > 3)
32
	{
69
	{
33
		GLint viewp[4];
70
		GLint viewp[4];
34
		glGetIntegerv(GL_VIEWPORT,viewp);
71
		glGetIntegerv(GL_VIEWPORT,viewp);
Line 36... Line 73...
36
	}
73
	}
37
	else
74
	else
38
	{
75
	{
39
		glNewList(display_list,GL_COMPILE);
76
		glNewList(display_list,GL_COMPILE);
40
		if(GLEW_EXT_geometry_shader4)
77
		if(GLEW_EXT_geometry_shader4)
41
			draw_triangles_in_wireframe(m,flat, Vec3f(1,0,0));				
78
			draw_triangles_in_wireframe(m,smooth, Vec3f(1,0,0));				
42
		else
79
		else
43
			draw_wireframe_oldfashioned(m,flat, Vec3f(1,0,0));
80
			draw_wireframe_oldfashioned(m,smooth, Vec3f(1,0,0));
44
		glEndList();
81
		glEndList();
45
	}
82
	}
46
}
83
}
47
 
84
 
48
void WireframeRenderer::draw()
85
void WireframeRenderer::draw()
Line 51... Line 88...
51
		idbuff_renderer->draw(Vec3f(1,0,0),Vec3f(0.5)); 
88
		idbuff_renderer->draw(Vec3f(1,0,0),Vec3f(0.5)); 
52
	else
89
	else
53
		glCallList(display_list);
90
		glCallList(display_list);
54
}
91
}
55
 
92
 
56
SimpleShaderRenderer::SimpleShaderRenderer(HMesh::Manifold& m, const std::string& vss, const std::string& fss)
93
void SimpleShaderRenderer::init_shaders(const std::string& vss, 
-
 
94
										const std::string& fss)
57
{
95
{
58
	vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
96
	vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
59
	print_glsl_program_log(vs);
97
	print_glsl_program_log(vs);
-
 
98
	
60
	fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
99
	fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
61
	print_glsl_program_log(fs);
100
	print_glsl_program_log(fs);
62
	
101
 
63
	prog = glCreateProgram();
102
	prog = glCreateProgram();
64
	
103
	
65
	if(vs) glAttachShader(prog, vs);
104
	if(vs) glAttachShader(prog, vs);
66
	if(fs) glAttachShader(prog, fs);
105
	if(fs) glAttachShader(prog, fs);
67
	
106
	
68
	glLinkProgram(prog);
107
	glLinkProgram(prog);
69
	print_glsl_program_log(prog);
108
	print_glsl_program_log(prog);
-
 
109
	
-
 
110
}
-
 
111
 
-
 
112
void SimpleShaderRenderer::compile_display_list(Manifold& m, bool smooth)
-
 
113
{
70
	glNewList(display_list,GL_COMPILE);
114
	glNewList(display_list,GL_COMPILE);
71
	GLGraphics::draw(m, true);
115
	GLGraphics::draw(m, smooth);
72
	glEndList();
116
	glEndList();	
73
}
117
}
74
 
118
 
75
void SimpleShaderRenderer::draw()
119
void SimpleShaderRenderer::draw()
76
{
120
{
77
	GLint old_prog;
121
	GLint old_prog;
Line 141... Line 185...
141
"	\n"
185
"	\n"
142
"	// decide if we hit a white or black ring, based on y value\n"
186
"	// decide if we hit a white or black ring, based on y value\n"
143
"	gl_FragColor = diff * vec4(0.5,0.5,0.4,0.0) + smoothstep(0.8, 1.0,cos(20.0*angle)) * vec4(0.5,0.5,0.6,0.0);\n"
187
"	gl_FragColor = diff * vec4(0.5,0.5,0.4,0.0) + smoothstep(0.8, 1.0,cos(20.0*angle)) * vec4(0.5,0.5,0.6,0.0);\n"
144
"}\n";
188
"}\n";
145
 
189
 
146
const string MetallicRenderer::vss = 
190
const string ToonRenderer::vss = 
147
"varying vec3 n;\n"
191
"varying vec3 n;\n"
148
"varying vec3 v;\n"
192
"varying vec3 v;\n"
149
"\n"
193
"\n"
150
"void main(void)\n"
194
"void main(void)\n"
151
"{\n"
195
"{\n"
152
"	gl_Position = ftransform();\n"
196
"	gl_Position = ftransform();\n"
153
"	v = vec3(gl_ModelViewMatrix * gl_Vertex);\n"
197
"	v = vec3(gl_ModelViewMatrix * gl_Vertex);\n"
154
"	n = normalize(gl_NormalMatrix * gl_Normal);\n"
198
"	n = normalize(gl_NormalMatrix * gl_Normal);\n"
155
"}\n";
199
"}\n";
156
 
200
 
157
const string MetallicRenderer::fss = 
201
const string ToonRenderer::fss = 
158
"varying vec3 n;\n"
202
"varying vec3 n;\n"
159
"varying vec3 v;\n"
203
"varying vec3 v;\n"
160
"\n"
204
"\n"
161
"void main(void)\n"
205
"void main(void)\n"
162
"{\n"
206
"{\n"
163
"	vec3 l = normalize(-v);\n"
207
"	vec3 l = normalize(-v);\n"
164
"	vec3 e = l;\n"
208
"	vec3 e = l;\n"
165
"	vec3 r = normalize(2.0*dot(l, n)*n - l);\n"
209
"	vec3 r = normalize(2.0*dot(l, n)*n - l);\n"
166
"	\n"
210
"	\n"
167
"	vec4 a = vec4(0.0,0.1,.3,1.0);\n"
211
"	vec4 a = vec4(0.0,0.1,.3,1.0);\n"
168
"	vec4 d = vec4(0.7,0.7,0.0,1.0) * abs(dot(l, n));\n"
212
"   float dot_ln = abs(dot(l, n));\n"
169
"	float sr = 0.2*smoothstep(0.2,0.95,dot(r, e));\n"
213
"	vec4 d = vec4(0.7,0.7,0.0,1.0) * 0.25 * (smoothstep(0.23,0.25,dot_ln)+smoothstep(0.45,0.47,dot_ln)+smoothstep(0.7,0.72,dot_ln)+smoothstep(0.9,0.92,dot_ln));\n"
170
"	float sg = 0.09*smoothstep(0.4,0.95,dot(r, e));\n"
-
 
171
"	float sb = 0.07*smoothstep(0.9,0.95,dot(r, e));\n"
214
"	vec4 s = vec4(0.5,0.3,0.4,1.0)*smoothstep(0.96,0.98,dot(r, e));\n"
172
"	\n"
215
"	\n"
173
"	gl_FragColor =  a + d + vec4(sr,sg,sb,1.0);\n"
216
"	gl_FragColor =  d+s;\n"
174
"}\n";
217
"}\n";
175
 
218
 
-
 
219
 
-
 
220
void GlazedRenderer::draw()
-
 
221
{
-
 
222
	GLint old_prog;
-
 
223
	glGetIntegerv(GL_CURRENT_PROGRAM, &old_prog);
-
 
224
	glUseProgram(prog);
-
 
225
	glBindTexture(GL_TEXTURE_3D, get_noise_texture_id());
-
 
226
	glUniform1iARB(glGetUniformLocationARB(prog, "noise_tex"),0);
-
 
227
	glUniform1fARB(glGetUniformLocationARB(prog, "noise_scale"),12.0/bsphere_rad);
-
 
228
	glCallList(display_list);
-
 
229
	glUseProgram(old_prog);
-
 
230
}
-
 
231
 
-
 
232
 
-
 
233
 
176
const string GlazedRenderer::vss = 
234
const string GlazedRenderer::vss = 
177
"varying vec3 n;\n"
235
"varying vec3 n;\n"
178
"varying vec3 v;\n"
236
"varying vec3 v;\n"
-
 
237
"varying vec3 v_obj;\n"
179
"\n"
238
"\n"
180
"void main(void)\n"
239
"void main(void)\n"
181
"{\n"
240
"{\n"
182
"	gl_Position = ftransform();\n"
241
"	gl_Position = ftransform();\n"
-
 
242
"   v_obj = gl_Vertex.xyz;\n"
183
"	v = vec3(gl_ModelViewMatrix * gl_Vertex);\n"
243
"	v = vec3(gl_ModelViewMatrix * gl_Vertex);\n"
184
"	n = normalize(gl_NormalMatrix * gl_Normal);\n"
244
"	n = normalize(gl_NormalMatrix * gl_Normal);\n"
185
"}\n"
245
"}\n"
186
"\n";
246
"\n";
187
 
247
 
188
const string GlazedRenderer::fss =
248
const string GlazedRenderer::fss =
-
 
249
"uniform sampler3D noise_tex;\n"
-
 
250
"uniform float noise_scale;\n"
189
"varying vec3 n;\n"
251
"varying vec3 n;\n"
190
"varying vec3 v;\n"
252
"varying vec3 v;\n"
-
 
253
"varying vec3 v_obj;\n"
191
"\n"
254
"\n"
192
"vec4 glazed_shader(vec4 mat_col,  vec4 light_col, vec3 light_dir)\n"
255
"vec4 glazed_shader(vec4 mat_col,  vec4 light_col, vec3 light_dir)\n"
193
"{\n"
256
"{\n"
194
"	vec3 e = normalize(-v);\n"
257
"	vec3 e = normalize(-v);\n"
195
"	vec3 r = normalize(2.0*dot(e, n)*n - e);\n"
258
"	vec3 r = normalize(2.0*dot(e, n)*n - e);\n"
Line 199... Line 262...
199
"	return 0.15*refl + diff;\n"
262
"	return 0.15*refl + diff;\n"
200
"}\n"
263
"}\n"
201
"\n"
264
"\n"
202
"void main(void)\n"
265
"void main(void)\n"
203
"{\n"
266
"{\n"
-
 
267
"	vec4 mat_col = vec4(0.9,1.0,0.4,1.0) + vec4(-0.1,-0.1,0.12,0.0) * texture3D(noise_tex, noise_scale*v_obj).x\n"
204
"	vec4 mat_col = vec4(0.9,1.0,0.4,1.0);\n"
268
" + vec4(0.05) * texture3D(noise_tex, 500.0*v_obj).x;\n"
205
"	\n"
269
"	\n"
206
"	vec3 light0_dir = vec3(0.0,1.0,0.0);\n"
270
"	vec3 light0_dir = vec3(0.0,1.0,0.0);\n"
207
"	vec4 light0_col = vec4(0.7,0.9,1.0,1.0);\n"
271
"	vec4 light0_col = vec4(0.7,0.9,1.0,1.0);\n"
208
"	\n"
272
"	\n"
209
"	vec3 light1_dir = vec3(0.0,0.0,1.0);\n"
273
"	vec3 light1_dir = vec3(0.0,0.0,1.0);\n"
Line 215... Line 279...
215
"	\n"
279
"	\n"
216
"	gl_FragColor.a = 1.0;\n"
280
"	gl_FragColor.a = 1.0;\n"
217
"}\n";
281
"}\n";
218
 
282
 
219
 
283
 
-
 
284
const string ScalarFieldRenderer::vss =
-
 
285
"	attribute float scalar;\n"
-
 
286
"	varying vec3 normal;\n"
-
 
287
"	varying float s;\n"
-
 
288
"	\n"
-
 
289
"	void main(void)\n"
-
 
290
"	{\n"
-
 
291
"		gl_Position =  ftransform();\n"
-
 
292
"		normal = normalize(gl_NormalMatrix * gl_Normal);\n"
-
 
293
"		s=scalar;\n"
-
 
294
"	}\n";
-
 
295
 
-
 
296
const string ScalarFieldRenderer::fss = 	
-
 
297
"	varying vec3 normal;\n"
-
 
298
"	varying float s;\n"
-
 
299
"	uniform float scalar_max;\n"
-
 
300
"   uniform float gamma;\n"
-
 
301
"	const vec3 light_dir = vec3(0,0,1);\n"
-
 
302
"	\n"
-
 
303
"	void main()\n"
-
 
304
"	{\n"
-
 
305
"		float dot_ln = max(0.0,dot(light_dir, normal));\n"
-
 
306
"		\n"
-
 
307
"		float s_norm = s/scalar_max;\n"
-
 
308
"		float stripe_signal = 100.0 * s_norm;\n"
-
 
309
"		vec4 stripe_col = abs(stripe_signal) < 3.14 ? vec4(0,0,0,0) : vec4(.1,.1,.1,0);\n"
-
 
310
"		\n"
-
 
311
"		gl_FragColor = s_norm * vec4(-1,0,1,0);\n"
-
 
312
"       gl_FragColor *= dot_ln;\n"
-
 
313
"       gl_FragColor.r = pow(gl_FragColor.r, 1.0/gamma);\n"
-
 
314
"       gl_FragColor.g = pow(gl_FragColor.g, 1.0/gamma);\n"
-
 
315
"       gl_FragColor.b = pow(gl_FragColor.b, 1.0/gamma);\n"
-
 
316
"		gl_FragColor += stripe_col * smoothstep(0.8,1.0,cos(stripe_signal));\n"
-
 
317
"	}\n";
-
 
318
 
-
 
319
ScalarFieldRenderer::ScalarFieldRenderer(HMesh::Manifold& m, bool smooth,
-
 
320
										std::vector<double>& field, double max_val)
-
 
321
{
-
 
322
	init_shaders(vss,fss);
-
 
323
	
-
 
324
	GLint old_prog;
-
 
325
	glGetIntegerv(GL_CURRENT_PROGRAM, &old_prog);
-
 
326
	glUseProgram(prog);
-
 
327
	
-
 
328
	GLuint scalar_attrib = glGetAttribLocation(prog, "scalar");
-
 
329
	glUniform1fARB(glGetUniformLocationARB(prog, "scalar_max"), max_val);
-
 
330
	
-
 
331
	static CVar<float> gamma("display.scalar_field_renderer.gamma",2.2);
-
 
332
	glUniform1fARB(glGetUniformLocationARB(prog, "gamma"), gamma);
-
 
333
	glNewList(display_list,GL_COMPILE);
-
 
334
	
-
 
335
	for(FaceIter f=m.faces_begin(); f != m.faces_end(); ++f)
-
 
336
	{
-
 
337
		FaceCirculator fc(f);
-
 
338
		if(!smooth) 
-
 
339
			glNormal3fv(normal(f).get());
-
 
340
		if(no_edges(f)== 3) 
-
 
341
			glBegin(GL_TRIANGLES);
-
 
342
		else 
-
 
343
			glBegin(GL_POLYGON);
-
 
344
		
-
 
345
		while(!fc.end())
-
 
346
		{
-
 
347
			Vec3d n(normal(fc.get_vertex()));
-
 
348
			if(smooth) 
-
 
349
				glNormal3dv(n.get());
-
 
350
			int i = fc.get_vertex()->touched;
-
 
351
			glVertexAttrib1d(scalar_attrib, field[i]);
-
 
352
			glVertex3fv(fc.get_vertex()->pos.get());
-
 
353
			++fc;
-
 
354
		}
-
 
355
		glEnd();
-
 
356
	}
-
 
357
	glEndList();	
-
 
358
	glUseProgram(old_prog);
-
 
359
	
-
 
360
}
-
 
361
 
-
 
362
 
-
 
363
LineFieldRenderer::LineFieldRenderer(HMesh::Manifold& m, bool smooth, vector<Vec3d>& lines, float _r): 
-
 
364
	r(_r)
-
 
365
{
-
 
366
	init_shaders(vss,fss);
-
 
367
 
-
 
368
	GLint old_prog;
-
 
369
	glGetIntegerv(GL_CURRENT_PROGRAM, &old_prog);
-
 
370
	glUseProgram(prog);
-
 
371
	
-
 
372
	GLuint direction = glGetAttribLocation(prog, "direction");
-
 
373
	
-
 
374
	glNewList(display_list,GL_COMPILE);
-
 
375
	for(FaceIter f=m.faces_begin(); f != m.faces_end(); ++f)
-
 
376
	{
-
 
377
		FaceCirculator fc(f);
-
 
378
		if(!smooth) 
-
 
379
			glNormal3fv(normal(f).get());
-
 
380
		if(no_edges(f)== 3) 
-
 
381
			glBegin(GL_TRIANGLES);
-
 
382
		else 
-
 
383
			glBegin(GL_POLYGON);
-
 
384
		while(!fc.end())
-
 
385
		{
-
 
386
			Vec3d n(normal(fc.get_vertex()));
-
 
387
			if(smooth) 
-
 
388
				glNormal3dv(n.get());
-
 
389
			int i = fc.get_vertex()->touched;
-
 
390
			Vec3d d = lines[i];
-
 
391
			d = normalize(d-n*dot(n,d));
-
 
392
			glVertexAttrib3dv(direction, d.get());
-
 
393
			glVertex3fv(fc.get_vertex()->pos.get());
-
 
394
			++fc;
-
 
395
		}
-
 
396
		glEnd();
-
 
397
	}
-
 
398
	glEndList();	
-
 
399
	glUseProgram(old_prog);
-
 
400
 
-
 
401
}
220
 
402
 
-
 
403
void LineFieldRenderer::draw()
-
 
404
{
-
 
405
	GLint old_prog;
-
 
406
	glGetIntegerv(GL_CURRENT_PROGRAM, &old_prog);
-
 
407
	glUseProgram(prog);
-
 
408
	static CVar<float> curvature_lines_scale("display.line_field_renderer.line_length", .015);
-
 
409
	static CVar<float> noise_scale("display.line_field_renderer.noise_scale", 12.0/r);
-
 
410
	static CVar<float> noise_amplitude("display.line_field_renderer.noise_amplitude", .06);
-
 
411
	glUniform1fARB(glGetUniformLocationARB(prog, "scale_line"),curvature_lines_scale);
-
 
412
	glUniform1fARB(glGetUniformLocationARB(prog, "noise_scale"),noise_scale);
-
 
413
	glUniform1fARB(glGetUniformLocationARB(prog, "noise_amplitude"),noise_amplitude);	
-
 
414
	
-
 
415
	glBindTexture(GL_TEXTURE_3D, get_noise_texture_id());
-
 
416
	glUniform1iARB(glGetUniformLocationARB(prog, "noise_tex"),0);
-
 
417
	glCallList(display_list);
-
 
418
	glUseProgram(old_prog);	
-
 
419
	glBindTexture(GL_TEXTURE_3D, 0);
-
 
420
}
-
 
421
 
-
 
422
const string LineFieldRenderer::vss = 
-
 
423
"attribute vec3 direction;\n"
-
 
424
"varying vec3 n;\n"
-
 
425
"varying vec3 dir_obj;\n"
-
 
426
"varying vec3 v_obj;\n"
-
 
427
"\n"
-
 
428
"void main(void)\n"
-
 
429
"{\n"
-
 
430
"	gl_Position = ftransform();\n"
-
 
431
"   v_obj = gl_Vertex.xyz;\n"
-
 
432
"	dir_obj = direction;\n"
-
 
433
"	n = normalize(gl_NormalMatrix * gl_Normal);\n"
-
 
434
"}\n";
-
 
435
 
-
 
436
const string LineFieldRenderer::fss =
-
 
437
"uniform sampler3D noise_tex;\n"
-
 
438
"uniform float scale_line;\n"
-
 
439
"uniform float noise_amplitude;\n"
-
 
440
"uniform float noise_scale;\n"
-
 
441
"varying vec3 n;\n"
-
 
442
"varying vec3 dir_obj;\n"
-
 
443
"varying vec3 v_obj;\n"
-
 
444
"\n"
-
 
445
"float tex(vec3 p) {return smoothstep(0.25,0.5,texture3D(noise_tex, p).x);}\n"
-
 
446
"void main(void)\n"
-
 
447
"{\n"
-
 
448
"   float I = "
-
 
449
"             tex(noise_scale*v_obj + 6.0*scale_line*dir_obj) + \n"
-
 
450
"             tex(noise_scale*v_obj - 6.0*scale_line*dir_obj) + \n"
-
 
451
"             tex(noise_scale*v_obj + 5.0*scale_line*dir_obj) + \n"
-
 
452
"             tex(noise_scale*v_obj - 5.0*scale_line*dir_obj) + \n"
-
 
453
"             tex(noise_scale*v_obj + 4.0*scale_line*dir_obj) + \n"
-
 
454
"             tex(noise_scale*v_obj - 4.0*scale_line*dir_obj) + \n"
-
 
455
"             tex(noise_scale*v_obj + 3.0*scale_line*dir_obj) + \n"
-
 
456
"             tex(noise_scale*v_obj - 3.0*scale_line*dir_obj) + \n"
-
 
457
"             tex(noise_scale*v_obj + 2.0*scale_line*dir_obj) + \n"
-
 
458
"             tex(noise_scale*v_obj - 2.0*scale_line*dir_obj) + \n"
-
 
459
"             tex(noise_scale*v_obj + 1.0*scale_line*dir_obj) + \n"
-
 
460
"             tex(noise_scale*v_obj - 1.0*scale_line*dir_obj) + \n"
-
 
461
"			  tex(noise_scale*v_obj); \n"
-
 
462
"	\n"
-
 
463
"   float diff = max(0.0,dot(n,vec3(0.0, 0.0, 1.0)));\n"
-
 
464
"	gl_FragColor.rgb = vec3(1)*diff*I*noise_amplitude;\n"
-
 
465
"	gl_FragColor.a = 1.0;\n"
-
 
466
"}\n";