Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: taj on October 08, 2006

Title: Geometric texture generation
Post by: taj on October 08, 2006
Hi all, Im working on a theory about how to generate geometric textures, including bump maps and displacement maps using very very few bytes. I need a system that produces lots of different looking textures in geometric patterns but also nicely, gracefully shdes them so they can be used as "heights". Anyway I had a brain wave a while back and finally tried it out today. The exe is attached for you to play with. Its not a useful tool yet but shows the potential of the sytem I came up with.

So the idea is very simple.

I render a bunch of opengl cones from above in a regular spaced grid pattern. I use fog to light the cones, making them brighter the higher they are and darker further away. Depth cueing if you like.

The design tool allows you to vary the radius, height, number of sides and overall spacing of the cones.

In the final demo (4k) Ill capture the pixels into a buffer and make a mip map that could be used for normal texturing, bump mapping or displacement mapping with a good shader.

It seems to work quite well as an idea: suprisingly so actually. Here is a first look at the technique.
Keys:
a,z - scale(radius)
s,x - spacing between cones
h,b- height of cone
j,n- number of sides (increase or decrease once per key press)
r - reset

I'm not a tool builder :-)

Anyway the code in the demo should be around 200-250 bytes plus some to capture the textures. Each texture will be stored as a single integer, allowing for say 20 textures easily.

There is no colour control yet. I dont know if I want any...not in the texture, only on the object modulated by the texture...we'll see. I believe the tecnique could be used with randomness to achieve cellular textures too for very little extra code.

I guess its only of academic interest at the moment but might eventually be quite powerful as a technique. For example the cones could actually be any geometry (eg spheres, 3d letters, cubes etc).
Title: Re: Geometric texture generation
Post by: Shockwave on October 08, 2006
That's actually quite startling the variety of textures that you can make from a simple technique like this :) Some of the textures, especially where more sides are used and circles overlap look quite organic.



Title: Re: Geometric texture generation
Post by: Jim on October 08, 2006
Two other techniques you'll probably need are a white noise generator (basically a random texture) and a plasma generator.
To generate a plasma, do this recursively.
random=255
1.pick the 4 outer corner heights at rand()%random
2.pick the midpoints of the edges and the centre of the texture and give them height = average height of neighbouring points + rand()%(random/2)
3.random /= 2
4.go to 2 until you're down to 1 pixel.
That should give you a lumpy, cloudy texture good for visual and bump maps.

Both of these can be blended in with more geometric patterns to give lots of variation.

Jim

Title: Re: Geometric texture generation
Post by: Rbz on October 09, 2006
Texture generation is something that I want to start code now.

And there's a lot ofĂ‚  ideas to try out and you gave me anotherĂ‚  :)
Title: Re: Geometric texture generation
Post by: Shockwave on October 09, 2006
Essential for all you tiny coders :)