

- #UNITY TERRAIN SPLATMAP TEXTURE EDGE BLENDING CODE#
- #UNITY TERRAIN SPLATMAP TEXTURE EDGE BLENDING FREE#
Reference(1,BABYLONX.Helper().Map().Build()) Plan.material = new BABYLONX.ShaderBuilder() fx files.ĭoes it take a tile vale like tile = 4. i can't tell what is going on because of all the shader builder and dynamic string building as apposed to separate vertex and fragment. but if it is it is noticeable than the fract() version. i can't tell if there is border problem because the design of the texture. We have this conversation but we don't continue that for find good result any way i am now on custom material That is more mathematical stuff but we can make it like easy function : make new rep Photo from your old PicĤ : find edge uvs and replace that in current I have one way to fix that problem but i don't know that is good or notġ. Vec2 newUvAtlas = vec2(uv_x,uv_y)+vec2(uv_w,uv_h)* fract(vuv*tile) Vec2 newUvAtlas = vec2( mod( vuv.x*tile_x, uv_w ) +uv_x, mod(vuv.y*tile_y ,uv_h)+uv_y ) ') \ // sub Image repeat pixelįloat tile_y = 4. \ // sub Image size pixelįloat tile_x = 4. \ // sub Image size pixelįloat height = 64. \ // sub Image position pixelįloat width = 128. \ // sub Image position pixelįloat top = 384. I dont know about albodo uv but you can convert any uv to atlas uv use with this :įloat left = 128.
#UNITY TERRAIN SPLATMAP TEXTURE EDGE BLENDING CODE#
That what i need help with.Īpplying the uScale and vScale for tile and repeat just like you normally for NON texture atlas:īasically convert this code to use Texture Atlas with tiling support: i guess it shout be already calculated into newUV. So i MUST not supposed to APPLY scale at that line of code anymore. show the other texture from texture atlas that above 1.0. but the real problem is when i try to multiply the newUV with albedoScale like i was doing for NON texture atlas version.

SurfaceAlbedo = texture2D(albedoSampler, newUV * albedoScale + uvOffset) Vec2 newUV = vec2((vAlbedoUV.x * splatmapRect1.w) + splatmapRect1.x, (vAlbedoUV.y * splatmapRect1.z) + splatmapRect1.y)
#UNITY TERRAIN SPLATMAP TEXTURE EDGE BLENDING FREE#
I also send a free uniforms to hold the rect info for the texture within the texture atlas

Now i have PACKED all my textures into an atlas and assign to albedoSampler. So the texture would get 'tiled or repeated' SurfaceAlbedo = texture2D(albedoSampler, vAlbedoUV * albedoScale + uvOffset) ĪlbedoScale might contain a value like vec2(5.0, 5.0). To make my terrain textures scale or tile or repeat or whatever you call it was this:

Using albedo WITHOUT texture atlas i would use 'albedoScale' which is a vec2 with the texture.uScale and texture.vScale just like in per material. Pinging This goes out to you guys as well. I have been working on this for weeks now and i can't seem to figure this last bit of scaling/tiling the actuals splats and normals are encoded to the regular Albedo and Bump texture from the PBR Materials. got working except for applying scale like shown above. TextureAtlas is perfect, can do all of texture now with just 1 additional texture to the PBR pipeline.SPLATMAP TEXTURE. So your browser would need at least 32 for the MAX_TEXTURE_IMAGE_UNITS (which are 16 on most browsers and 8 on iOS) for a fully loaded splatmap. Thats 28 ADDITIONAL texture i would have to load into my splatmap shader (on top of the standard PBR textures. Otherwise i have to go back to using operate textures for each terrain splatmap (up to 4) and each texture splat (up to 12) and each normal splat (up to 12). How can i offset the scale or limit the region the texture() function uses so it can REPEAT the section from texture atlas. SurfaceAlbedo = atlas1Color * baseColor1.r Vec4 atlas1Color = texture2D(albedoSampler, atlas1UV * atlas1Scale + uvOffset) Vec2 atlas1Scale = vec2(atlasInfo1.x, atlasInfo1.y) Vec2 atlas1UV = vec2((vTerrainUV.x * atlasRect1.w) + atlasRect1.x, (vTerrainUV.y * atlasRect1.z) + atlasRect1.y) WORKS except when i need scale or tiling: This is the followingg snippet to get splat 1. But using a texture atlas going outside the 0 to 1 by multiplying uvcoord * scaleTile causes the texture() function to return the OTHER parts of the splats. Now i assume the default way openGL texture() function works is anything outside the 0 - 1 for uv causes the texture2D to 'REPEAT' the texture giving use tiling. So atlasScale might be something like vec2(5,5) I also have a vec2 (atlas1Scale) that is the texture offset/tiling I have a vec4 (atlas1UV) containing the rectangle of the texture within the texture atlas (x, y, height, width). This is how i am having main UV coord offset for texture atlas: Yo I am having trouble with apply terrain texture atlas tiling (texture.uScale and texture.vScale) at the shader for texture atlas.
