Fencepost of the Week #109
Moss and lichen combining to round-out the harsher rectilinearities.
Welcome to Wildeep's Illuminations, a blog of imagery and rumination, fresh from the desktop of Ben Mitchell.
Showing posts with label geometry. Show all posts
Showing posts with label geometry. Show all posts
Friday, 1 April 2016
Tuesday, 4 March 2014
Spirals
I wrote a while back about how elegant spirals can be in computer games - in particular, they are useful if you want to iteratively cover a space with evenly distributed points, with the range expanding out from a single starting location and with one growing tip - I have used them in the past for searching for a suitable placement point in a landscape for a game object, but I'm sure there are many other applications.
Anyway, I didn't include any code in that post, so here below is a Spiral function that is ready to use. This is written in C# for Unity, but should be easy enough to convert to whatever you happen to be using.
To achieve an even distribution of points, increment the distance param by the value of spacing - that way points will be equally distant form their neighbours on the line as they are from the neighbouring coils.
Here is a screen shot of the points generated by calling Spiral( dist, 1.0f ) with dist = [0,1,2,3...] As you can see, the unit spheres are packed pretty close to 1 unit apart:
Changing the spacing to 2.0f and iterating Spiral( dist, 2.0f) with dist = [0,2,4,6,8...] will lead to each of the unit spheres having 1 unit's space between them:
Vector3 Spiral( float dist, float spacing ) {
float rad = Mathf.Sqrt( dist / (Mathf.PI*spacing ));
float angle = Mathf.PI * 2.0f * rad;
Vector3 retVal = Vector3.zero;
retVal.x = spacing * rad * Mathf.Sin( angle );
retVal.z = spacing * rad * Mathf.Cos( angle );
return retVal;
}
'dist' is the distance along the line of the spiral from the origin, and 'spacing' is how far apart you want the coils of the spiral to be from each other (this spiral has the handy attribute of maintaining a constant radial distance between each concentric coil.)To achieve an even distribution of points, increment the distance param by the value of spacing - that way points will be equally distant form their neighbours on the line as they are from the neighbouring coils.
Here is a screen shot of the points generated by calling Spiral( dist, 1.0f ) with dist = [0,1,2,3...] As you can see, the unit spheres are packed pretty close to 1 unit apart:
Changing the spacing to 2.0f and iterating Spiral( dist, 2.0f) with dist = [0,2,4,6,8...] will lead to each of the unit spheres having 1 unit's space between them:
...Spirals!
Friday, 28 August 2009
Spirals

It is amazing how little use is made of spirals in computer games, they are really useful shapes - they can iteratively cover a 2d surface from a starting point in all directions quite evenly while still only having one growing tip, and they have an intrinsic beauty that is all their own.
Labels:
art,
conspiracy,
doodle,
game,
game gods,
geometry,
mysticism,
programming,
spiral
Wednesday, 8 July 2009
Inscrutable Squares

When your games design mojo is at it's lowest ebb, and you can't think of anything particular to do on the development, even while despairing at how far from complete the game still is, I find it useful to draw small, square-shaped diagrams - whether of non-linear level progression pathways, super efficient rendering strategies or simply of how I plan to eat at lunchtime.
The point is to make them as intriguing and cryptic as possible. By creating such a square and filling it with inscrutable squiggles, you will soon emerge with a fresh sense of purpose and direction, ready to forge ahead with a production that will undoubtedly exceed the very boundaries of gaming avant garde.
Friday, 26 June 2009
Argh! Trigonometry, Alison & Accident Book
Whenever you find yourself doing anything involved with trigonometry during the development of a 3d game, a little alarm bell should sound at the back of your mind - could you accomplish your aims more elegantly and efficiently by the application of a few vector cross and dot products? usually the answer is yes, and you should dump all those mouldy old atan2()s like a hot air balloon dropping sand bags.

Make sure your inappropriate over-reliance on trigonometry is properly recorded in the office accident book, and then move on. Don't look back - a nasty little trig fairy is lurking back there, just waiting for an opportunity to trepan your canoodle with a rusty old funnel-cap.

Make sure your inappropriate over-reliance on trigonometry is properly recorded in the office accident book, and then move on. Don't look back - a nasty little trig fairy is lurking back there, just waiting for an opportunity to trepan your canoodle with a rusty old funnel-cap.
Labels:
3d,
art,
doodle,
game,
game gods,
geometry,
programming,
studio management,
trigonometry
Subscribe to:
Posts (Atom)



