Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: b0ib0t on January 30, 2008
-
Here and there I see this generated texture that I find quite nice. Its to uniform to be randomly generated squares. My guess is that it must be some type of fractal or something. Alas, I am not sure. Any information on this texture would be greatly appreciated.
Here is a screen-shot of what I am talking of.
Edit:
I've uploaded that screen shot.
-
to generate a texture of any nearly any art you need stuff like this:
GENERATORS (generate seperate image/texture):
- Rect (Flat / Rectancle)
- Pixel (random or perlin noise)
- Clouds
- Circle (EvnMap)
- Cells
- Fractal
FILTERS:
- Distort
- Sine
- Rotozoom
- Brightness
- Invert
- Hue Saturation Intensity
- Color
- Blur
- Normal Map
- Directional Light
- Spot Light
- Blend
- Math ops like Add/Sub/Mul/Div Texture
-
After a little chat with Rel on Yahoo, I now know the secret! Its a xor trick, and Rel told me all about it. I made a little "card" if you will to tell him thank you.
http://dbfinteractive.com/index.php?topic=2869.0
-
It's nice of you to thank Rel :) I know he'll appreciate it!
Here's something for you to get your teeth into, it's a good excercise to see if you can figure out why it draws what it does :)
' By Shockwave
'--------------------------------------------------------------------------
OPTION STATIC
OPTION EXPLICIT
'-------------------------------------------------------------------------
' Includes.
'-------------------------------------------------------------------------
#define PTC_WIN
#Include Once "tinyptc.bi"
'-------------------------------------------------------------------------
' Open Screen;
'-------------------------------------------------------------------------
If( ptc_open( "EHHH??!", 256, 256 ) = 0 ) Then
End -1
End If
Dim Shared As uInteger Buffer( 256 * 256 ):' Screen Buffer.
'-------------------------------------------------------------------------
' Main Loop;
'-------------------------------------------------------------------------
dim x,y,cc as integer
DO
for y=0 to 255
cc=Y*256
for x=0 to 255
if (x and y) = 1 then
buffer(cc+x) = &hffffff
else
buffer(cc+x) = (x xor y)
end if
next
next
ptc_update@buffer(0)
LOOP UNTIL INKEY$ = CHR$(27)
-
b0ib0t: Don't mind it. If I wasn't able to help you, somebody here surely would. :cheers:
Shock: Whoa! SierpinskiXOR, I didn't know you could do sierpinski that way. Nice!
-
for x = 0 to texture.width
for y = 0 to texture.height
{
plot x XOR y;
}
done :D
-
'plain old black / white checkerboard pattern
for y = 0 to 256
for x = 0 to 256
checker_pattern(x,y) = ((x xor y) and 1)*255
next
next
-
These are handy routines for stand-in textures, but if you use them in a real demo without a new twist expect to get flamed because the XOR texture is a total cliche.
Jim
-
relsoft+shockwave: It fits 21 bytes in assembler (http://www.pouet.net/prod.php?which=4856) ;)
-
'plain old black / white checkerboard pattern
for y = 0 to 256
for x = 0 to 256
checker_pattern(x,y) = ((x xor y) and 1)*255
next
next
Its generates a checkerboard with 1x1 black/white boxes... is there a way using this algo to draw any block sized checkerboard like 8x8 32x32 and so on checkerboard boxes on a 256x256 texture? It would be cool, because my version for drawing a ceckerboard (blocks in any size) need more code and is not the best coding solution.
-
I've had a few right now, but it's worth seeing what
checker_pattern(x,y) = ((x xor y) and 3)*255
checker_pattern(x,y) = ((x xor y) and 7)*255
would do
Jim
-
I would go with the advice to NEVER use that texture. You _will_ get flamed. Even at 256b its risky.
-
loop thru x
loop thru y
check if ((x / size) and 1) xor ((y / size) and 1) = 0 then buffer[x,y] = 0 else buffer[x,y] = 255;
size can be any number but to make the checker tile it has be be a power of 2.. enjoy
-
Good link p01 never seen sierpinski triangle done so small
Va!n the pattern is done on a pixel level but can easily be scaled up by applying it to grid tyles of any size
-
@mind:
great! thanks for sharing the tip! :-)
-
@mind:
great! thanks for sharing the tip! :-)
any place, any time :D when there are textures to be made, the superhero Texture-San saves the day :D