Shadertoy multipass demos

Started by JeGX, February 07, 2016, 08:33:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JeGX

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

#1
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

Stefan

Rocket City

uses both iFrame and iTimeDelta

also iChannelResolution, keyboard and mouse-click


JeGX

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

Quote from: JeGX on February 08, 2016, 10:18:11 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

#5
Quote from: Stefan on February 24, 2016, 05:26:24 PM

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.


Stefan

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

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

Quote from: Stefan on November 25, 2016, 04:51:43 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:


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

Quote from: JeGX on November 25, 2016, 06:42:39 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

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

#12
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<




Stefan

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

Chameleon

Download GeeXLab version

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