Page 2 of 3

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sat Aug 10, 2019 3:14 pm
by Paeryn
Gavinmc42 wrote:
Sat Aug 10, 2019 12:37 am
What gave you the impression that the VC4 didn't have shaders?
In Tim's Readme it says only works on Pi4's.
It looks like mesa is smart enough to figure that out and use the VC4 driver.
Dug out the VC4 manual, not much on shaders, need the VC6 manual, not that it will make much sense.

Think I need to look at the output of the shader compilers.
So far reading all the OpenGL books is leading me to conclude shaders are even more complex than just the 3D stuff.
It's likely that many of the shaders require features not available in the OpenGLES2 shaders. The VC4 manual tells you all about the QPUs (which are the processors that the shaders run on) and the texture units etc. albeit without telling you about any bugs in the implementations. It won't tell you how GLSL compiles into QPU code and register setups, for that read the Mesa source, though it compiles GLSL into an intermediary format or two (GLSL->hir->nir I think) before finally generating QPU code and register settings. It would be interesting to see the differences between VC4 and VC6 QPU code for the same shader, I assume VC6 has more instructions, I know it has more registers).
Gavinmc42 wrote:
Sat Aug 10, 2019 12:37 am
Been putting off learning 3D on Pi's, it has been playing with OpenGL on the Pi4 that all the pieces fell into place.
I wondered why there was nothing between triangles and cubes and full objects in OpenGLES.
There is no library like FreeGLUT for OpenGLES.

Then Tim comes along and throws shaders into the mix.
Another new world of learning.
In OpenGL polygons with four or more vertices have to be decomposed into triangles first (on the old 3dfx even lines were triangles, a line was drawn by drawing a triangle with two identical vertices), OpenGLES made the move to remove all higher order polygons from the start since it reduces complexity of the drivers and makes it the programmer's responsibility to convert higher order polygons into triangles. Those higher order polygons were then also removed from OpenGL as of version 3.1.

OpenGL3.1 was also the point where the fixed-function vertex and fragment sections were finally removed (they were deprecated in 3.0).

Shaders aren't all the complicated if you don't need them to be. Vertex shaders are just programs that transform vertices from object space to view space and fragment shaders are programs that generate the colour to use for each pixel of a triangle drawn.

It's impressive when you see everything drawn by shaders alone (the entire screen is just drawn as two triangles covering the window), just think how slow it would be if the CPU was drawing the scene pixel by pixel.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sun Aug 11, 2019 12:52 am
by Gavinmc42
In OpenGL polygons with four or more vertices have to be decomposed into triangles first
Yep that was in one of Eric's Anholt's first posts, breaking up quads into triangles.
It might be an OpenGL driver but it is running on OpenGLES 3.2 hardware.

GeeXLab has some more shader stuff and some debug utils.
I see great stuff happening on the screen but CPU usage is sitting on maybe 5%
Need some way to check GPU usage, the Geexlabs stuff has some on screen info.

I suppose the guys working on the mesa code will get around to making use of that GLES 3.2 hardware one day.
I'm particularly interested in using it for bare metal so I don't need to wait
But there is so much to learn about these shaders.

The Demoscene guys are the closest but not many use Pi's or hang out here?
It will be interesting to see what the Demoscene guys can do with the P4.
Especially in 4K, now with a decent and standard piece of hardware.
Dual screen Demoscene?

There is a standalone mesa compiler and it can dump the compiled code.
Check for VC4 and VC6 variations.
I also want to try this on Wayland instead of X11, but that 's more learning as well.
Eventually baremetal without any window managers, which I cannot do yet on a Pi4.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sun Aug 11, 2019 7:00 am
by pik33
You cannot do bare metal in Pi4, but you still can do things without a window manager using Raspbian.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sun Aug 11, 2019 9:07 am
by Gavinmc42
You cannot do bare metal in Pi4
I can't because I don't have the skills, the time and enough info.
That won't always be the case ;)
but you still can do things without a window manager using Raspbian
I want to try Wayland first and then without a windows manager.
An accelerated non Linux windowing scripted GUI is my goal, preferably before the Pi5 comes out.

Depending on how hard to reverse engineer the boot EEPROM, lots of preset up could be done in that.
It is 512KB, that's a bunch of room. could a GLSL compiler fit in that?

So many possibilities and so much unknown.
The Pi4 will be very successful and end up it lots of hands, some might be able to figure it out.

Tim has shown us what can be done now, it still seems like magic to me.
I need another Pi4, this one has become my desktop developers box.
Perhaps try the OpenGLES 2.0 shaders on a Zero first.
Rewrite the GLSL compiler in Pascal :D

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Fri Aug 16, 2019 7:09 am
by Gavinmc42
Worth double posting :D

Wireframe 20 had a bit on Livecoding
A mention of Kodelife - it just works :D
https://hexler.net/products/kodelife#_

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Fri Aug 16, 2019 5:49 pm
by OutsourcedGuru
Tried this locally on Raspbian Buster Desktop 4.9 with Raspberry Pi 4B (4GB) and it works great (noting that I adjusted the `gpu_mem` to 128 as suggested). It brings up another window to display the graphical output. This is using a SunFounder 10.1" TFT display for what it's worth and it's attached to the first micro-HDMI connector.

Tried this locally again on Raspbian Buster Lite 4.9 on the same rig and although it logs each of the `INFO: Shader compiled successfully!` messages it does not otherwise create any output to the screen. I attempted to Ctl-Alt-F2, etc but this did not change to another session which had the output (if there were any). It seemed to ignore an attempt to Ctl-C out of it so it was necessary to `sudo pkill ShaderToy` via ssh.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sat Aug 17, 2019 12:52 am
by pjbesl444
Thank you for this demo example. Really excellent!

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Tue Sep 17, 2019 3:00 pm
by Pyeater
Thanks all for the input.

I'm yet to purchase a Pi4 (own a Pi3) but would love to see what this looks like.

Is there any chance of somebody linking to a video of how any of these look? Preferably one that pushes the boundaries a little :)

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Sep 18, 2019 12:09 am
by Gavinmc42
Get a Pi4 and see for yourself. ;)
WebGL examples in a Browser pushes Pi4.
https://webglsamples.org/

There was a rolling hills demo with flocks of birds that impressed me.
But this is mostly unexplored terriitory for me.
Lots of videos out there but most can push normal PC boundaries.
Any demo that can run on a Pi4 will probably run on a PC.

If you only have a 3B put Gentoo64 on it, grab the mesa-demos and start coding.
I have found a few shader apps now that just work, in more than one language too.

The Gentoo64 browsers can also run those WebGL samples.
Even Raspbian Buster is better now but I think shaders are done by Chromium on the Pi3 Arm's not GPU?

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Sep 18, 2019 11:16 am
by Pyeater
tipam wrote:
Sat Jul 27, 2019 5:59 pm
Hi,

I've just written a small app that will render over 100+ OpenGL ES 3.0 shaders (pinched from ShaderToy.com) to give an idea of what can be done with the RPi 4 GPU.

Link: http://www.skillmanmedia.com/ShaderToyRPi4.zip

You will need to install the SDL2 libraries from a terminal window and reserve 128MB GPU mem ...

Code: Select all

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev
sudo apt-get install libsdl2-ttf-dev
sudo apt-get install libsdl2-mixer-dev
You should be able to dbl-click the ShaderToy executable after unzipping the folder to try it out.
(You will need to set permissions first by selecting ShaderToy, right-click 'File Properties->Permissions->Execute' to 'Anyone')

Use the SPACEBAR to jump to the next shader and ESCAPE to exit.
There are some shaders that allow you to use the mouse (navigation/rotate etc..)

The 'options.txt' file allows you to change a few obvious settings.

Note - this will ONLY work on the Raspberry Pi 4!

Please let me know if you have any problems.

Have fun! :D

Wonderful stuff :)

What did you use to render the shaders? If you don't mind me asking ...

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Sep 18, 2019 1:33 pm
by Pyeater
Pyeater wrote:
Wed Sep 18, 2019 11:16 am
tipam wrote:
Sat Jul 27, 2019 5:59 pm
Hi,

I've just written a small app that will render over 100+ OpenGL ES 3.0 shaders (pinched from ShaderToy.com) to give an idea of what can be done with the RPi 4 GPU.

Link: http://www.skillmanmedia.com/ShaderToyRPi4.zip

You will need to install the SDL2 libraries from a terminal window and reserve 128MB GPU mem ...

Code: Select all

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev
sudo apt-get install libsdl2-ttf-dev
sudo apt-get install libsdl2-mixer-dev
You should be able to dbl-click the ShaderToy executable after unzipping the folder to try it out.
(You will need to set permissions first by selecting ShaderToy, right-click 'File Properties->Permissions->Execute' to 'Anyone')

Use the SPACEBAR to jump to the next shader and ESCAPE to exit.
There are some shaders that allow you to use the mouse (navigation/rotate etc..)

The 'options.txt' file allows you to change a few obvious settings.

Note - this will ONLY work on the Raspberry Pi 4!

Please let me know if you have any problems.

Have fun! :D

Wonderful stuff :)

What did you use to render the shaders? If you don't mind me asking ...

Gosh, this is on a very old spec of Pi and they run really well!

Hopeful :D

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Sep 19, 2019 5:53 am
by Gavinmc42
Gosh, this is on a very old spec of Pi and they run really well!
Huh? Pi4 is the newest Pi.
The older Pi's only do OpenGLES 2.0, lower capability shaders.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Sep 19, 2019 9:19 am
by Pyeater
Gavinmc42 wrote:
Thu Sep 19, 2019 5:53 am
Gosh, this is on a very old spec of Pi and they run really well!
Huh? Pi4 is the newest Pi.
The older Pi's only do OpenGLES 2.0, lower capability shaders.

Oh, I meant to include this link https://www.raspberrypi.org/forums/view ... hp?t=10246

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Sep 19, 2019 12:11 pm
by Gavinmc42
Oh that old one :D
That's before my time?
So going to try that on the VC4 Pi's, thanks for the link.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Fri Sep 20, 2019 2:52 pm
by ksharindam
tipam wrote:
Sat Jul 27, 2019 5:59 pm

Code: Select all

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev
sudo apt-get install libsdl2-ttf-dev
sudo apt-get install libsdl2-mixer-dev
You should be able to dbl-click the ShaderToy executable after unzipping the folder to try it out.
You have done really very good job.

Here you are providing the precompiled binaries.So we need to install the libraries instead of the development files.

Code: Select all

sudo apt install libsdl2-2.0-0 
sudo apt install libsdl2-image-2.0-0
sudo apt install libsdl2-ttf-2.0-0
sudo apt install libsdl2-mixer-2.0-0

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Tue Oct 08, 2019 10:14 pm
by patriciogv
Hi I have been working on an app that allows you to edit 2D and 3D shaders on realtime call glslViewer ( https://github.com/patriciogonzalezvivo/glslViewer ) and it runs in all RaspberryPi. Here is running a GLTF 3D model running the default PBR shader at 47fps in a RaspberryPi Zero : )

https://twitter.com/patriciogv/status/1 ... 42976?s=20

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Oct 09, 2019 8:57 am
by Pyeater
patriciogv wrote:
Tue Oct 08, 2019 10:14 pm
Hi I have been working on an app that allows you to edit 2D and 3D shaders on realtime call glslViewer ( https://github.com/patriciogonzalezvivo/glslViewer ) and it runs in all RaspberryPi. Here is running a GLTF 3D model running the default PBR shader at 47fps in a RaspberryPi Zero : )

https://twitter.com/patriciogv/status/1 ... 42976?s=20

Interesting, thanks :)

What OS are you using for the Zero?

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Oct 09, 2019 9:34 am
by patriciogv
Raspbian Stretch Lite

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Oct 09, 2019 9:42 am
by Pyeater
Sounds wise ...

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Wed Oct 09, 2019 11:30 am
by Gavinmc42
Might need some help file reading, but I got this to compile on Gentoo64 and a Pi4 :D
Not sure if it is working properly, seemed to have compiled as GLFW?

Bookmarked your Book of Shaders too, bedtime reading.
47fps on a Pi Zero :o

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Oct 10, 2019 7:39 am
by salvato
@tipam

Hello,
is the site http://www.skillmanmedia.com/ShaderToyRPi4.zip still online ?
I'm having problem accessing it.

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Oct 17, 2019 7:52 pm
by UglyMike
www.skillmanmedia.com still down apparently...

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Thu Oct 17, 2019 7:57 pm
by DougieLawson
UglyMike wrote:
Thu Oct 17, 2019 7:52 pm
www.skillmanmedia.com still down apparently...
Looks like it's been dead for three years or more: https://web.archive.org/web/20160415195 ... media.com/

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Fri Oct 18, 2019 4:43 am
by salvato
??? Can't understand... the opening post is dated july 2019...???


DougieLawson wrote:
Thu Oct 17, 2019 7:57 pm
UglyMike wrote:
Thu Oct 17, 2019 7:52 pm
www.skillmanmedia.com still down apparently...
Looks like it's been dead for three years or more: https://web.archive.org/web/20160415195 ... media.com/

Re: RPi 4 OpenGL ES 3.0 ShaderToy to download (100+ examples)

Posted: Sun Oct 20, 2019 11:22 am
by Gavinmc42
The online Book of Shaders editor works quite well with the brownian example.
I am impressed that it is doing this via a Pi4 browser.
I tried it with Firefox and Chromium, with Chromium having the edge in smoothness.
But running both browsers with that animated smoke/cloud example, hardly any resources were used and not much heat generated, 47C.
So the VC6 is probably not working that hard.

Running the example in GLSLViewer at full screen slows things down to 3fps.
A bit less than full screen and Chromium looks a bit smoother than GLSLViewer.
Perhaps Chromium;s GLSL code is more optimised?

Running GLSL code like this at 4K at 30/60fps is going to be interesting to learn.
How far can Pi's be pushed?