Creating a stairstepped effect ala "bitcrushing" w. jit.gl.mesh?


    Mar 29 2015 | 2:23 am
    So yeah, I'm trying to essentially downsample an XYZ coord, but make it stairstepped, which I reckon would mean making the end point of one segment the beginning of the next. This means I somehow have to copy points in the matrix? Argh, I'm running out of words to describe this, I'm hoping you can help me out!
    Right now I'm testing with a jit.bfg float32 going into jit.gl.mesh. I'd like the final project roughly in that config.
    So yeah, I can make the mesh "jagged" by running it through jit.dimop or whatever, but I'd really like to make it - you know - squared off, too.
    Oh, and I'd be happy to hear any jit.gen methods for this - I don't know an operator useful for this yet.
    cheers.

    • Mar 29 2015 | 6:18 pm
      Do you have an example of what this would kind of look like? I know 'bitcrushing' in audio, but I honnestly don't have any idea of what you want to do. I have some images in my mind, but I'm not at all sure if they are even close to what you want to do,...
    • Mar 29 2015 | 6:29 pm
      One thing I think of is quantizing vertex positions to a fixed interval value ([jit.op @op round] or something in that vain). But then I can't really picture what you 're after right now.
    • Mar 29 2015 | 6:52 pm
      PARDON MY SHITTY DRAWING SKILLZ:
      http://i.imgur.com/sPQMhIm.jpg @dtr yeah that's the same dimop doesish - I've tried to explain the difference in my drawing. What I'm looking for is to make the geometry somehow squared off, which means the algorithm has to add extra points - sort of how if you want a vertical line in [function], you have to put in a top and a bottom, if you get my meaning?
    • Mar 29 2015 | 6:53 pm
      *and thanks a billion for helping me out - visually this would absolutely rock.
    • Mar 29 2015 | 7:13 pm
      It looks like to go from your first curved line to the stepped one you could cook up a sort of quantizing algo. Keep every n-th vertex intact. The ones in between quantize to y of vertex(n-1) and x of vertex(n). This is in 2d like your drawing, extrapolate for 3d. This way you keep the original vertex count, which is handy cause vertex ordering is tricky with jit.gl.mesh, in my experience. Could be done in jit.expr or jit.gen I think.
    • Mar 29 2015 | 7:47 pm
      yeah, perhaps alternate between intact verteces and ones that are snapped to 1 or 2 of the coords of the next vertex.
      Sheesh. I think my head is spinning.
    • Mar 30 2015 | 1:37 am
    • Mar 30 2015 | 6:53 pm
      Hi, guys. To me, more than a bitcrushing effect, it looks like a typical "Sample & Hold" digitalization process. I think that your assumptions for the 2D example are correct but the implications for doing it in 3D seem somewhat tricky...
      Can you use an alternative approach for obtaining this kind of "Minecraft look"?
    • Mar 30 2015 | 11:49 pm
      Thanks for chiming in, Pedro! haha, while that is really cool-looking, the stuff I'm working on is more along the lines of the pic I'm posting below, and I think redrawing it in that manner would be really odd, hehe. I like the flat banner-like element of it, still.
      So yeah, I'm trying to work out how to grab x % of the verteces, and infuse them with, for instance, the x and z coord of the previous coord. Or the one coming after.
      Pedro, I know the structure of the 3d equivalent of my drawing is really tricky. I'm not looking to sample pos at different places and hold them, as a sample and hold would, although the analogy is solid.
      If anything I'm hoping to perhaps quantize positions to a grid, for instance?
      Could that happen? Simply saying "this is a cube of positions available to you - 16*16*16 or whatever. Any coord will snap to the nearest?
    • Mar 31 2015 | 1:13 am
      I thought about restricting the levels to obtain a snapping effect but that would not resolve it entirely, as you would not get rid of the diagonal lines... so quantizing alone is not the answer.
      Anyway, to quantize, I'm probably missing some obscure object, but the way I would do it is: 1. Make sure that the position values are within 0. and 1. 2. Convert the float32 position values to char (255 values). If you now convert back to float32, you end up with only 255 steps. If you want less steps, while in char mode use jit.op to divide and then multiply again (dividing by 2 gives you 128 steps and so on...).
      It certainly would be useful to have an object that does this automatically like the degrade~ object in MSP land...
    • Mar 31 2015 | 2:41 am
      And here's an example of a possible approach to dealing with this kind of problem. Good luck!
    • Mar 31 2015 | 3:15 am
      Wow! a great method of doing this! I'm pretty floored!
      I'm going to bed now, and in the morning I hope to be able to construct a version that fits my 4 1000 matrix :D Reading all those @usesrcdim 1 @srcdimstart 2 2 @srcdimend 9 9 etc is making me woozy! :)
      thanks!
    • Mar 31 2015 | 6:48 am
      I don't know enough about python and swapping code into Max but heres a link to the remesh modifier in blender. This can get any mesh and then turn it into blocks. http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Generate/Remesh This video shows what I think you're trying to do. https://www.youtube.com/watch?v=Mh-gUnS2c0Y Maybe checking out the source code for that mode of the modifier will help you get a bit closer to achieving it in max.
    • Mar 31 2015 | 6:49 am
    • Mar 31 2015 | 1:02 pm
      Thanks, andro - the videos are embedded in the wiki page, but there's no visible python code, though?
      But yes, that's roughly the effect I'm going for, except the result would look a bit like the old windows "pipes" screensave, if you remember that good'un.
    • Mar 31 2015 | 5:51 pm
      To get that look, it should be easier to use jit.gl.path. Good luck!
    • Mar 31 2015 | 6:42 pm
      haha, that's awesome. I meant that the pattern of the pipes could be applied to the fancy ribbon stuff I'm working with, so it'd need to be verteces to use with something else.
    • Apr 01 2015 | 8:27 am
      Hi PEDRO SANTOS before pipe Patch i've attach a max patch i try to run it but max console tell me this:
      Jit.gl.mesch failed to auto genere tangents
      is this a my problem (max7 setup) ? or a Patch problem ?
      thank
    • Apr 01 2015 | 10:25 am
      Yes, it's a patch problem. Just delete that attribute from jit.gl.mesh.
    • Apr 01 2015 | 11:31 am
      Getting a bit closer in jit.gen with this code:
    • Apr 05 2015 | 2:29 pm
      Easter Sunday bump - Can you even do a simple "float->char->float" thing in jit.gen? I tried doing a hacky "*100000->/100000" but that didn't work.
    • Apr 22 2015 | 8:48 pm
      My solution for this kind of quantization in Gen is to make an expr object with 'floor(in1*in2)/in2' where in1 is the value to be quantized and in2 is the number of steps.
    • Apr 23 2015 | 11:38 am
      Ha, at first glance I was like "that expression does NOTHING". Brilliant, can't wait to try it out! Thanks, Andrew.
    • Apr 23 2015 | 12:57 pm
      yup, it works! cheers!
    • Jun 26 2017 | 4:36 pm
      @wetterberg (APR 01 2015 | 12:31 PM)
      where/how did you implement this code?