I'm going to type in 3 cryptic lines in GLSL. Try them out yourself - maybe they can find a cozy home in one of your demos.
gl_Position.x=float(int(quant*gl_Position.x))/quant+gl_Position.x*0.001;
gl_Position.y=float(int(quant*gl_Position.y))/quant+gl_Position.y*0.001;
gl_Position.z=float(int(quant*gl_Position.z))/quant+gl_Position.z*0.001;
you can probably contract that into 1 line.
Είσαι πράγματι *ΤΟΣΟ* ανόητος;
10 years ago
That's actually a quite neat effect in it's simple glory.
ReplyDeletesuper nintendo mosaic effect with borken triangles ?
ReplyDeletenot so broken (thats why you need the +gl_Position. factor)
ReplyDeleteisnt it easier to go 1-line way from the beginning?
ReplyDeletegl_Position.xyz=mix(gl_Position.xyz,floor(gl_Position.xyz*quant)/quant,vec3(0.9));
btw. its cool to do that twice=) :
ReplyDeletegl_Position.xyz=mix(gl_Position.xyz,floor(gl_Position.xyz*quant)/quant,vec3(0.7));
quant*=0.13;
gl_Position.xyz=mix(gl_Position.xyz,floor(gl_Position.xyz*quant)/quant,vec3(0.33));
Also as already pointed out I am pretty sure using "floor()" instead of cast-to-int and cast-to-float is WAY more optimized (depends on the compiler but I believe the GLSL compilers aren't all that advanced right now).
ReplyDeleteUsing rendermonkey, I get this : http://tof.canardpc.com/show/8a57624d-bf10-404f-9d72-643f34342bfc.html
ReplyDeleteDid I do something wrong ?
try that:
ReplyDeletegl_Position=gl_Vertex;
//transform here
//...
//
gl_Position=gl_ModelViewProjectionMatrix*gl_Position;
Oh in object space instead of worldspace, right...
ReplyDelete