pouët.net

How would you do this on a shader?

category: code [glöplog]
 
BB Image

How would you do this on a shader? Without using a precomputed 3D lookup texture.
added on the 2010-06-22 07:45:34 by xernobyl xernobyl
The raster-effect? Perhaps with a small 3d-texture, repeating on x and y and looking up with the luminosity as z.
added on the 2010-06-22 08:58:57 by kusma kusma
why without the precomputed texture?
added on the 2010-06-22 09:08:48 by skrebbel skrebbel
perhaps with distance field method and primitive box boolean combination... Although it would take lots of gpu power for such a poor visual ;)
added on the 2010-06-22 09:19:28 by xoofx xoofx
Quote:
How would you do this on a shader? Without using a precomputed 3D lookup texture.

Well, you could do it with a precomputed 2D lookup texture.
added on the 2010-06-22 09:24:22 by ryg ryg
opengl stipple?
added on the 2010-06-22 09:26:16 by zaphands zaphands
Some modulo-magic depending on the x/y pixel position?
added on the 2010-06-22 09:36:36 by raer raer
without precomputex texture = realtime computed texture. stupid question. bye.
added on the 2010-06-22 09:48:04 by Oswald Oswald
output = input+sin(x)*sin(y)*.5 > 0.5 ? 1 : 0;
added on the 2010-06-22 10:24:10 by 216 216
Sorry, missed the part about the no precomputed 3d-texture constraint.

Here's a simple shader to generate an antialaised raster-pattern of a fade. It can be simplified further, but that's an exercise left to the reader:
float4 ps_main( float2 texCoord : TEXCOORD0 ) : COLOR
{
float lum = texCoord.x;
float d = 0.5 + (sin(texCoord.x * 20) * cos(texCoord.y * 20)) * 0.5;
return smoothstep(lum - fwidth(d) * 0.75, lum + fwidth(d) * 0.75, d);
}
added on the 2010-06-22 10:31:34 by kusma kusma
Quote:
without precomputex texture = realtime computed texture. stupid question. bye.

I was going to add something like "or how do you precompute the texture"... My brain is slightly offline but kusma's thing looks like a "plasma" pattern, which makes sense, and will make a lot more sense after I sleep a few more hours :S
I hope.
added on the 2010-06-22 11:49:45 by xernobyl xernobyl
Another example of the pretended effect:

BB Image

What's this called? B&W printer offset effect?
added on the 2010-06-22 11:54:52 by xernobyl xernobyl
didnt Kakiarts do this in Rastro?
added on the 2010-06-22 12:06:00 by Gargaj Gargaj
I think it wasn't so dynamic. From what I remember it was like applying a dotted texture for each level... something more like a typical crosshatch shader.
added on the 2010-06-22 12:29:02 by xernobyl xernobyl
I've seen a bunch of halftone shaders, a google search is sure to lead to the clueshoppe.
added on the 2010-06-22 12:41:22 by psonice psonice
Gargaj: we did, but without shaders, even though it's trivially portable to even PS 1.x. Anyway, we only did strict thresholding (pxiel darker than threshold -> make it black, pixel lighter than threshold -> make it white). It seems that xernobyl wants to have some nice antialiased dots instead, which requires 3D textures or a more elaborated shader.
added on the 2010-06-22 17:26:29 by KeyJ KeyJ
(^^ ahah, my post was completely off topic, sorry, browsing this thread on a mobile didn't help to see the pixels on the logo! ;))
added on the 2010-06-22 17:44:32 by xoofx xoofx
what 216+kusma said
added on the 2010-06-22 22:14:17 by iq iq
Also, do a blur before you apply the halftone pattern - the bigger the dots the shittier it looks when the original image has frequencies in it that shouldn't be possible.
added on the 2010-06-22 22:57:55 by kb_ kb_
From the example I would say that you are looking for http://en.wikipedia.org/wiki/Ordered_dithering
You can see what it looks like near the end of http://www.dca.fee.unicamp.br/~lotufo/Courses/ia-636-1995/alberto/proj5/html/front-page.html
added on the 2010-06-23 08:18:25 by bore bore

login