Page 2 of 2
Posted: Wed Nov 04, 2009 7:02 pm
by y offs et
Well, I tried a few things with no change. I'm pretty green at shaders. A better approach for me would be to try to construct the simplest shader from scratch.
The stock shader example works fine.
Any examples?
Posted: Thu Nov 05, 2009 3:51 pm
by Kjell
Hi,
Could you please try the attached source containing 4 stages of a Lava-ish shader? Just change the Material to use the different shaders and let me know at what stage it fails ( if at all ).
K
Posted: Thu Nov 05, 2009 6:03 pm
by y offs et
I re-saved as Lava1 with shader none selected.
When loading any zgeproj, virtually every one has some log message after the loading line. However, none appears here, which makes me suspect it never finishes loading. However, after 10 minutes...
Loaded with shader none selected in material - click App - start preview - no problem
select shader1 - on click app - this
#Error in Vertex shader compilation
#Fragment shader compiled OK
#Error when linking shader program
#Error when linking shader program
select none - click - start to move log readout some
select shader2 - on click app - this
#Error in Vertex shader compilation
+GL ERROR: 1282
#Fragment shader compiled OK
#Error when linking shader program
#Error when linking shader program
#Shader variable error:time
select none - click - start to move log readout some
select shader3 - on click app - this
#Error in Vertex shader compilation
+GL ERROR: 1282
#Fragment shader compiled OK
#Error when linking shader program
#Error when linking shader program
#Shader variable error:time
select none - click - start to move log readout some
select shader4 - on click app - this
#Error in Vertex shader compilation
+GL ERROR: 1282
#Fragment shader compiled OK
#Error when linking shader program
#Error when linking shader program
#Shader variable error:time
There's something going on behind because on click start,
there is about 7-15 seconds (lower to higher number shader) from when
+Gamepads detected:0
until
*Models:0
starts streaming at it's usual 1 sec interval.
...and, of course, there is no display of any kind except for a white square.
Not much help I'm afraid.
Posted: Thu Nov 05, 2009 8:19 pm
by Kjell
On the contrary, these results are quite unexpected and might be allot more useful then when everything would work. Here are 4 more basic shaders that result in a green rectangle ( in various sizes ) when they work correctly.
Hopefully this will narrow the scope down a bit
K
Posted: Thu Nov 05, 2009 9:40 pm
by y offs et
When loading any zgeproj, virtually every one has some log message after the loading line. However, none appears here, which makes me suspect it never finishes loading. However, after 1 minutes...
Loaded with shader none selected in material - click App - start preview - no problem
select shader1 - on click app - this
start
works!
select shader2 - on click app - this
start
works!
select shader3 - on click app - this
#Error in Vertex shader compilation
#Fragment shader compiled OK
start
dunno - got a green box like shader1
no more error messages
note - here I decided to go back to the beginning and click/start with <none> as my way of clearing after each trial. Worked thru list again.
Results the same except shader3 gave no error messages and ran with a white box - strange
select none - click - start to move log readout some
select shader4 - on click app - this
start
works!
full green screen
There's something still going on behind because on click start,
there is a longer wait (lower to higher number shader) from when
+Gamepads detected:0
until
*Models:0
starts streaming at it's usual 1 sec interval.
The more trials I did the longer (30 sec-last) as if some calculations are accumulating. I couldn't see a memory leak watching my meter.
Posted: Thu Nov 05, 2009 10:06 pm
by Kjell
Ok,
That actually makes sense, gl_Vertex is a read-only attribute .. so ATI respects the specification more strict then NVIDIA does. Could you try the Lava shaders one more time with the following line removed from all the vertex shaders, to see if it makes any difference?
My guess is that at least the first Lava shader will work then.
Thanks ~
K
Posted: Thu Nov 05, 2009 10:38 pm
by y offs et
Lava1 - code commented.
When loading any zgeproj, virtually every one has some log message after the loading line. However, none appears here, which makes me suspect it never finishes loading. However, after 1 minutes...
Loaded with shader none selected in material - click App - start preview - no problem
select shader1 - on click app - this
start
works!
nice gradient
select none - click - start to move log readout some
select shader2 - on click app - this
start
works!
oohh! pretty moving gradient!
select none - click - start to move log readout some
select shader3 - on click app - this
start
works!
ooohhh! getting rolled over by a rainbw ball!
select none - click - start to move log readout some
select shader4 - on click app - this
start
works!
oohh! the oily blob with the rainbow skin
There's something still going on behind because on click start,
there is a longer wait (lower to higher number shader) from when
+Gamepads detected:0
until
*Models:0
starts streaming at it's usual 1 sec interval.
There's still some data accumulation going on. Something isn't nil'ing.
Posted: Fri Nov 06, 2009 2:24 pm
by VilleK
New article on the same blog:
http://sizecoding.blogspot.com/2009/11/ ... k-for.html
He has made a new version of the shader that is supposed to work better on ATI.
Set FragmentShaderSource to this:
Code: Select all
uniform float w;
float o(vec3 p){return min(
cos(p.x)+cos(p.y)+cos(p.z)+cos(p.y*20)*.02,
length(max(abs(p-vec3(cos(p.z)*.2,cos(p.z)*.2-.5,0))-vec3(.2,.02,w+3),vec3(0)))
);}
vec3 n(vec3 p){return normalize(vec3(o(p+vec3(.02,0,0)),o(p+vec3(0,.02,0)),o(p+vec3(0,0,.02))));}
void main(){
vec3 s=vec3(cos(w),-cos(w*.5)*.5+.5,w);
vec3 e=normalize(vec3(gl_FragCoord.xy*.002-1,1));
vec3 p=s;
for(int i=0;i<55;i++)p+=e*o(p);
vec3 pp=p+=e=reflect(e,n(p));
for(int i=0;i<55;i++)p+=e*o(p);
gl_FragColor=abs(dot(n(p),vec3(.1)))+vec4(.2,cos(w*.5)*.5+.5,sin(w*.5)*.5+.5,1)*length(p-s)*.01
+length(p-s)*.01+(1-min(pp.y+2,1.))*vec4(1,.8,.7,1);
}
Posted: Fri Nov 06, 2009 4:25 pm
by y offs et
tried it.
same result
Posted: Fri Nov 06, 2009 6:08 pm
by Kjell
Guess it was the read-only thing that caused the problem for all Lava shaders. Well, at least we now know the problem doesn't lie within the features used in the tests so far. I'll get back with another test-case using more techniques from the tunnel & ribbon shader.
I do actually wonder whether something like vec3(1) is officially supported ... opposed to vec3(1,1,1).
K
Posted: Sun Nov 08, 2009 6:53 pm
by VilleK
Perhaps it's possible to write a entire game with a shader

. Just process the input from the main program and set it to uniform variables. The demo-shader should be pretty simple to modify so that you can move around using mouse or cursor keys.
Posted: Sun Nov 08, 2009 10:35 pm
by Kjell
Sure it would be possible, but it wouldn't make any sense writing your own complete GLSL-based render-engine ... unless you want to use something that's completely different from polygons / voxels / nurbs ( through a extension ). But in that case it's probably a better idea to side-step OpenGL altogether ( plus there's no cheap way to manage objects within a shader )
K