- Home /
Blending textures while using tile textures
TL;DR version: Anybody have a link to a site explaining how to blend textures while using tile texture and uvmap using code at runtime?
Have an object I am creating/uv mapping within unity. Currently just using a diffuse shader for it.
Currently tile 0,0 covers the whole object and on action I change the location of action to tile 0,1 and need to blend the surrounding polys to a blend of both tiles basically setting the alpha to a gradient toward the origin
I am sure I will need to clarify this but pretty much I need to do this: http://wiki.unity3d.com/index.php?title=Blend_2_Textures
but while preferably using standard diffuse shader and tiled textures
I have tried looking up the answer but I either find exactly whats on that wiki or links to how to do it within blender
Because it doesn't feel right asking for coding help without some sort of code
//create verts then calls class that runs:
//tileMod = .03125 (32px on 1024 sheet) bx/by= counters to cycle through cutting a 128x128 sheet up
//zero.x/y = 0.0 - 1.0 origin of block i am currently working on.. lod = level of detail = 2 for these purposes
_t[0] = new Vector2 (zero.x + (tileMod * bx), zero.y + (tileMod*by)+(tileMod*(2f/lod)));
_t[1] = new Vector2 (zero.x + (tileMod * bx)+(tileMod*(2f/lod)), zero.y + (tileMod*by)+(tileMod*(2f/lod)));
_t[2] = new Vector2 (zero.x + (tileMod * bx)+(tileMod*(2f/lod)), zero.y + (tileMod*by));
_t[3] = new Vector2 (zero.x + (tileMod * bx), zero.y + (tileMod*by));
//returns _t
foreach(Vector2 _a in _t){
unModUV.Add(_a);
}
mesh.vertices = unModVerts.ToArray();
mesh.uv = unModUV.ToArray();
mesh.triangles = unModTris.ToArray();
Do not know how helpful that will be but its currently how I apply the texture/uvmap.