07
Mar
08

Vertex Position Quantisation

3D pixellation!!
I’d like to prevent 45-degree faces appearing, but not sure how to go about that. Looks nice anyway.

Superformula GLSL Vertex-Quantised 01Superformula GLSL Vertex-Quantised 02
Superformula GLSL Vertex-Quantised 03Superformula GLSL Vertex-Quantised 04
Superformula GLSL Vertex-Quantised 05Superformula GLSL Vertex-Quantise 06

This is the Superformula being quantised. I’ve added a Mix control, to mix between the quantised and unquantised vertex positions, so the effect can be applied progressively. Needs some tweaking, but it’s quite a cool glitchy effect.

Advertisements

15 Responses to “Vertex Position Quantisation”


  1. 1 yanomano
    March 7, 2008 at 2:53 pm

    fantastic !

  2. March 7, 2008 at 3:10 pm

    man this stuff looks amazing (as does the previous stuff)! the mix control sounds really cool too… can’t wait till some of this stuff is released 😛

    P.S. are there any mapping coordinates on these models? would be interested to map textures onto these..

  3. 3 toneburst
    March 7, 2008 at 3:34 pm

    Hi memo!

    Cheers, mate!
    I can send you a QTZ if you like. The only thing that still needs to be sorted out (other than normals and lighting, which I’m going to leave for the moment, anyway) is proper ranges for the controls.

    I haven’t really tried texturing the meshes, though they do have texture coordinates. I’ve been thinking maybe of mapping some repeating textures, or gridlines onto them, but haven’t got around to trying it yet. I’ll give it a go and let you know how it goes.

    a|x

  4. March 9, 2008 at 8:59 pm

    Looks really promising…especially the fifth picture…Any chance to see how are you ‘quantizing’ vertex positions?

  5. 5 toneburst
    March 9, 2008 at 10:41 pm

    Hi desaxismundi!

    Thanks!
    The vertex quantisation code is very simple, actually. It’s virtually the same code I’ve used in the past for pixellation-based fragment/pixel shader effects.

    // ‘Quantised’ vertex position
    vec3 vertexQ;
    vertexQ = (floor(vertex.xyz * QSize) / QSize);
    vertexQ =+ 0.8 * vertexQ;

    // Mix quantised and unquantised vertex positions
    vertex = vec4(mix(vertex.xyz,vertexQ,QAmt),1.0);

    ‘QSize’ is a vec3 representing the quantisation size in the X, Y and Z axes.
    ‘vertex’ is the vertex position after application of the Superformula code.
    ‘QAmt’ mixes pre and post-quantised vertex positions.

    (vec3s are equivalent to HLSL float3 arrays, the GLSL mix function equates to lerp in HLSL).

    the line
    ‘vertexQ =+ 0.8 * vertexQ;’
    is my attempt to compensate for the fact that vertices appear offset when they’re quantised. I’m sure there’s a more logical way to make sure the entire object isn’t moved when the vertices are quantised, but I haven’t spent much time trying to work it out.

    I haven’t tried calculating normals, since I’m not using them at the moment.

    The only thing that annoys me is the 45-degree angles that appear from time to time. I’m not sure how to stop this happening without having access to the positions of more than one vertex at a time. There’s probably a way, however.

    I’m sure you can take this and run with it, and no doubt produce something amazing!

    a|x

  6. March 10, 2008 at 12:46 pm

    Thanx a lot! I will give it a try 🙂

  7. 7 toneburst
    March 10, 2008 at 12:58 pm

    Cool, desaxismundi- looking forward to seeing what you come up with!

    Incidentally, I should say I got the idea (if not the actual method) from the Kineme guys (who’re doing excellent work extending Quartz Composer by writing plugin patches for it).

    a|x

  8. 8 Neb
    March 17, 2008 at 6:28 am

    Wonderful stuff! Willing to share with a fellow Quartz Composer user?

  9. 9 toneburst
    March 17, 2008 at 9:15 am

    Hi Neb,

    Cheers!
    The plan is to share the whole project when it’s ready, so you’ll be able to pick it apart then 🙂
    I’ve used some of the same techniques (though not the vertex quantisation) in the Maths Surfaces QTZ I posted on Memo’s site last week. Check it out if you’re interested.

    http://vdmx.memo.tv/qc

    alx

  10. 10 639me
    September 1, 2008 at 10:13 pm

    are you still working on this? i’d love to look into it, if i got the chance. doesnt need to be *ready*, somehow its less embarrassing picking apart things that dont fit too tight already…

  11. 11 toneburst
    September 2, 2008 at 2:43 pm

    Hiya 639me!

    I’ve not got around to releasing this one yet. I’ll have to do that sometime soon, so keep a lookout for it.

    a|x

  12. 12 George Toledo
    September 6, 2008 at 8:32 pm

    Hmmmmmm :o) This is really nice. I love this…

  13. 13 toneburst
    September 7, 2008 at 8:11 am

    Cheers George Toledo!

    As soon as I get a chance to tidy it up, I’ll release the QTZ.

    a|x

  14. 14 639me
    September 14, 2008 at 4:25 pm

    i actually like the 45° angles as well. both in this one and in you glsl texture coordinate error. and you got something similar to the self-shadowing from yesterdays post going on here, really nice! not real time, i presume?

  15. 15 toneburst
    September 15, 2008 at 6:32 pm

    Hi 639me,

    it’s realtime (well, depending on your system).
    Funny you should mention the self-shadowing effect, actually. This doesn’t use it, but uses a very simple form of ‘fake’ shading, where the luminosity of the surface is purely a product of the distance from a particular point. It the technique I used to generate the depth-map I used for the SSAO experiments.

    https://machinesdontcare.wordpress.com/2008/09/15/more-ssao/ssao_140908_05/
    and

    It’s really simple technique, and can look really nice. It runs fast too, since no normals are needed.

    a|x


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

March 2008
M T W T F S S
« Feb   Apr »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Links

Blog Stats

  • 471,292 hits

%d bloggers like this: