Share your Shaders

Original Author: drmelon

Name of Shader: Paper Burn

Link to original shader: https://www.shadertoy.com/view/MdjSRK

 

Corona Shader Playground Link: http://goo.gl/FwRf30

 

Play around with CoronaSampler0 and CoronaSampler1 for some cool effects!

Hey! That is really impressive. Also, I noticed that you can use any image on imgur.com as a texture. It is better if it is pow2 and square, but all you have to do, is to type in address bar url of an image after # and reload a page.

Like this: https://shader.coronalabs.com/#http://i.imgur.com/UpWmwpv.png

If you would like to pass second sampler set to custom picture - append & and another url.

Anyway, I was happy about new StarWars trailer and made this - http://goo.gl/YYhnyv

One can tweak background colour to see how image would look like with different backgrounds)

Original Author: Predator106

Name of Shader: 2D Water Shader

Link to original shader: https://www.shadertoy.com/view/ldXGz7

 

Corona Shader Playground Link: http://goo.gl/fBSbWi

Simple 2D water shader.  Change CoronaSampler0 for a different image.

Here’s a water one I’m playing with at the moment. For some reason the image is displayed upside down, so really what you are seeing is the view when underwater.

Corona Shader Playground Link: http://goo.gl/7SSgwm

Me thinks the playground could do with some normal images as part of their list, not just textures and normalmaps etc.

I wrote how to use any image in playground earlier in this thread. Here’s example: http://goo.gl/aT3PqP, or example with your shader with custom texture - http://goo.gl/B5x2DN

I know you did but that doesn’t mean the playground shouldn’t have these types of images available automatically. I only posted my shader just to see if it worked really, it isn’t something I’ll spend more than a second or two on - I’d rather be actually playing with shaders in-game :slight_smile:

Pretty simple green glowing line : https://goo.gl/FjUZl9

Good job. Btw, if you would use [lua]finalColor *= abs( CoronaVertexUserData.x / sin( uv.x) );[/lua] instead of [lua]finalColor *= abs( 1.0 / (sin( uv.x) * 40.0) );[/lua] you would be able to change line width with x parameter of CoronaVertexUserData. Also, check out “CoronaColorScale” function, to set color of line dynamically with color setting, for example https://goo.gl/4p6T3n

Heh, well, this was a happy accident while I was trying to make something else, but it’s late and I’ll take it.  :smiley:

Something moves beneath the surface!

This was also not what I was going for, but I realized the positions stuff I did for the previous one made it feasible (this is one that wasn’t fragment-only, in my original batch):

Ice (put a normal map in sampler 0, and an “environment” in sampler 1)

EDIT : Link botched

EDIT 2 : New version, with some comments and Catmull-Rom interpolation.

Got distracted by yet another one.  :slight_smile:

This emulates an effect found in certain 16-bit games, e.g. during ActRaiser’s level entrance. Quintet may have put it in a few games, actually.

Zoom-spin effect

With angle set to 0 you can get something that’s just sort of “hopping around” on the “map”, but the “t * t” sharpens the curve, so it lags a bit at the peak. Even with just “t” it still spends too much time there, but I didn’t invest much into finding a more middle-heavy curve. (Maybe one of the Corona transitions would adapt well.)

Really cool !

I found several examples on shader toy where effects react to a soundtrack. Is that possible in corona ?

Original Author: xbe

Name of Shader: Fires

Link to original shader: https://www.shadertoy.com/view/XsXSWS

 

Corona Shader Playground Link: http://goo.gl/AuNC0a

 

Various flame types.  Would be great addition to games.  You can change to blue or green flames by uncommenting.

@ Icy Spark

Those flames are beautiful.  :slight_smile:

I’d been thinking about how to do some of the old classic fire demos, but it looks like these match those and more. I did get them sort of running in stock Corona a couple years back (with *cough* one rect per pixel), but they depended on previous frames and neighbors, so not terribly obvious how to transfer them to stateless shader-land. :slight_smile:

fBm seems to work well for fire in general. It also underlies the sun-ish effect I posted (in the playground announce thread).

@ Antheor

I’d be rather surprised if Corona built support into the tool. They probably just wanted to get it out the door. :) In theory, if you had audio as raw samples (say from a WAV, or decompressed from another source and captured) you could encode those to pixels and then read them out of a texture (perhaps “streaming” them through a snapshot), with time-based “texture” coordinates. I don’t know how well this would work in the presence of filtering, though, unless one could specify “nearest” mode.

At some point, I want to make some shaders for 1D / 2D FFT and convolution, if I don’t stumble on working versions in the meantime. I imagine the implementation will be a beast.  :D (I’ve written them in Lua…) I have a very specific computer vision-style problem in mind, but really any application of DSP would be game. (Doing something, for instance, along the lines of what I mention here.)

I just had a quick go at converting one I liked from shadertoy to corona:

http://goo.gl/MZzbrO

Seems to be relatively easy, although I have no idea which type of variable to assign to each, so I’m essentially just chucking P_COLOR and P_UV randomly at stuff and it seems to work :smiley:

Here’s another shadertoy conversion:

MOUNTAINS!

http://goo.gl/A2a5zy

Seems like P_COLOR is for color values and P_UV is for x,y values. But I guess we can stick with any of these.

It is, I’ve done it when corona had Graphics 2.0 competition. But you have to convert the soundtrack to raw pcm and read it in Lua.

Those are just a veneer over GLSL’s built-in qualifiers: precision qualifiers. Presumably, after a bunch of tests, those usages seemed to show the best balance. (“uv” is just a synonym for “texture coordinates”.)

This has all the relevant info around the middle of the document: Reference Card  lowp doesn’t let you store very large values, but is fixed-point, so you can store multiples of 1 / 256 exactly, e.g. for colors.

The newest additions are quite nice!

@ Lerg I wonder if the starfield wouldn’t benefit from some (noise-based) perpendicular motion, to break up all the straight line motion right now.

Also, as I mentioned above, you COULD stuff those sound samples into a texture. The necessary DSP shader is the sticking point.  :stuck_out_tongue:

Only a WIP at the moment, but might as well add it: rotating cylinder I have some subtle error in the v-coordinate computations. This would be a bit easier if I wasn’t trying to keep the axes consistent between rotations.

By the way here are standard shader functions. Useful to read.

http://www.shaderific.com/glsl-functions/