Author Topic: GCW0 shader tests v0.1  (Read 2114 times)

Optimus (OP)

  • Posts: 107
GCW0 shader tests v0.1
« on: January 10, 2015, 05:58:45 pm »
So, last year I was playing with some shaders, curious what the GCW0 is capable of. I was thinking to keep these shaders and make a bigger shader benchmark or something, but since I don't think I'll work on this project anytime soon, I decided to release the source code and OPK for everyone who is curious to play with it.

The youtube video of this project:
<a href="https://www.youtube.com/watch?v=H5Ib4Bv0WAw" target="_blank">https://www.youtube.com/watch?v=H5Ib4Bv0WAw</a>

The source and OPK:
ftp://ftp.untergrund.net/users/optimus/progs/gcw0/GCW0shaderTests_v01.zip

I discovered a lot of mistakes in the shaders that might be a problem of the current drivers (but there are workarounds I used in this app). For example, sin/cos don't work, they return some noise. I used a 1D texture with precalced sine values here. Length of a vec2 or vec3 returns length of vec.x. Loops are not supported yet, so a for loop gets unrolled. And the shader program size cannot be very big, that's why the Julia Fractal has not enough iterations.

But the shaders seem quite fast for what they are doing (also because resolution is small compared to mobile phones having similar GPU). There is an automatic vsync I don't know how to disable, so you always get 60fps. But it can go much more. I did many more tests, by rendering the same fractal or blobs twice or more and still I was into 60fps (loop unrolling doesn't let me add more blobs in the shader or more fracal iterations, so I sort of test this way). The last effect is analytical raytracing of one sphere and I could try to add more next time. I am also curious to try for my next experiment some lighting model on 3d objects. I think for nice shiny surfaces this will be more than enough. Afterall, I realized, in OpenGL ES 2.0, you have to write simple shaders even for writting a triangle on the screen.

pcercuei

  • Posts: 1667
    • My devblog
Re: GCW0 shader tests v0.1
« Reply #1 on: January 11, 2015, 10:37:22 pm »
Just tested it, looks cool ;D
I'll report the issues.

Senor Quack

  • Posts: 223
Re: GCW0 shader tests v0.1
« Reply #2 on: January 11, 2015, 11:59:25 pm »
Thanks for releasing these, I'll be using them as examples in my quest to learn more GLES 2.0.  I took some time and can now verify that indeed Sin() and Cos() do not work, at least not on uniform variables. Sin(uniform_var) always seems to return zero and Cos(uniform_var) seems to return 1.0, regardless of what the value of the uniform actually is. Sin(literal_value) and Cos(literal_value) act properly, however. I suspect this is just the shader compiler doing constant propagation.

Kouen Hasuki

  • Posts: 155
Re: GCW0 shader tests v0.1
« Reply #3 on: January 17, 2015, 12:40:41 pm »
Nice bit of work here!

MPR

  • Posts: 1
Re: GCW0 shader tests v0.1
« Reply #4 on: January 20, 2015, 02:49:55 am »
Nice work indeed! I've got an OGLes project underway at the moment, so thanks for mentioning the sin/cos problem before I ended up tearing my hair out...  :P