# Volleyball

## Recommended Posts

So someone posted "I modelled a soccerball".......really ? It's virtually pre-made for you in Houdini already.

Here's a tougher challenge, procedurally model a volleyball....not just the standard 3 stripes....how about ANY number of stripes ?

Won't post file yet...so ppl can have a go themselves.

##### Share on other sites

Just take a box and let some sine waves run across its surface.

```// INPUTS
int stripes = chi('stripes');
float diam = chf('diameter');
float bump = chf('bump');
float bend = chf('bend');

// GEOMETRY
vector nml = abs(@N);
vector bbox = relbbox(0, @P);

// SPHERIFY
@P = normalize(@P);

// SURFACE
vector shape = abs( sin(bbox * \$PI * stripes) );
shape = pow( sin(shape), bend) * bump;

// STRIPES ORIENTATION
if( int(nml.z) ){ @P += @N * shape.y; }
if( int(nml.y) ){ @P += @N * shape.x; }
if( int(nml.x) ){ @P += @N * shape.z; }

// GROUP SEAMS
i@group_seams = length(@P) < 1.001;

// OVERALL SCALE
@P *= diam * 0.5;```

Edited by konstantin magnus
image editing
• 1

##### Share on other sites

Impressive work Konstantin!

This is my approach:

##### Share on other sites

Ok, your topology looks more convincing. So I extrude the stripes, as well:

1. Add stripes on a box using relative bounding box coordinates.
2. Spherify by normalizing point coordinates.
3. Split by colours and extrude.
4. Fuse and subdivide.

Here is the simplified stripe code:

```int stripes = chi('stripes');
vector bbox = relbbox(0, @P);
vector nml = abs(@N);

if( nml.z > 0 ){ bbox.y = 0; }
if( nml.y > 0 ){ bbox.x = 0; }
if( nml.x > 0 ){ bbox.z = 0; }

@Cd = ceil(bbox * stripes) / stripes + @N;```

volleyball_2.hiplc

Edited by konstantin magnus
• 1

##### Share on other sites

all nice....

OK, here's mine, as usual...non-VEX approach

vu_Volleyball.hipnc

##### Share on other sites

Quite straight forward! You could also try copying your grid to an octahedron from platonic solids.

However, this requires to handle the orient attribute on the platonic first.

```vector up = v@N.zxy;			// assign swizzled normal vectors to up
matrix3 rot = maketransform(v@N, up);	// rotation matrix based on normals and up
p@orient = quaternion(rot);		// convert rotation matrix to quaternion (vector4)```

copy_grid_to_platonic.hiplc

##### Share on other sites

Here is a tutorial on creating a procedural volleyball:

• 1

## Create an account

Register a new account