• Welcome to Dark Bit Factory & Gravity.
 

Looking for texture algorithm.

Started by b0ib0t, January 30, 2008

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

b0ib0t

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.

va!n

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

- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

b0ib0t

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

Shockwave

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)
Shockwave ^ Codigos
Challenge Trophies Won:

relsoft

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!
Challenge Trophies Won:

mind

for x = 0 to texture.width
for y = 0 to texture.height
  {
    plot x XOR y;
  }

done :D
Challenge Trophies Won:

rain_storm

'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

Challenge Trophies Won:

Jim

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
Challenge Trophies Won:

p01


va!n

Quote from: rain_storm on January 31, 2008
'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.
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Jim

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
Challenge Trophies Won:

taj

I would go with the advice to NEVER use that texture. You _will_ get flamed. Even at 256b its risky.
Challenge Trophies Won:

mind

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
Challenge Trophies Won:

rain_storm

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

Challenge Trophies Won:

va!n

@mind:
great! thanks for sharing the tip! :-)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

mind

Quote from: va!n on February 01, 2008
@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
Challenge Trophies Won: