shader | HackLAB https://www.geeks3d.com/hacklab 3D Programming, Prototyping and Gamedev with GeeXLab Sun, 03 Dec 2023 14:09:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 Shadertoy Demopack v23.12.3 https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/ https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/#respond Sun, 03 Dec 2023 14:09:44 +0000 https://www.geeks3d.com/hacklab/?p=1733 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website. New shadertoy demos are in the following folders: – gl-shadertoy-singlepass/ – gl-shadertoy-multipass/   Unzip the pack where you want, and drag and drop any … Continue reading Shadertoy Demopack v23.12.3 »

The post Shadertoy Demopack v23.12.3 first appeared on HackLAB.]]>


Downloads


A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your PC. The Shadertoy demopack is a selection of the coolest demos available on shadertoy website.

New shadertoy demos are in the following folders:
gl-shadertoy-singlepass/
gl-shadertoy-multipass/

 
Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos or ps-gl32-buf_A.glsl, ps-gl32-buf_B.glsl, … in multipass demos) in your favorite text editor and any change is instantly visible.

 
New demos:

2023.10.28
+ added gl-shadertoy-multipass/screen-space-horizon-gi/
+ added gl-shadertoy-singlepass/straight-flagstone-tiles/
+ added gl-shadertoy-singlepass/elevator-to-infinity/
+ added gl-shadertoy-multipass/inside-the-mandelbulb-2/
+ added gl-shadertoy-multipass/raytraced-rolling-ball/
+ added gl-shadertoy-multipass/extruded-bauhaus-truchet-pattern/
+ added gl-shadertoy-singlepass/shader-art-coding-introduction/
+ added gl-shadertoy-singlepass/quick-hack-on-the-train/
+ added gl-shadertoy-singlepass/cyber-fuji-2020/
+ added gl-shadertoy-singlepass/shader-metaball-intro/
+ added gl-shadertoy-singlepass/painting-with-code-demo/
+ added gl-shadertoy-singlepass/gaussian-splatting-3/
+ added gl-shadertoy-singlepass/cook-torrance/
+ added gl-shadertoy-singlepass/enter-the-matrix/
+ added gl-shadertoy-singlepass/paint-148-chars/
+ added gl-shadertoy-singlepass/big-brain/
+ added gl-shadertoy-multipass/madtracing-ball-physics/
+ added gl-shadertoy-multipass/a-study-of-glass-2/

Some screenshots:

Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

 
Shadertoy demopack for GeeXLab

The post Shadertoy Demopack v23.12.3 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20231203/shadertoy-demopack-v23-12-3/feed/ 0
GeeXLab 0.55 released https://www.geeks3d.com/hacklab/20231121/geexlab-0-55-released/ https://www.geeks3d.com/hacklab/20231121/geexlab-0-55-released/#respond Tue, 21 Nov 2023 19:17:16 +0000 https://www.geeks3d.com/hacklab/?p=1725 1 – Downloads Downloads GeeXLab 0.55.0 lite (win64) (210MB) GeeXLab 0.55.0 full (win64) (437MB) GeeXLab 0.55.0 (win32) (77MB) All GeeXLab Downloads Forum thread Discord server   2 – Release Notes GeeXLab 0.55.0 is available for Windows 32/64-bit. I will update Linux64, macOS and Raspberry Pi later (for the RPi, I’m waiting the for RPi 5…). GeeXLab 0.55 engine is behind latest versions of GPU Shark … Continue reading GeeXLab 0.55 released »

The post GeeXLab 0.55 released first appeared on HackLAB.]]>

1 – Downloads



Downloads

 

2 – Release Notes

GeeXLab 0.55.0 is available for Windows 32/64-bit. I will update Linux64, macOS and Raspberry Pi later (for the RPi, I’m waiting the for RPi 5…). GeeXLab 0.55 engine is behind latest versions of GPU Shark 2, FurMark 2, MSI Kombustor and FurMark ROG and YAFFplayer.

 
Here are the main changes:

FFmpeg plugin

The FFmpeg plugin has been updated with latest version 6.1.0 code-named Heaviside (Oliver Heaviside was a famous mathematician and physicist with important contributions in electromagnetism and electricity). I fixed many bugs in the FFmpeg plugin and updated the CUDA support (now its works!). FFmpeg 6.1 comes with the Vulkan support for some decoders like the H264 but as always with Vulkan, things are not easy to do. So no Vulkan support in the FFmpeg plugin. Maybe later.

 

Python 3 plugin

A new Python 3 plugin is available for Python 3.12. Now, GeeXLab supports all versions of Python 3 from Python 3.7 to the latest Python 3.12.

<geexlab>
  <window name="win3d01" title="Python 3.12 Sandbox" 
          width="800" height="600" 
          gl_version_major="2" gl_version_minor="1" />
  <script name="init_scene" run_mode="INIT" language="PYTHON_3_12" filename="init.py" />
  <script name="update_scene" run_mode="FRAME" language="PYTHON_3_12" filename="frame.py" livecoding="1" />
  <script name="terminate_scene" run_mode="TERMINATE" language="PYTHON_3_12" filename="terminate.py" />
  <script name="resize_scene" run_mode="SIZE" language="PYTHON_3_12" filename="size.py" />
</geexlab>

 

Dear ImGui

Dear ImGui has been updated to the latest version 1.90. This new version fixes bugs, brings improvements and add angled headers (new function in gh_imgui lib: table_angled_headers_row() –not tested yet, I hope this function works–).

 

GPU monitoring plugin

The GPU monitoring has been updated with latest NVAPI R545. I fixed a bug in the reading of the commercial name of Intel graphics cards: the function gh_gml.get_gpu_commercial_name() always returned an empty string for Intel GPUs. I also fixed a bug in gh_gml.get_vram_usage() for systems with graphics drivers prior to R520. Not tested the fix…

 

3 – Changelog

This changelog is intended for all versions of GeeXLab.

Full changelog from beginning of time is available HERE.

Version 0.55.0.0 - 2023.11.21
* (2023.11.21) GPU monitoring plugin: fixed a bug in the reading of commercial name with Intel GPUs.
+ (2023.11.19) added new Python 3.12 plugin.
+ (2023.11.19) updated curl support with version 8.4.0.
+ (2023.11.19) added begin_child_v2() and table_angled_headers_row() to gh_imgui lib.
! (2023.11.19) updated Dear ImGui with version 1.90.0.
+ (2023.11.19) added process_create(), process_is_running() and process_close()
  to gh_utils lib.
! (2023.11.19) GPU monitoring plugin: updated with NVAPI R545.
* (2023.11.18) FFmpeg plugin: fixed many small bugs (video without audio stream, audio file only)
  and improved CUDA acceleration support. 
+ (2023.11.15) added hw_device_check() and hw_decoder_is_initialized() to 
  gh_av_lib to check the support of hardware decoders when using FFmpeg plugin.
+ (2023.11.14) added video_init_texture_nv12() and video_update_texture_nv12()
  to gh_av lib.
* (2023.11.13) GPU monitoring plugin: fixed a bug in gh_gml.get_vram_usage() for NVIDIA GPUs.
  Now this function should work with GeForce driver >= 520 and < 520 (like 466.xx).
! (2023.11.11) FFmpeg plugin: updated with latest FFmpeg 6.1 "Heaviside".
* (2023.11.11) FFmpeg plugin: fixed a bug in initialization.
The post GeeXLab 0.55 released first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20231121/geexlab-0-55-released/feed/ 0
Matrix Greenish Color Formula Demo https://www.geeks3d.com/hacklab/20210923/matrix-greenish-color-formula-demo/ https://www.geeks3d.com/hacklab/20210923/matrix-greenish-color-formula-demo/#respond Thu, 23 Sep 2021 09:46:20 +0000 https://www.geeks3d.com/hacklab/?p=1645 Downloads OpenGL 2.1 Demopack Demo: geexlab-demopack-gl21/d63-matrix-color-formula/main.xml GeeXLab Downloads Forum thread for feedbacks / bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.   In the following tweet, iq gives the formula that creates the greenish ambiance of the Matrix movie: The "Matrix Color" formula. … Continue reading Matrix Greenish Color Formula Demo »

The post Matrix Greenish Color Formula Demo first appeared on HackLAB.]]>

GeeXLab - Matrix greenish color shader



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (main.xml) in GeeXLab. This demo requires OpenGL 2.1+.

 
In the following tweet, iq gives the formula that creates the greenish ambiance of the Matrix movie:

 
I coded this small demo that allows you to play with the color exponents:

GeeXLab - Matrix greenish color shader

 
The pixel shader:

#version 120  
uniform sampler2D tex0;
uniform vec4 exponents; // vec4(1.5, 0.8, 1.5, 0.0)

float separator(float mouse_x, float vseparator_width, float uv_x)
{
  float separator_posx = mouse_x;
  float a1 = smoothstep(separator_posx - vseparator_width, separator_posx, uv_x);
  float a2 = smoothstep(separator_posx + vseparator_width, separator_posx, uv_x);
  return 1.0- a1*a2;
}

void main(void)
{
  vec2 uv = gl_TexCoord[0].xy;
  uv.y *= -1.0;

  vec4 color = texture2D(tex0, uv * vec2(2.0, 1.0));

  if (uv.x>0.5)
    color.rgb = pow(color.rgb, exponents.rgb);

  float sep = separator(0.5, 0.01, uv.x);
  gl_FragColor = color * sep;
}
The post Matrix Greenish Color Formula Demo first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20210923/matrix-greenish-color-formula-demo/feed/ 0
Cloudy Tunnel Tweet Shader https://www.geeks3d.com/hacklab/20210923/cloudy-tunnel-tweet-shader/ https://www.geeks3d.com/hacklab/20210923/cloudy-tunnel-tweet-shader/#respond Thu, 23 Sep 2021 09:23:57 +0000 https://www.geeks3d.com/hacklab/?p=1643 Downloads OpenGL 3.2 Demopack Demo: geexlab-demopack-gl32/d30-twigl/twigl02.xml GeeXLab Downloads Forum thread for feedbacks and bug-report How to run the demo? Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (twigl02.xml) in GeeXLab. This demo requires OpenGL 3.2+.   Another cool tweet shader made by @zozuar float i,e,s,g,k=.005;for(o++;i++<2e2;g+=max(k,e*.2)){vec3 v=vec3(sin(e=t+g*.3),cos(e),4),p=vec3((FC.xy-.5*r)/r.y*g,g)*rotate3D(t,v);p.z+=t*4.;e=.3-dot(p.xy,p.xy);for(s=2.;s<2e2;s*=1.6)p.yz*=rotate2D(s),e+=abs(dot(sin(p*s+t*s*.2)/s,p-p+1.));o+=o.w*min(e,k)*k;}#つぶやきGLSL pic.twitter.com/k2iebu05Nq — yonatan (@zozuar) September 22, 2021   And here is … Continue reading Cloudy Tunnel Tweet Shader »

The post Cloudy Tunnel Tweet Shader first appeared on HackLAB.]]>

GeeXLab - Twigl cloudy tunnel shader



Downloads

How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (twigl02.xml) in GeeXLab. This demo requires OpenGL 3.2+.

 
Another cool tweet shader made by @zozuar

 
And here is the pixel shader in the GeeXLab demo:

#version 150
uniform float time;
uniform vec2 resolution;
in vec4 v_texcoord;
out vec4 FragColor;

#define PI 3.14159265
#define FC gl_FragCoord

mat2 rotate2D(float r)
{
    return mat2(cos(r), sin(r), -sin(r), cos(r));
}

mat3 rotate3D(float angle, vec3 axis)
{
    vec3 a = normalize(axis);
    float s = sin(angle);
    float c = cos(angle);
    float r = 1.0 - c;
    return mat3(
        a.x * a.x * r + c,
        a.y * a.x * r + a.z * s,
        a.z * a.x * r - a.y * s,
        a.x * a.y * r - a.z * s,
        a.y * a.y * r + c,
        a.z * a.y * r + a.x * s,
        a.x * a.z * r + a.y * s,
        a.y * a.z * r - a.x * s,
        a.z * a.z * r + c
    );
}

void main()
{
  vec2 r = resolution;
  float t = time;

  vec4 fcolor = vec4(1.0);
  vec3 p = vec3(0.0);
  float i=0,e=0,s=0,g=0,k=.005;
  for(;i++<2e2;g+=max(k,e*.2))
  {
    vec3 v=vec3(sin(e=t+g*.3),cos(e),4), p=vec3((FC.xy-.5*r)/r.y*g,g)*rotate3D(t,v);
    p.z+=t*4.;
    e=.3-dot(p.xy,p.xy);
    for(s=2.;s<2e2;s*=1.6)
    {
      p.yz*=rotate2D(s);
      e+=abs(dot(sin(p*s+t*s*.2)/s,p-p+1.));
    }
    fcolor += fcolor.w*min(e,k)*k;
  }
  FragColor = fcolor;
}

The GeeXLab demo:
GeeXLab - Twigl jellyfish shader

The shader is ready for live coding. Just edit the shader (d30-twigl/shaders/ps02.glsl) in your favorite text editor and save it to see the result in real time.

On a GeForce RTX 2070, this demo runs at 75 FPS (resolution: 1280x720).

The post Cloudy Tunnel Tweet Shader first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20210923/cloudy-tunnel-tweet-shader/feed/ 0
GeeXLab 0.44 Released for Windows and Linux https://www.geeks3d.com/hacklab/20210913/geexlab-0-44-released-for-windows-and-linux/ https://www.geeks3d.com/hacklab/20210913/geexlab-0-44-released-for-windows-and-linux/#respond Mon, 13 Sep 2021 13:40:16 +0000 https://www.geeks3d.com/hacklab/?p=1616 Downloads GeeXLab 0.44.0 lite (win64) (113MB) GeeXLab 0.44.0 full (win64) (336MB) GeeXLab 0.44.0 full (win32) (62MB) GeeXLab 0.44.0 (linux64) (100MB) OpenGL 2.1 demopack v21.9.13.0 All GeeXLab Downloads Forum feedback / bug-report thread   1 – Release Notes This new version GeeXLab is available for Windows 64-bit, Windows 32-bit and Linux 64-bit (GLIBC 2.23). GeeXLab 0.44 brings the following new features: – the support of ImNodes … Continue reading GeeXLab 0.44 Released for Windows and Linux »

The post GeeXLab 0.44 Released for Windows and Linux first appeared on HackLAB.]]>

GeeXLab: scriptable proto-engine for Windows and Linux



Downloads

 

1 – Release Notes

This new version GeeXLab is available for Windows 64-bit, Windows 32-bit and Linux 64-bit (GLIBC 2.23). GeeXLab 0.44 brings the following new features:
– the support of ImNodes
– new functions to get the SHA-512 hash code

 

ImNodes

ImNodes is a simple but powerful node editor for Dear ImGui. If you want to add this cool lib in your app, just visit this github repo. I will try to write a quick article on ImNodes. But if you want to play with ImNodes now, two demos are ready in the OpenGL 2.1 demopack in the /d29-imgui/imgui-imnodes/demo01/ and /d29-imgui/imgui-imnodes/demo02/ folders.

GeeXLab 0.44 - ImNodes, node editor for Dear ImGui

 

SHA-512

GeeXLab has some functions to compute hash codes like MD5, SHA-1 or SHA-256 for a string, a file or a memory buffer. Now you can also get the SHA-512 hash code with three new functions:
– gh_utils.sha512()
– gh_utils.file_sha512()
– gh_utils.buffer_sha512()

I updated the code sample in the OpenGL 2.1 demopack: d18-hashcodes/.

These functions are used in the H4shG3n utility. A new version of H4shG3n with SHA-512 will be released shortly.

 

2 – Changelog

This changelog is intended for all versions of GeeXLab.

Full changelog from beginning of time is available HERE.

Version 0.44.0 - 2021.09.08
! (2021.09.08) updated some file functions (like gh_utils.file_buffer_create())
  with support of large files (3GB+). This update was required by the H4shG3n app.
+ (2021.09.08) dnd_set_check_scene_file() to gh_utils. This function allows to
  disable the check for scene file during a drag and drop.
+ (2021.09.07) added get_time() and get_time_microseconds() to gh_utils.
+ (2021.09.06) added get_mouse_pos_on_opening_current_popup(), push_style_var_1f()
   push_style_var_2f() and pop_style_var() to gh_imgui.
! (2021.09.06) updated the Wren built-in scripting plugin with latest Wren 0.4.0.
+ (2021.09.05) added functions (imnodes_xxxxx()) in gh_imgui that allow to build 
  the next-gen node editor!
+ (2021.09.05) added extract_file_name() to gh_utils.
+ (2021.09.04) added file_sha512(), buffer_sha512() and sha512() to gh_utils.
! (2021.09.04) updated gh_utils.file_sha256(), gh_utils.buffer_sha256()
  and gh_utils.sha256() with a faster code. Previous code is now in 
  a v0 version (gh_utils.file_sha256_v0(), etc.).
+ (2021.09.04) added shared_variable_set_value_buffer() and 
   shared_variable_get_value_buffer() to gh_utils that allow
   to share a buffer (pointer and size) between scripts running in 
   separate threads.
The post GeeXLab 0.44 Released for Windows and Linux first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20210913/geexlab-0-44-released-for-windows-and-linux/feed/ 0
Jellyfish Tweet Shader https://www.geeks3d.com/hacklab/20210902/jellyfish-tweet-shader/ https://www.geeks3d.com/hacklab/20210902/jellyfish-tweet-shader/#respond Thu, 02 Sep 2021 14:24:45 +0000 https://www.geeks3d.com/hacklab/?p=1612 Downloads OpenGL 3.2 Demopack Demo: geexlab-demopack-gl32/d30-twigl/ GeeXLab 0.43.2 lite (win64) GeeXLab 0.43.2 full (win64) GeeXLab 0.43.2 (linux64) GeeXLab Downloads   I recently discovered twigl.app. It’s an online editor for coding one tweet pixel shaders (the max length of a shader should be less than 280 characters). I ported to GeeXLab a very cool shader that renders some jellyfish in a 266 characters shader: for(float i,e,g,s;i++<2e2;){vec3 … Continue reading Jellyfish Tweet Shader »

The post Jellyfish Tweet Shader first appeared on HackLAB.]]>

GeeXLab - Twigl jellyfish shader



Downloads

 
I recently discovered twigl.app. It’s an online editor for coding one tweet pixel shaders (the max length of a shader should be less than 280 characters). I ported to GeeXLab a very cool shader that renders some jellyfish in a 266 characters shader:

Ok in reality, the shader is longer because the code of some functions like hsv() is not taken into account….

Anyway, I found the shader very cool and I’m still amazed how some lines of math can produce organic-like patterns.

The original pixel shader is:

for(float i,e,g,s;i++<2e2;){vec3 p=vec3((FC.xy-r*.5)/r.y*g+.7,g+=e);
p.y-=t*.1;p-=round(p);p.xz*=1.+sin(t*PI+(round(g)+p.y)*9.)*.2;for(e=s=9.;s<4e2;
s+=s)e=s/2e6+min(e,max(-p.y,abs(length(p)-.2))/s),p.y+=length(p.xz)*2.,p=.2-abs(p*3.);
o.rgb+=hsv(.6+.9/p.y,.9,4e-6/e);}

Here is the pixel shader in the GeeXLab demo:

#version 150
uniform float time;
uniform vec2 resolution;
in vec4 v_texcoord;
out vec4 FragColor;

#define PI 3.14159265
#define FC gl_FragCoord

vec3 hsv(float h, float s, float v)
{
    vec4 t = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(vec3(h) + t.xyz) * 6.0 - vec3(t.w));
    return v * mix(vec3(t.x), clamp(p - vec3(t.x), 0.0, 1.0), s);
}

void main()
{
  vec2 r = resolution;
  float t = time;
  float i=0,e=0,g=0,s=0;
  vec3 fcolor = vec3(0.0);
  for(;i++<2e2;)
  //for(float i,e,g,s;i++<2e2;)
  {
    vec3 p = vec3((FC.xy-r*.5)/r.y*g+.7, g+=e);
    p.y -= t*.2;
    p -= round(p);
    p.xz *= 1. + sin(t*PI+(round(g)+p.y)*9.)*.2;
    for(e=s=9.;s<4e2;s+=s)
      e = s/2e6+min(e,max(-p.y,abs(length(p)-.2))/s),p.y+=length(p.xz)*2.,p=.2-abs(p*3.0);
    fcolor.rgb += hsv(.6+.9/p.y,.9,4e-6/e);
  }
  FragColor.rgb = fcolor;
  FragColor.a = 1.0;
}

I took the hsv() code from this page.

The GeeXLab demo (just drop geexlab-demopack-gl32/d30-twigl/main.xml in GeeXLab):
GeeXLab - Twigl jellyfish shader

The shader is ready for live coding. Just edit the shader (d30-twigl/shaders/ps01.glsl) in your favorite text editor and save it to see the result in real time.

On a GeForce RTX 2070, this demo runs at 156 FPS (resolution: 1280x720).

The post Jellyfish Tweet Shader first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20210902/jellyfish-tweet-shader/feed/ 0
(Demo) QR Code Shaders https://www.geeks3d.com/hacklab/20200814/demo-qr-code-shaders/ https://www.geeks3d.com/hacklab/20200814/demo-qr-code-shaders/#respond Fri, 14 Aug 2020 14:51:06 +0000 https://www.geeks3d.com/hacklab/?p=1563 Downloads OpenGL 2.1 Demopack Demo: geexlab-demopack-gl-21/d55-qr-code/qrcode_shader/ GeeXLab for Windows 64-bit GeeXLab for Linux 64-bit Forum thread (EN)   For most people, QR codes are a way to store a web link. In reality, we can store more data in QR code than a simple web link. Take a look at the following QR code:   It stores a complete pixel shader. If you drop this … Continue reading (Demo) QR Code Shaders »

The post (Demo) QR Code Shaders first appeared on HackLAB.]]>

GeeXLab demo - Shaders in QR codes



Downloads

 
For most people, QR codes are a way to store a web link. In reality, we can store more data in QR code than a simple web link. Take a look at the following QR code:

GeeXLab demo - Shaders in QR codes

 
It stores a complete pixel shader. If you drop this QR code in the GeeXLab demo you will get:

GeeXLab demo - Shaders in QR codes

 
And the following one:
GeeXLab demo - Shaders in QR codes

 
produces this effect:
GeeXLab demo - Shaders in QR codes

 
QR code shaders are an original ways to store your GLSL shaders. And for the same price, you get an extra layer of protection (easily crackable with a QR code reader).

All QR codes have been created with the QR code generator available in THIS POST.

This demo requires GeeXLab 0.35.1+ (the latest version is still a good choice) and an OpenGL 3.2 support, sorry for Raspberry Pi users but I was too lazy to convert GL3 shaders to GL2 shaders. The demo is available in the OpenGL 2.1 demopack in the d55-qr-code/qrcode_shader/ folder.

Load the demo in GeeXLab and drag and drop any QR code available in the d55-qr-code/qrcode_shader/qr_shaders/ folder.

The post (Demo) QR Code Shaders first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20200814/demo-qr-code-shaders/feed/ 0
(Demo) Shader Tweet (Updated) https://www.geeks3d.com/hacklab/20200417/demo-shader-tweet/ https://www.geeks3d.com/hacklab/20200417/demo-shader-tweet/#respond Fri, 17 Apr 2020 09:56:00 +0000 https://www.geeks3d.com/hacklab/?p=1516 Downloads OpenGL 2.1 Demopack Download Demo: geexlab-demopack-gl-21/d51-shader-tweet/ GeeXLab Downloads Forum thread (EN)   These last days, several graphics programmers have published pixel shaders on Twitter like this one:   I decided to put these pixel shaders in a GeeXLab demo so you can play with. These shaders are available in the OpenGL 2.1 demopack in the geexlab-demopack-gl-21/d51-shader-tweet/ folder. Live-coding is enabled for each shader and … Continue reading (Demo) Shader Tweet (Updated) »

The post (Demo) Shader Tweet (Updated) first appeared on HackLAB.]]>

GeeXLab demo - Shader Tweet



Downloads

 
These last days, several graphics programmers have published pixel shaders on Twitter like this one:

GeeXLab demo - Shader Tweet

 
I decided to put these pixel shaders in a GeeXLab demo so you can play with. These shaders are available in the OpenGL 2.1 demopack in the geexlab-demopack-gl-21/d51-shader-tweet/ folder. Live-coding is enabled for each shader and shaders are stored in the shaders/ folder.

demo03.xml (source):
GeeXLab demo - Shader Tweet

 
demo02.xml (source):
GeeXLab demo - Shader Tweet

 
demo01.xml (source):
GeeXLab demo - Shader Tweet

 

Update (2020.04.17)

demo06.xml (source):
GeeXLab demo - Shader Tweet

 
demo07.xml (source):
GeeXLab demo - Shader Tweet

 
demo10.xml (source):
GeeXLab demo - Shader Tweet

 
demo11.xml (source):
GeeXLab demo - Shader Tweet

 
demo12.xml (source):
GeeXLab demo - Shader Tweet

The post (Demo) Shader Tweet (Updated) first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20200417/demo-shader-tweet/feed/ 0
Shadertoy Demopack v2020.04-16 https://www.geeks3d.com/hacklab/20200416/geexlab-shadertoy-demopack-v2020-04-16/ https://www.geeks3d.com/hacklab/20200416/geexlab-shadertoy-demopack-v2020-04-16/#respond Thu, 16 Apr 2020 14:56:38 +0000 https://www.geeks3d.com/hacklab/?p=1515 Downloads Shadertoy demopack Download GeeXLab Downloads Feedback thread / Forum (EN) A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your desktop. Your high-end GPU will be happy! Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab. If you want to benchmark and log scores, you can do it via command line: … Continue reading Shadertoy Demopack v2020.04-16 »

The post Shadertoy Demopack v2020.04-16 first appeared on HackLAB.]]>

Shadertoy demopack for GeeXLab



Downloads

A new version of the Shadertoy demopack is available to enjoy Shadertoy demos on your desktop. Your high-end GPU will be happy!

Unzip the pack where you want, and drag and drop any demo (main.xml or demo.xml) into GeeXLab.

If you want to benchmark and log scores, you can do it via command line:

GeeXLab /width=1920 /height=1080 /fullscreen /demofile="absolute_path_to_the_demo.xml" /demofile_abs_path=1 /no_menubar /benchmark_duration_ms=10000 /benchmark_log_score

Many demos, if not all, are shipped with live-coding ready pixel shader. That means you can edit the shader file (shader_img.glsl in single pass demos) in your favorite text editor and any change is instantly visible.

 
Some screenshots:

 
gl-32-shadertoy-02/virtual-meadow/demo @ shadertoy
Shadertoy demopack for GeeXLab - virtual meadow

 
gl-32-shadertoy-02/impossible-ring/demo @ shadertoy
Shadertoy demopack for GeeXLab - impossible-ring

 
gl-32-shadertoy-02/tempting-the-mariner/demo @ shadertoy
Shadertoy demopack for GeeXLab - tempting the mariner

 
gl-32-shadertoy-02/echeveria-2/demo @ shadertoy
Shadertoy demopack for GeeXLab - echeveria 2

 
gl-32-shadertoy-02/escher-cubes/demo @ shadertoy
Shadertoy demopack for GeeXLab - escher cubes

 
gl-32-shadertoy-02/social-distancing/demo @ shadertoy
Shadertoy demopack for GeeXLab - social distancing

 
gl-32-shadertoy-02/divine-light/demo @ shadertoy
Shadertoy demopack for GeeXLab - divine-light

 
gl-32-shadertoy-multipass/gl32-sync-cord-revision-2020/demo @ shadertoy
Shadertoy demopack for GeeXLab - Sync cord - Revision 2020

 

Changelog

2020.04.16
----------
+ added gl-32-shadertoy-02/escher-cubes/
+ added gl-32-shadertoy-02/very-fast-procedural-ocean/
+ added gl-32-shadertoy-02/cobwebs-in-1-tweet/
+ added gl-32-shadertoy-02/social-distancing/
+ added gl-32-shadertoy-02/divine-light/
+ added gl-32-shadertoy-multipass/gl32-sync-cord-revision-2020/
+ added gl-32-shadertoy-02/cracked/
+ added gl-32-shadertoy-02/corridor-travel/
+ added gl-32-shadertoy-02/simple-sinus-2/
+ added gl-32-shadertoy-02/interference-blobs-2/
+ added gl-32-shadertoy-02/moebius-gears-2/
+ added gl-32-shadertoy-02/virtual-meadow/
+ added gl-32-shadertoy-02/infinite-supernova/
+ added gl-32-shadertoy-02/impossible-ring/
+ added gl-32-shadertoy-02/warping-procedural-4/
+ added gl-32-shadertoy-02/minimal-hexagonal-grid/
+ added gl-32-shadertoy-02/tempting-the-mariner/
+ added gl-32-shadertoy-02/blurry-spheres/
+ added gl-32-shadertoy-02/echeveria-2/
+ added gl-32-shadertoy-02/triangulated-heightfield-trick-2/
+ added gl-32-shadertoy-02/motion-loop-004/
+ added gl-32-shadertoy-02/basic-fractal-zero/
+ added gl-32-shadertoy-02/squares-analytic-motionblur/
+ added gl-32-shadertoy-02/checkerboard-analytic-motionblur/
The post Shadertoy Demopack v2020.04-16 first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20200416/geexlab-shadertoy-demopack-v2020-04-16/feed/ 0
(Demo) Loading SPIR-V Shaders in your OpenGL Demos https://www.geeks3d.com/hacklab/20200211/demo-loading-spir-v-shaders-in-your-opengl-demo/ https://www.geeks3d.com/hacklab/20200211/demo-loading-spir-v-shaders-in-your-opengl-demo/#respond Tue, 11 Feb 2020 11:09:07 +0000 https://www.geeks3d.com/hacklab/?p=1486 OpenGL 4 Demopack Download GeeXLab Downloads Forum thread (EN) Six months ago, I added in GeeXLab 0.29.0 the support of SPIR-V shaders in OpenGL (GL_ARB_gl_spirv). Playing with SPIR-V modules requires the support of OpenGL 4.6. On Windows, all recent drivers from NVIDIA, AMD and Intel support OpenGL 4.6. On Linux, only proprietary drivers exposes OpenGL 4.6… Let’s see in a simple demo (a RGB triangle … Continue reading (Demo) Loading SPIR-V Shaders in your OpenGL Demos »

The post (Demo) Loading SPIR-V Shaders in your OpenGL Demos first appeared on HackLAB.]]>

GL_ARB_gl_spirv demo with GeeXLab



Six months ago, I added in GeeXLab 0.29.0 the support of SPIR-V shaders in OpenGL (GL_ARB_gl_spirv).

Playing with SPIR-V modules requires the support of OpenGL 4.6. On Windows, all recent drivers from NVIDIA, AMD and Intel support OpenGL 4.6. On Linux, only proprietary drivers exposes OpenGL 4.6…

Let’s see in a simple demo (a RGB triangle is perfect) how to create an OpenGL GPU program from SPIR-V binary modules. The demo is available in the OpenGL 4 demopack here: geexlab-demopack-gl-4x/d13-gl46-arb-gl-spirv/triangle/main.xml

The demo displays a RGB triangle using the following vertex and pixel shaders:

Vertex shader

#version 450

// Uniform buffer
layout (std140, binding = 2) uniform uniforms_t
{ 
  mat4 ViewProjectionMatrix;
  mat4 ModelMatrix;
} ub;

layout (location = 0) in vec4 vposition;
layout (location = 3) in vec4 vcolor;
layout (location = 0) out vec4 v_color;

out gl_PerVertex 
{
  vec4 gl_Position;
};

void main()
{
  vec4 P = ub.ModelMatrix * vposition;
  gl_Position = ub.ViewProjectionMatrix * P;
  v_color = vcolor;
}

Pixel shader

#version 450

layout (location = 0) in vec4 v_color;
layout (location = 0) out vec4 FragColor;

void main()
{
  FragColor = v_color;
}

 
Uniform variables are no longer available. We have to use a GPU buffer to pass data to the GPU program (in our example, we pass data to the vertex shader using the ub GPU buffer).

Before creating the GPU program, we have to generate the SPIR-V modules using the glslangValidator utility available in the Vulkan SDK.

glslangValidator -G vs.vert -o vs.spv
glslangValidator -G ps.frag -o ps.spv

 
We can now create the GPU program from these SPIR-V binary files in our Lua INIT script:

local demo_dir = gh_utils.get_demo_dir()   
local vs = demo_dir .. "spirv/vs.spv"
local ps = demo_dir .. "spirv/ps.spv"
local gs = ""
local tcs = ""
local tes = ""
local cs = ""
vertex_color_prog = gh_gpu_program.create_from_shader_files_gl_spirv(
  "vertex_color_prog", 
  vs, ps, gs, tcs, tes, cs)

 
We have now a valid OpenGL GPU program we can use to render our triangle. But before drawing something, we have to create the famous GPU buffer that will let us dialog with the vertex shader.

local flags = "" -- no flags
local buffer_size = 512 -- in bytes
ub = gh_gpu_buffer.create("UNIFORM", "NONE", buffer_size, flags)

local binding_point_index = 2 -- Binding point 2 specified in the vertex shader.
gh_gpu_buffer.bind_base(ub, binding_point_index)

 
We create an uniform buffer of 512 bytes. We bind it to the binding point 2. Why 2? Just to show we can bind our GPU buffer to any binding point. Usually it’s 0. But 2 or 3 are also valid. The important thing is that the binding point value must match the value defined in the vertex shader:

layout (std140, binding = 2) uniform uniforms_t
{ 
  mat4 ViewProjectionMatrix; // offset: 0
  mat4 ModelMatrix; // offset: 64 bytes
} ub;

 
Once the GPU buffer is created and bound, we can update it using the following functions:

function ShaderBufferUpdateCamera(buf, camera)    
  local offset_bytes = 0
  gh_gpu_buffer.set_matrix4x4(buf, offset_bytes, camera, "camera_view_projection")
end  

function ShaderBufferUpdateObject(buf, obj)    
  local offset_bytes = 0
  offset_bytes = offset_bytes + 64 -- A 4x4 matrix == 64 bytes
  gh_gpu_buffer.set_matrix4x4(buf, offset_bytes, obj, "object_global_transform")
end  

 
Updating a GPU program is not difficult. It’s nothing more than an array of bytes. To put the value 4 in the first byte we can use:

gh_gpu_buffer.map(ub)
local offset = 0
local x = 4.0
gh_gpu_buffer.set_value_1f(ub, offset, x)
gh_gpu_buffer.unmap(ub)

 
For common cases, like updating the view-projection matrix (a camera) or the transformation matrix (an mesh), I added an helper function to make our life easier: gh_gpu_buffer.set_matrix4x4(). So to update the camera view-projection matrix of our GPU buffer, we can call:

offset_bytes = 0 -- ViewProjectionMatrix starts at offset 0
gh_gpu_buffer.set_matrix4x4(gpubuf, offset_bytes, camera, "camera_view_projection")

 
For a mesh (here our triangle):

offset_bytes = 64 -- ModelMatrix starts at offset 64
gh_gpu_buffer.set_matrix4x4(gpubuf, offset_bytes, triangle, "object_global_transform")

 
The rest of the demo is usual. The FRAME script is understandable without too much problem:

local elapsed_time = gh_utils.get_elapsed_time()

gh_camera.bind(camera)

gh_renderer.clear_color_depth_buffers(0.2, 0.2, 0.2, 1.0, 1.0)
gh_renderer.set_depth_test_state(1)

-- Rotate the triangle
gh_object.set_euler_angles(triangle, 0, elapsed_time*33.0, 0)

-- Update the GPU buffer
gh_gpu_buffer.map(ub)
ShaderBufferUpdateObject(ub, triangle)    
gh_gpu_buffer.unmap(ub)

-- Bind the GPU program and draw the triangle.
gh_gpu_program.bind(vertex_color_prog)
gh_object.render(triangle)

GL_ARB_gl_spirv demo with GeeXLab

 
The demopack has a second demo that uses SPIR-V modules in OpenGL. This time the demo displays a… textured quad!!!!

GL_ARB_gl_spirv demo with GeeXLab

The post (Demo) Loading SPIR-V Shaders in your OpenGL Demos first appeared on HackLAB.]]>
https://www.geeks3d.com/hacklab/20200211/demo-loading-spir-v-shaders-in-your-opengl-demo/feed/ 0