MackeyK24 Posted April 8, 2017 Share Posted April 8, 2017 Yo @Deltakosh ... I am having trouble with apply terrain texture atlas tiling (texture.uScale and texture.vScale) at the shader for texture atlas... This is how i am having main UV coord offset for texture atlas: I have a vec4 (atlas1UV) containing the rectangle of the texture within the texture atlas (x, y, height, width). I also have a vec2 (atlas1Scale) that is the texture offset/tiling so atlasScale might be something like vec2(5,5) 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... 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... This is the followingg snippet to get splat 1... WORKS except when i need scale or tiling: vec2 atlas1UV = vec2((vTerrainUV.x * atlasRect1.w) + atlasRect1.x, (vTerrainUV.y * atlasRect1.z) + atlasRect1.y); vec2 atlas1Scale = vec2(atlasInfo1.x, atlasInfo1.y); vec4 atlas1Color = texture2D(albedoSampler, atlas1UV * atlas1Scale + uvOffset); surfaceAlbedo = atlas1Color * baseColor1.r; How can i offset the scale or limit the region the texture() function uses so it can REPEAT the section from texture atlas... Or something like that... Anything... 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)... Thats 28 ADDITIONAL texture i would have to load into my splatmap shader (on top of the standard PBR textures ... if being used.. light light maps and reflection) 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. TextureAtlas is perfect, can do all of texture now with just 1 additional texture to the PBR pipeline...SPLATMAP TEXTURE... 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... Please.... Any help... I have been working on this for weeks now and i can't seem to figure this last bit of scaling/tiling Pinging @Sebavan and @RaananW and @Wingnut ... This goes out to you guys as well. My current shader code: Terrain_Splatmap.fragment.fx Terrain_Splatmap.vertex.fx Please take a look at Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.