hello,
i received my orange book few days ago. so i'm back with glsl.
i give up for now with multitexture. my aim was to use 1 noisy texture to distord the other one. i discover the noise fonction of glsl, but i've got problem, trying to use it.
by example, a simple vertex shader like this :
void main(void) { vec4 v = vec4(gl_Vertex); vec4 pos = gl_ModelViewMatrix * v; float LightIntensity = max(dot(normalize(vec3(0.,3.,3.) - pos.xyz), gl_Normal), 0.0); gl_FrontColor = gl_Color * LightIntensity;
v.x += 0.1 * noise1(v); // commenting this line // make the shader to work
gl_Position = gl_ModelViewProjectionMatrix * v; }
gives me error :
Vertex info ----------- <stdlib>(3998) : warning C7011: implicit cast from "int" to "float" <stdlib>(3998) : warning C7011: implicit cast from "int" to "float"
(same errore with noise1, noise2, noise3.., whatever vecter size of the input parametter)
does anyone know where the problem came from? what should i try? etc
should i ask this question in an other mailling list (as i don't think it's a gem problem)?
does anyone interested in my working example: sould i upload my patch somwhere?
thanks Cyrille
I haven't used the noise function becuase it does not run in hardware on ATI or Nvidia (only 3DLabs). You might have to use temporary variables or explicitly cast like:
vx += (float) (0.1 * noise1())
On 9/14/06, cyrille henry cyrille.henry@la-kitchen.fr wrote:
hello,
i received my orange book few days ago. so i'm back with glsl.
i give up for now with multitexture. my aim was to use 1 noisy texture to distord the other one. i discover the noise fonction of glsl, but i've got problem, trying to use it.
by example, a simple vertex shader like this :
void main(void) { vec4 v = vec4(gl_Vertex); vec4 pos = gl_ModelViewMatrix * v; float LightIntensity = max(dot(normalize(vec3(0.,3.,3.) - pos.xyz ), gl_Normal), 0.0); gl_FrontColor = gl_Color * LightIntensity;
v.x += 0.1 * noise1(v); // commenting this line // make the shader to work gl_Position = gl_ModelViewProjectionMatrix * v;
}
gives me error :
Vertex info
<stdlib>(3998) : warning C7011: implicit cast from "int" to "float" <stdlib>(3998) : warning C7011: implicit cast from "int" to "float"
(same errore with noise1, noise2, noise3.., whatever vecter size of the input parametter)
does anyone know where the problem came from? what should i try? etc
should i ask this question in an other mailling list (as i don't think it's a gem problem)?
does anyone interested in my working example: sould i upload my patch somwhere?
thanks Cyrille
GEM-dev mailing list GEM-dev@iem.at http://lists.puredata.info/listinfo/gem-dev
hello chris, thanks for your sugestion
chris clepper a écrit :
I haven't used the noise function becuase it does not run in hardware on ATI or Nvidia (only 3DLabs).
i did not know that. what did you use then? a jpg texture?
You might have to use temporary variables or explicitly cast like:
vx += (float) (0.1 * noise1())
i tried this, but it does not change anything. the error : "<stdlib>(3998)" does not look like the error i've got when i do this kind of mistake.
Cyrille
On 9/14/06, *cyrille henry* <cyrille.henry@la-kitchen.fr mailto:cyrille.henry@la-kitchen.fr> wrote:
hello, i received my orange book few days ago. so i'm back with glsl. i give up for now with multitexture. my aim was to use 1 noisy texture to distord the other one. i discover the noise fonction of glsl, but i've got problem, trying to use it. by example, a simple vertex shader like this : void main(void) { vec4 v = vec4(gl_Vertex); vec4 pos = gl_ModelViewMatrix * v; float LightIntensity = max(dot(normalize(vec3(0.,3.,3.) - pos.xyz), gl_Normal), 0.0); gl_FrontColor = gl_Color * LightIntensity; v.x += 0.1 * noise1(v); // commenting this line // make the shader to work gl_Position = gl_ModelViewProjectionMatrix * v; } gives me error : Vertex info ----------- <stdlib>(3998) : warning C7011: implicit cast from "int" to "float" <stdlib>(3998) : warning C7011: implicit cast from "int" to "float" (same errore with noise1, noise2, noise3.., whatever vecter size of the input parametter) does anyone know where the problem came from? what should i try? etc should i ask this question in an other mailling list (as i don't think it's a gem problem)? does anyone interested in my working example: sould i upload my patch somwhere? thanks Cyrille _______________________________________________ GEM-dev mailing list GEM-dev@iem.at <mailto:GEM-dev@iem.at> http://lists.puredata.info/listinfo/gem-dev
On 9/14/06, cyrille henry cyrille.henry@la-kitchen.fr wrote:
hello chris, thanks for your sugestion
chris clepper a écrit :
I haven't used the noise function becuase it does not run in hardware on ATI or Nvidia (only 3DLabs).
i did not know that. what did you use then? a jpg texture?
Yes, a texture is what is normally used. In GEM you can use sig2pix to generate random values. The GLSL noise is not random but a Perlin noise generator.
You might have to use temporary variables
or explicitly cast like:
vx += (float) (0.1 * noise1())
i tried this, but it does not change anything. the error : "<stdlib>(3998)" does not look like the error i've got when i do this kind of mistake.
The first error doesn't make sense because GLSL does not support integers of any type according to the orange book.
Can you post the fragment portion of the shader so I can test the whole thing?
I just fired up your vertex shader in OSX Shaderbuilder and it runs fine. And it runs in GEM as well with a passthrough fragment shader. The only problem on the Mac so far is that it prints that the shader is running in hardware when it is clearly killing the CPU and software only.
I will try it on a PC now and post the results.
cgc
chris clepper a écrit :
I just fired up your vertex shader in OSX Shaderbuilder and it runs fine. And it runs in GEM as well with a passthrough fragment shader. The only problem on the Mac so far is that it prints that the shader is running in hardware when it is clearly killing the CPU and software only.
I will try it on a PC now and post the results.
ok, thanks.
here is all the files, if someone else what to try.
cyrille
cgc
void main() { gl_FragColor = gl_Color; }
#N canvas 408 201 614 572 10; #X obj 75 22 gemhead; #X msg 30 62 print; #X obj 74 446 glsl_program; #X obj 148 306 pack 0 0; #X msg 32 187 print; #X obj 169 286 t b f; #X obj 169 241 change; #X obj 147 103 change; #X msg 148 346 link $1 $2; #X msg 31 399 print; #X floatatom 169 267 2 0 0 0 ID - -; #X floatatom 147 126 2 0 0 0 ID - -; #X obj 166 367 print linking; #X obj 74 490 rotateXYZ; #X floatatom 93 468 5 0 0 0 - - -; #X floatatom 349 379 5 0 0 0 - - -; #X obj 351 15 _gemwin; #X obj 352 202 _light _________________________; #X msg 349 397 time $1; #X floatatom 137 468 5 0 0 0 - - -; #X floatatom 179 466 5 0 0 0 - - -; #X obj 75 221 glsl_fragment; #X obj 75 84 glsl_vertex; #X obj 73 520 teapot; #X obj 265 28 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 94 60 open noise.vert; #X msg 96 192 open noise.frag; #X connect 0 0 22 0; #X connect 1 0 22 0; #X connect 2 0 13 0; #X connect 3 0 8 0; #X connect 4 0 21 0; #X connect 5 0 3 0; #X connect 5 1 3 1; #X connect 6 0 10 0; #X connect 7 0 11 0; #X connect 8 0 2 0; #X connect 8 0 12 0; #X connect 9 0 2 0; #X connect 10 0 5 0; #X connect 11 0 3 0; #X connect 13 0 23 0; #X connect 14 0 13 1; #X connect 15 0 18 0; #X connect 18 0 2 0; #X connect 19 0 13 2; #X connect 20 0 13 3; #X connect 21 0 2 0; #X connect 21 1 6 0; #X connect 22 0 21 0; #X connect 22 1 7 0; #X connect 24 0 25 0; #X connect 24 0 26 0; #X connect 25 0 22 0; #X connect 26 0 21 0;
void main(void) { vec4 v = vec4(gl_Vertex); vec4 pos = gl_ModelViewMatrix * v; float LightIntensity = max(dot(normalize(vec3(0.,3.,3.) - pos.xyz), gl_Normal), 0.0); gl_FrontColor = gl_Color * LightIntensity;
// v.x += 0.1 * noise1(v); v.x += (float)(0.1 * noise1(v));
gl_Position = gl_ModelViewProjectionMatrix * v; }
chris clepper a écrit :
On 9/14/06, *cyrille henry* <cyrille.henry@la-kitchen.fr mailto:cyrille.henry@la-kitchen.fr> wrote:
hello chris, thanks for your sugestion chris clepper a écrit : > I haven't used the noise function becuase it does not run in hardware on > ATI or Nvidia (only 3DLabs). i did not know that. what did you use then? a jpg texture?
Yes, a texture is what is normally used. In GEM you can use sig2pix to generate random values. The GLSL noise is not random but a Perlin noise generator.
ok, so i'm back with multi texture problem.
>You might have to use temporary variables > or explicitly cast like: > > vx += (float) (0.1 * noise1()) i tried this, but it does not change anything. the error : "<stdlib>(3998)" does not look like the error i've
got when
i do this kind of mistake.
The first error doesn't make sense because GLSL does not support integers of any type according to the orange book.
yes. thas why i though the problem did not cam from the shader. is it possible the problem come from my graphyc card, or my OS or graphic driver?
(nvidia Quadro FX 1400 : it's a good card, but not optimized for video game)
Can you post the fragment portion of the shader so I can test the whole thing?
there is nothing in the frag shader.
void main() { gl_FragColor = gl_Color; }
thanks cyrille