uv tilings -> instant dirt

   3304   0   0
User Avatar
Member
401 posts
Joined:
Offline
I am not a fan of cross postings but I really like to know how to address this issue:

How to tile textures in vex?
How bad is using colormap() instead of texture()?

I know I can use:
s * freq % 1
to tile/repeat a texture.
But this creates shadow-sandwichs-of the texture between the tiles
I was told to get rid of the % as texture can repeat.

Ok. but now this:

The following shader reads a random 100x100 tile from a texture (500x100px).
(it doesn't matter if the tile is ^2 - I already tried this - might be faster but doesn't remove the dirt)

the dirt disappears if I use colormap() instead of texture() - but I am not sure what the difference is. As setting the filter width of texture to 0 gives me the same result.
Both look like aliasing-hell.

surface
dirty( string map = “$HIP/../tex/letters.rat”; // Name of the map
string wrap = “repeat”;

vector uv=0; // Texture coordinates
vector Cd=1;
float ntiles = 5;
float cells = 3;
)
{
float ss, tt, ssa, tta, ssb, ttb, me;
vector dclr;

// some color
dclr = 1;

if (map != “”)
{
// uv or st
if (isbound(“uv”))
{
ss = uv.x;
tt = uv.y;
}
else
{
ss = s;
tt = t;
}
// repeat over ss and tt


ssa = (ss * cells) % 1;
tta = (tt * cells) % 1;
// number each cell
ssb = floor(ss * cells);
ttb = floor(tt * cells);
me = ssb * ttb + ssb;

dclr = texture(map, ssa / ntiles + (1/ntiles) * floor(ntiles * random(me * 10.01)), tta, “wrap”, wrap);
}
Cf = dclr;
}


I am sure there is a simple explanation for this.
All those hours of empiric studies led to nothing.
Please help - I really don't understand it.

Georg

http://forums.odforce.net/index.php?s=&showtopic=6990&view=findpost&p=46946 [forums.odforce.net]

Attachments:
tiledirt.tar.gz (51.8 KB)
still_dirty.jpg (15.7 KB)

this is not a science fair.
  • Quick Links