Share a Shader!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Share a Shader!
That's quite bad, you've got 2 FPS with a black screen ^^' I guess I messed up something since I don't know the language, my bad
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Share a Shader!
Thanks anyway!
Maybe the Gods of pixeleffects will show mercy and provide a display of their brilliance.
Maybe the Gods of pixeleffects will show mercy and provide a display of their brilliance.
Re: Share a Shader!
This should work.
This is the apple glsl shader by Iñigo Quilez http://www.iquilezles.org.
Direct link: http://www.iquilezles.org/apps/shadertoy/?p=apple edit: here's a youtube of Iñigo livecoding the shader http://www.youtube.com/watch?v=CHmneY8ry84
amazing.
This is the apple glsl shader by Iñigo Quilez http://www.iquilezles.org.
Direct link: http://www.iquilezles.org/apps/shadertoy/?p=apple edit: here's a youtube of Iñigo livecoding the shader http://www.youtube.com/watch?v=CHmneY8ry84
amazing.
Re: Share a Shader!
Thanks ioxu!
Very impressive.
First time that my GPU was the limiting factor.
Couldn't find the 'stem' thought
Next, the worm hole!
Very impressive.
First time that my GPU was the limiting factor.
Couldn't find the 'stem' thought
Next, the worm hole!
Re: Share a Shader!
Starting to get the hang of it but sure is a lot I don't understand.
Attached is a Love version of Quilez's pulse shader.
Attached is a Love version of Quilez's pulse shader.
- Attachments
-
- pulse.love
- A water like effect.
- (10.49 KiB) Downloaded 484 times
Re: Share a Shader!
Ref!
You sent me a PM but I can't reply because the board says that you don't accept PMs. Please change your prefs!
You sent me a PM but I can't reply because the board says that you don't accept PMs. Please change your prefs!
Re: Share a Shader!
These are all great help to all us who are not GLSL-savvy, so thanks everyone!
I've particularly enjoyed the ioxu's luminous effect, which is gorgeous, and I whipped up a quick wrapper, so that I can use it more conveniently – there you have it, in case anyone would find it useful. Also, thanks, ioxu! This was exactly what I needed.
I've particularly enjoyed the ioxu's luminous effect, which is gorgeous, and I whipped up a quick wrapper, so that I can use it more conveniently – there you have it, in case anyone would find it useful. Also, thanks, ioxu! This was exactly what I needed.
Code: Select all
--
-- The original Light Scattering GLSL shader by Fabien Sanglard
-- http://fabiensanglard.net/lightScattering/index.php
--
-- Adapted to the LOVE PixelEffect by ioxu
-- http://blog.ioxu.com/?p=909
--
-- 'Luminosity' wrapper by mz1
-- www.mz1net.com
--
-- =================================================================================
-- EXAMPLE USAGE:
-- ---
--[[
function love.load()
windowSizeX, windowSizeY = 800, 600
l = Luminosity.new(windowSizeX, windowSizeY)
end
function love.draw()
-- Draw BG, ...
-- ...
-- When you want to draw with luminosity:
-- 1] Call 'receive'
l:receive()
-- 2] Now the luminosity instance will receive all your renders up until you
-- call 'process', so draw whatever you want to draw illuminated:
love.graphics.draw(sprite1, 0, 0, ...)
love.graphics.draw(sprite2, 0, 0, ...)
-- 3] Call 'process'
l:process()
-- 4] Now the luminosity instance contains everything that you have drawn in the
-- step #2, and it is illuminated. Draw it to the screen when convenient.
l:draw()
-- Done. Continue to render whatever else you want to render.
-- ...
end
-- Remember that you can set the light's position with 'setLightPosition', and also
-- tweak the shader values in the constructor.
]]
-- =================================================================================
-- =================================================================================
Luminosity = {}
Luminosity.__index = Luminosity
-- =================================================================================
function Luminosity.new (canvasSizeX, canvasSizeY)
local new = {}
setmetatable(new, Luminosity)
new.canvasSizeX = canvasSizeX
new.canvasSizeY = canvasSizeY
new.backCanvas = love.graphics.newCanvas( canvasSizeX, canvasSizeY )
new.raysCanvas = love.graphics.newCanvas( canvasSizeX, canvasSizeY )
new.FX = love.graphics.newPixelEffect[[
extern number exposure = 1.0;
extern number decay = 1.0;
extern number density = 1.0;
extern number weight = 1.0;
extern vec2 lightPositionOnScreen= vec2(0.0,0.0);
extern number NUM_SAMPLES = 100.0 ;
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
vec2 deltaTextCoord = vec2( texture_coords - lightPositionOnScreen.xy );
vec2 textCoo = texture_coords.xy;
deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * density;
float illuminationDecay = 1.0;
vec4 cc = vec4(0.0, 0.0, 0.0, 1.0);
for(int i=0; i < NUM_SAMPLES ; i++)
{
textCoo -= deltaTextCoord;
vec4 sample = Texel( texture, textCoo );
sample *= illuminationDecay * weight;
cc += sample;
illuminationDecay *= decay;
}
cc *= exposure;
return cc;
}
]]
new:setLightSource( 0.5, 0.5 )
new.FX:send( 'exposure', 0.2 )
new.FX:send( 'decay', 0.95 )
new.FX:send( 'density', 0.4 )
new.FX:send( 'weight', 0.3 )
new.FX:send( 'NUM_SAMPLES', 70 )
return new
end
-- =================================================================================
--
-- x, y = [0, 1], relative to the canvas size
--
function Luminosity:setLightSource (x, y)
self.FX:send( 'lightPositionOnScreen', { x, 1-y } )
end
-- =================================================================================
function Luminosity:receive()
--
self.backCanvas:clear()
self.raysCanvas:clear()
--
love.graphics.setCanvas( self.backCanvas )
end
-- =================================================================================
function Luminosity:process()
--
love.graphics.setColor( 255,255,255 )
love.graphics.setCanvas( self.raysCanvas )
love.graphics.setPixelEffect( self.FX )
--
love.graphics.draw( self.backCanvas, 0, 0, 0, 1, 1 )
--
love.graphics.setCanvas()
love.graphics.setPixelEffect()
end
-- =================================================================================
function Luminosity:draw (x, y)
--
love.graphics.setColor( 255,255,255 )
love.graphics.draw( self.backCanvas, x or 0, y or 0 )
--
local bm = love.graphics.getBlendMode()
love.graphics.setBlendMode( 'additive' )
love.graphics.draw( self.raysCanvas, x, y, 0, 1, 1 )
love.graphics.draw( self.raysCanvas, x, y, 0, 1, 1 )
-- Restore the previous blend mode
love.graphics.setBlendMode( bm )
end
- retrotails
- Party member
- Posts: 212
- Joined: Wed Apr 18, 2012 12:37 am
Re: Share a Shader!
An accident.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Share a Shader!
That could be useful for doing "flakey signal" effects. Awesome.retrotails wrote:An accident.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Share a Shader!
Nice. Shame the effect gets so damn large after running it a while. Kind of breaks the effect.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests