Author Topic: Shadertoy multipass demos  (Read 7005 times)



0 Members and 1 Guest are viewing this topic.

JeGX

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1266
    • View Profile
    • Geeks3D.com
Shadertoy multipass demos
« on: February 07, 2016, 08:33:15 PM »
I'm preparing a small framework (Lua) for Shadertoy multipass demos.

This simple (and pleasing) multipass demo works fine in GeeXLab:
https://www.shadertoy.com/view/Msc3Wf



Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #1 on: February 08, 2016, 01:04:48 PM »
Some MP shaders use new uniforms
uniform int       iFrame;
uniform float     iTimeDelta; (appears only in FireFox shader editor)


interactive evolution
3d pseudo fluid volume
Diffusion Curves


What goes around comes around:
Post process - FXAA
FXAA code from: geeks3d
« Last Edit: February 08, 2016, 02:10:24 PM by Stefan »

Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #2 on: February 08, 2016, 02:28:19 PM »
Rocket City

uses both iFrame and iTimeDelta

also iChannelResolution, keyboard and mouse-click


JeGX

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1266
    • View Profile
    • Geeks3D.com
Re: Shadertoy multipass demos
« Reply #3 on: February 08, 2016, 10:18:11 PM »
The multipass framework seems to work fine now:


- Elephant demo: https://www.shadertoy.com/view/4dKGWm



- Radial blur: https://www.shadertoy.com/view/XsKGRW



- 2D cloth: https://www.shadertoy.com/view/4dG3R1



I'll try to post it tomorrow with more samples...  :P

Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #4 on: February 24, 2016, 05:26:24 PM »
The multipass framework seems to work fine now:
...
I'll try to post it tomorrow with more samples...

Are you still working on it?

Check out:
https://github.com/eiffie/ShaderDemo

JeGX

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1266
    • View Profile
    • Geeks3D.com
Re: Shadertoy multipass demos
« Reply #5 on: February 25, 2016, 08:24:18 AM »

Are you still working on it?


Yes, in fact it's done, but to be honest I forgot a bit this framework since the release of Vulkan  ;)
I will release it with the next update of GeeXLab.
« Last Edit: February 25, 2016, 08:37:42 AM by JeGX »


Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #7 on: November 24, 2016, 07:08:02 PM »
First try:
othello - human vs. computer

I have an issue with iMouse.z
It does mouse-over instead of mouse-click with either your new code

  gh_gpu_program.uniform4f(shadertoy_prog_buf_a, "iMouse", mx, my, mz, 0)

or my old code

  local mx, my = gh_input.mouse_getpos()
  local mz = gh_input.mouse_get_button_state(1)
  local mw = mz
  gh_gpu_program.uniform4f(shadertoy_prog_buf_a, "iMouse", mx, my, mz, mw)


Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #8 on: November 25, 2016, 04:51:43 PM »
More tests, need more help  :-[

gl21-Interactive-Shoal-of-fish

alternate mouse-click not working so i had to edit pixel shader
iMouse.w changed to iMouse.z

gl21-Easy-read-neon-clock

old iDate code not working, clock is stuck at 0:00


JeGX

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1266
    • View Profile
    • Geeks3D.com
Re: Shadertoy multipass demos
« Reply #9 on: November 25, 2016, 06:42:39 PM »
More tests, need more help  :-[

 ;D


Ok, I looked at the neon clock demo and you have forgot (in file frame_user.lua) to update the iFrame uniform variable of the shadertoy_prog_img GPU program:

Code: [Select]
if ((img > 0) and (shadertoy_prog_img > 0)) then

  gh_render_target.bind(img)

  gh_gpu_program.bind(shadertoy_prog_img)
  gh_gpu_program.uniform3f(shadertoy_prog_img, "iResolution", winW, winH, 0.0)
  gh_gpu_program.uniform1f(shadertoy_prog_img, "iGlobalTime", elapsed_time)
  gh_gpu_program.uniform4f(shadertoy_prog_img, "iMouse", mx, my, mz, 0)
 
  local timestamp = os.time()
  local tmp = os.date("*t", timestamp)
  local time_seconds = tmp.hour * 3600.0 + tmp.min * 60.0 + tmp.sec
  gh_gpu_program.uniform4f(shadertoy_prog_img, "iDate", tmp.year, tmp.month, tmp.day, time_seconds)
 
 
  gh_texture.rt_color_bind(buf_A, 0)
  gh_gpu_program.uniform1i(shadertoy_prog_img, "iChannel0", 0)
 
  -------------------------------------------------------------------------------
  -------------------------------------------------------------------------------
  gh_gpu_program.uniform1i(shadertoy_prog_img, "iFrame", frame)
  -------------------------------------------------------------------------------
  -------------------------------------------------------------------------------
 
  draw_quad(0, 0, winW, winH) 
 
  gh_render_target.unbind(img)
   
end 

Thanks to that line, the demo works perfectly:



I added this demo to the code sample pack. Thanks Stefan for the porting  ;)

Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #10 on: November 25, 2016, 10:53:17 PM »
Ok, I looked at the neon clock demo and you have forgot (in file frame_user.lua) to update the iFrame uniform variable of the shadertoy_prog_img GPU program:

Yikes! Thanks for the heads-up.



gl21-butterfly-evolution

Test:
If there are no real textures, you can make the code smaller by replacing iChannelResolution[0] with iResolution

This demo uses
uniform float     iTimeDelta; // Time it takes to render a frame, in seconds 
Seems to work with or without 
gh_gpu_program.uniform1f(shadertoy_prog_buf_a, "iTimeDelta", elapsed_time)

Using gfx.write_text() causes a white screen?

Game rules:
click a tile for new mutations, red cross for new population
white square to lock a tile (exclude from mutation)
green square to show in big
green cross to randomly mate locked tiles






Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #11 on: December 18, 2016, 11:05:44 AM »
K2SO - Rogue One
original code / ported to GeeXLab

NB: normally i'm sloppy, but this time it was mandatory to start pixel shader with #version 120, otherwise Intel's GLSL compiler complains about smooth.


Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #12 on: December 25, 2016, 03:30:50 PM »
Last Incandescent
+ works

Drone Shepherd
- still don't know how to use iTimeDelta
- i was confused by texture bind in IMG EDIT: fix in next demo pack

>download now<



« Last Edit: December 26, 2016, 10:46:50 PM by Stefan »

Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #13 on: December 31, 2016, 11:54:23 AM »
9 new demos, download now

gl21-Better-Galaxy\
gl21-Scuba-Propulsion\
WIP_gl21-Algebraic_Surface_Shader_1.0\
gl21-Pachamama\
WIP_gl21-Candy-Cat[ShadertoyTC]\
gl21-Hedge-Maze\
gl21-The-twisting-gherkins\
gl21-Pannini-Flies-Gotham\
gl21-Dangles\


some still need correct binding of texturecube

Can s.o. test Candy-Cat with recent AMD GPU?
NVIDIA fails to compile ? : = sequences in *Block
Intel compiler fails with: Unhandled exception at 0x00007FFB3CA56640 (igdusc64.dll) in GeeXLab.exe: Stack cookie instrumentation code detected a stack-based buffer overrun.




Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4065
    • View Profile
Re: Shadertoy multipass demos
« Reply #14 on: February 11, 2017, 11:10:50 AM »
Chameleon

Download GeeXLab version

Notes:
no music
loading of texture cube fails
keyboard tex kills graphics