Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Share your Shaders
Started by Icy Spark Apr 17 2015 07:43 AM

55 replies to this topic
shader effect share
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 846 posts
  • Corona SDK

@online2

 

There are a few approaches like CCRenderTexture.

 

If the texture doesn't need to be updated frequently, display.save() is available.

 

If the results are needed immediately and can then be fed into another effect, multi-pass is an option. (This is the first thing I tried, but generator.random was updating too and the circles effect did not appreciate it.  :D)

 

Last but not least are snapshots, which as you saw I ended up using (never further refreshing it after its initial capture). You can apply a fill to a snapshot, as I did. Unfortunately, these cannot yet be used as inputs to paints, normal or composite.  :( There were some hints from Walter that this would be coming, but I think it's gotten lost in the shuffle. Once this happens, though, the fancy effect floodgates will be wide open.  :)

 

Stripes shouldn't be too hard to do. If you saw IcySpark's fires effect earlier in the thread, for instance, it has this snippet:

P_UV vec2 q = uv;

q.x *= 5.;

// SNIP

q.x = mod(q.x,1.)-0.5;

which basically breaks the region horizontally into five unit-width bins, then centers them. It isn't a huge leap from bins to stripes, e.g. before that final line there could be a test like mod(q.x, 2.) > 1..

 

Something like that will be straightforward for horizontal or vertical lines. You can move to angled ones by using vectors. Basically, if you have a unit vector (x, y), it will have perpendicular vectors (-y, x) and (y, -x). Then you'd have a set of points going from some origin, (x, y), to each displacement by an integer multiple of one of your perpendiculars, e.g. adapting the above snippet, (x, y) + t * (-y, x) where t goes from 0 to 4. Using vector projection, you'd first find out where your current uv would land on that perpendicular line, and probably snap it to one of the intervals. That would give you a starting point for a parallel (x, y) ray, and you could do another projection to land on that.

 

(This might make more sense with a picture, but I don't think I'm up to it just now. I'm not sure if it's helpful, but if you saw any of those shader shows, this was one of the "rip" effects I demonstrated, and uses an oriented segment; basically, it masks out pixels close to the segment. The other two variants are in that same directory. There's a link to a mostly up-to-date version zip file of the project earlier in this thread.)

 

Each projection would give you a distance, as you'll see if you read the vector projection link. These are basically rotated versions of x and y, and the same technique used by the fires can apply.

 

Once you've established you're on a stripe you can play with it, of course. Alternatively, you might try to reverse your position and land on a stripe. I'll leave it there, for now, or I'll never get this posted.  :D



[TOPIC: post.html]
#52

kadlugan

[GLOBAL: userInfoPane.html]
kadlugan
  • Enthusiast

  • 42 posts
  • Corona SDK

@StarCrunch

 

Thanks for all the effort and time in explaining these approaches.  I'll check out the links and thoughts and have a play around.



[TOPIC: post.html]
#53

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Starfield

 

Original Shader: https://www.shadertoy.com/view/Md2SR3

Corona Playground: https://goo.gl/Ux9dEo

 

I don't know if I did this correctly or not...



[TOPIC: post.html]
#54

sakib.farid

[GLOBAL: userInfoPane.html]
sakib.farid
  • Observer

  • 27 posts
  • Corona SDK

Atmospheric Scattering

 

Original Shader: https://www.shadertoy.com/view/lslXDr

Corona Playground: https://goo.gl/bhMXsh



[TOPIC: post.html]
#55

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Corona Geek

  • 1,051 posts
  • Corona Staff

Nice! It reminds me about full lunar eclipse on September 27!



[TOPIC: post.html]
#56

ymmtny

[GLOBAL: userInfoPane.html]
ymmtny
  • Enthusiast

  • 34 posts
  • Corona SDK

a panorama shader to view an equirectangular photo.  

Github: https://github.com/kwiksher/custom-filter-panorama

Original Shader: https://gist.github.com/fieldOfView/5106319




[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]