How would you do this on a shader?
category: code [glöplog]
How would you do this on a shader? Without using a precomputed 3D lookup texture.
The raster-effect? Perhaps with a small 3d-texture, repeating on x and y and looking up with the luminosity as z.
why without the precomputed texture?
perhaps with distance field method and primitive box boolean combination... Although it would take lots of gpu power for such a poor visual ;)
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.
opengl stipple?
Some modulo-magic depending on the x/y pixel position?
without precomputex texture = realtime computed texture. stupid question. bye.
output = input+sin(x)*sin(y)*.5 > 0.5 ? 1 : 0;
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);
}
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);
}
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.
Another example of the pretended effect:
What's this called? B&W printer offset effect?
What's this called? B&W printer offset effect?
didnt Kakiarts do this in Rastro?
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.
I've seen a bunch of halftone shaders, a google search is sure to lead to the clueshoppe.
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.
(^^ ahah, my post was completely off topic, sorry, browsing this thread on a mobile didn't help to see the pixels on the logo! ;))
what 216+kusma said
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.
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
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