texture generator
Author |
Message |
zylum
|
Posted: Sun Feb 22, 2004 8:35 pm Post subject: texture generator |
|
|
here's a texture generator that i made... it basically looks at previous pixels and rounds them and then changes that color a small amout to create a texture...
code: |
setscreen ("graphics:400;400")
const minClr := 16
const maxClr := 30
const smooth := 1
var clr : int := Rand.Int (minClr, maxClr)
for x : 1 .. maxx
clr += Rand.Int (-smooth, smooth)
clr := min (maxClr, max (clr, minClr))
drawdot (x, 1, clr)
end for
for y : 2 .. maxy
for x : 1 .. maxx
if x = 1 then
clr := whatdotcolor (x, y - 1)
elsif x = maxx then
clr := round ((max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x - 1, y - 1), minClr)) / 3)
else
clr := round ((max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x - 1, y - 1), minClr)) / 3)
end if
clr += Rand.Int (-smooth, smooth)
clr := max (minClr, min (clr, maxClr))
drawdot (x, y, clr)
end for
end for
|
-zylum |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Paul
|
Posted: Sun Feb 22, 2004 8:43 pm Post subject: (No subject) |
|
|
Funky , at first it looks like a closeup of a tree, then if you change the max and min colors it looks great, like all neonish and stuff. |
|
|
|
|
|
Delos
|
Posted: Sun Feb 22, 2004 8:53 pm Post subject: (No subject) |
|
|
Wow...that's awsome. Really! |
|
|
|
|
|
Catalyst
|
Posted: Sun Feb 22, 2004 9:09 pm Post subject: (No subject) |
|
|
great job
have 25 bits |
|
|
|
|
|
Tony
|
|
|
|
|
jonos
|
Posted: Mon Feb 23, 2004 7:32 am Post subject: (No subject) |
|
|
another awesome one from zylum!!! you should start c or blitz, you would do really well. |
|
|
|
|
|
zylum
|
Posted: Mon Feb 23, 2004 4:54 pm Post subject: (No subject) |
|
|
i was tinkering around with it and came up with this (not much different) :
code: |
setscreen ("graphics:300;100")
var minClr := 61
var maxClr := 103
var contrast := 0.55
put "what is the smallest colour?"
get minClr
put "what is the largest colour?"
get maxClr
put "what is the contrast? (>=0)"
get contrast
setscreen ("graphics:100;100")
var clr : real := Rand.Int (minClr, maxClr)
for x : 1 .. maxx
clr += Rand.Real * (2 * contrast) - contrast
clr := min (maxClr, max (clr, minClr))
drawdot (x, 1, round (clr))
end for
loop
for y : 2 .. maxy
for x : 1 .. maxx
if x = 1 then
clr := (whatdotcolor (x, y - 1) + whatdotcolor (x + 1, y - 1)) / 2
elsif x = maxx then
clr := (max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x - 1, y), minClr) + max (whatdotcolor (x - 1, y - 1), minClr)) / 3
else
clr := (max (whatdotcolor (x - 1, y), minClr) + max (whatdotcolor (x, y - 1), minClr) + max (whatdotcolor (x + 1, y - 1), minClr) + max (whatdotcolor (x - 1, y - 1), minClr)) / 4
end if
clr += Rand.Real * (2 * contrast) - contrast
clr := max (minClr, min (clr, maxClr))
drawdot (x, y, round (clr))
end for
end for
end loop
|
the contrast value can now be a real number rather than just an integer... also, the program loops and slightly changes each time
- zylum |
|
|
|
|
|
alikhan
|
Posted: Wed May 12, 2004 6:50 pm Post subject: (No subject) |
|
|
i dunno i like the first one a bit better, but maybe its cuz i dunt no how to use the second one pretty cool both of them though |
|
|
|
|
|
Sponsor Sponsor
|
|
|
MyPistolsIn3D
|
Posted: Sat May 15, 2004 1:21 pm Post subject: (No subject) |
|
|
Looks great, but any practical use? |
|
|
|
|
|
Paul
|
Posted: Sat May 15, 2004 1:23 pm Post subject: (No subject) |
|
|
MyPistolsIn3D wrote: Looks great, but any practical use?
yes it creates textures. |
|
|
|
|
|
|
|