# Roundcube (Composition by smokris)

 Author: smokris License: MIT Date: 2009.11.20 Compatibility: 10.5, 10.6 Categories: Required plugins: (none)

Using Kineme3D's `Parametric Surface` patch, renders a rounded cube, based on Paul Bourke's Superellipsoid.

PreviewAttachmentSize
roundcube.qtz9.15 KB

## Comment viewing options

### Re: Roundcube (Composition by smokris)

This is really cool... out of curiosity, do you get the "seam" as well (halfway down the cube, on certain sides)?

### Re: Roundcube (Composition by smokris)

Yeah, since I'm not generating a fully closed surface.

I think a modification to `Parametric Surface` would be necessary to solve this --- add an option allowing the user to make a dimension 'closed', connecting the first and last points with a quad (with separate options for closing 'u' and closing 'v'). So you could make an upright cylinder by closing 'u', or a torus by closing both 'u' and 'v'.

Also perhaps:

• Use something other than 'u' and 'v' for the 2d parameters --- this gets confusing because this patch also exposes 'u' and 'v' as texture coordinates. Perhaps 's' and 't', or 'i' and 'j'?
• Allow the user to individually specify the min and max 'u' and 'v' (this would simplify my composition somewhat).

### Re: Roundcube (Composition by smokris)

On a more general note, is there any chance of you doing a brief tutorial on using the Parametric Surface patch? I must admit to being a bit stumped when I looked at your example.

a|x

### Re: Roundcube (Composition by smokris)

X Expression = the expression evaluated to generate X coordinates Y Expression = ditto, for Y Z Expression = ditto, for Z

You're given "u" and "v" as the parameters, so define X, Y, and Z in terms of u and v, and you're set. U and V range from 0 to 1, in steps of 1/U resolution or 1/V resolution (respectively).

You can pass in additional variables through the structure input (if you've got complex formulas etc).

We use the Math Expression patch's expression evaluator, so it functions identically to that (including crashing on atan2(x) on 10.5).

### Re: Roundcube (Composition by smokris)

At first, I was wondering if a setting that resembled the sprite anti-aliasing would make it look like the object "closes", but that seemed dubious, especially since in that scenario, a sprite ends up looking smaller.

I think the idea of adding those kind of features in would make it more flexible for sure. One usually has to be careful about the way that they present the object.

### Superellipsoid

This reminds me when I was trying to add a Superellipsoid to GLSL http://local.wasp.uwa.edu.au/~pbourke/geometry/superellipse/

By then I couldn't figure anything out. Now I when back to the file and tweaking the code and trying many diferent ways so I could make something nice. using the formula from pbourke, the normals weren't working good. but I could fix it, lucky! And there is still some improvements to be done. I hope you guys can make it better so it can change to any shape does the Superellipsoid.

Some points to mention: A. the two poleholes, one side is visible black (try to use N1) B. When trying to make a rounded angle, the mesh in pole's side isn't close.

give it a try!

EDIT: I didn't read that you already mention the superellipse formula. duups! I need to slow down my curiosity, some times.

PreviewAttachmentSize
off_SUPERELLIPSOID.qtz34.36 KB

### Re: Superellipsoid

offonoll, your superellipsoid goes haywire when fed .gifs - lovely piece of work.

### Re: Roundcube (Composition by smokris)

This performs with total consistency in either 10.5 or 10.6, a really neat and elegant piece of work.

### Re: Roundcube (Composition by smokris)

Very nice. I notice you've got both a 3D transform patch and a trackball going here, which is a bit confusing. If you change the orientation with the controls, then drag to spin the trackball, things rotate a bit weirdly.

Good to see the old Perlin Noise shader again :D

a|x

### Re: Roundcube (Composition by smokris)

Hey! yes, I love perlin noise!! :)

About the trackball inside 3Dtransform, I allways drag in viewer to see any angle while I am composing, the 3D transform is to control the 3d volume once finished in vdmx for instance. of course, if you drag, 3d transform is useless.

Would be great if you can improve the equation and introduce (0.2, 0.8, 1.0, 2.0, and 3.0) 'N2' input values dynamicly from the Paul Bourke's math equation. My knowledge isn't that good in GLSL.

Also is very cool to ad a minus to those values. give it a try!

I hope you guys can improve the composition. :)