koros Posted May 29, 2015 Share Posted May 29, 2015 Terrain texture seams at blend edges with 2+ texture layers only in OpenGl.Occurs when using any detail texture and seems independent of square size, resolutions, base texture size etc.Only tested on AMD Radeon HD7700 + updated drivers.Win 8.1Tested with Torque v3.6.3 and 3.7 ReleaseSolution / workaround: In game\shaders\common\terrain\terrain.glsl uv += 0.00195;vec2 xy = floor( uv );Anyone else see this issue? Can anyone test this on Nvidia? :) Did a search here and on Github, sorry if I missed an existing issue. I did see something about new terrain blending perhaps soon, not sure how this might affect it.Opened a Github issue herehttps://github.com/GarageGames/Torque3D/issues/1318http://i1260.photobucket.com/albums/ii567/aurobooth/seam3_zpsu1ggaooc.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/seam4_zpsimzg5c2l.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/seam2_zpsebmdl4pg.png Quote Link to comment Share on other sites More sharing options...
Duion Posted May 29, 2015 Share Posted May 29, 2015 How does it look with a normal terrain material with all layers enabled? Quote Link to comment Share on other sites More sharing options...
koros Posted May 29, 2015 Author Share Posted May 29, 2015 Normal terrain material? Do you mean D3D9? or just texture layers without a detail texture?No seams show without at least one detail texture. Seams don't show at all under D3D9.The pics show the result when running under OpenGl and using at least one detail texture. Just for clarity the pics are before adding the offset to uv in game\shaders\common\terrain\terrain.glsluv += 0.00195;Hope this helps :) Quote Link to comment Share on other sites More sharing options...
koros Posted May 29, 2015 Author Share Posted May 29, 2015 Also just want to make sure that this is not perceived as a complaint! Torque3D and the work everyone has done rocks! PBR, OpenGl, Linux and all the bug fixes... thats why I am checking it out again. Just trying to do my part.Cheers :) Quote Link to comment Share on other sites More sharing options...
Duion Posted May 30, 2015 Share Posted May 30, 2015 I mean using all layers, at least base and detail texture. Quote Link to comment Share on other sites More sharing options...
koros Posted May 30, 2015 Author Share Posted May 30, 2015 That's what was done. Base+detail, Another texture+detail etc. When using a detail texture with any of the layers the seams show under OpenGl. Adding the offset I mentioned eliminates the seams, at least for my card.Please try it, especially if you have an Nvidia card, and post pics of your results. :) Cheers Quote Link to comment Share on other sites More sharing options...
Duion Posted May 30, 2015 Share Posted May 30, 2015 The point is just that this does not look like a terrain material with detail texture to me, it is just a base texture with nothing else.I can remember another guy having problems with the terrain, but the issue was just that he used wrong settings in the terrain and materials. Quote Link to comment Share on other sites More sharing options...
koros Posted May 30, 2015 Author Share Posted May 30, 2015 It is a terrain with a base texture + detail texture and a second texture + detail texture, all stock Torque3D textures.It is zoomed in to show the seams and it looks blurry. The seams go away with the offset added to uv in terrain.glslA few more pics might help clarify this. I should probably do a video.OpenGlhttp://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamsFourmPost2_zpsfb7kg6qk.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamForumPost3_zpsp3ymafgq.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamsFourmPost4_zpstvkxlly1.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamsForumPost5_zps50kuntlp.pngD3D9http://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamsFourmPost6_zpsednwtzwu.pnghttp://i1260.photobucket.com/albums/ii567/aurobooth/NewSeamsFourmPost7_zpsgzm4mqjy.pngTerrain.glsl//----------------------------------------------------------------------------- // Copyright (c) 2012 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- float calcBlend( float texId, vec2 layerCoord, float layerSize, vec4 layerSample ) { // This is here to disable the blend if none of // the neighbors equal the current id. // // We depend on the input layer samples being // rounded to the correct integer ids. // vec4 diff = clamp( abs( layerSample - texId ), 0.0, 1.0 ); float noBlend = float(any( bvec4(1 - diff) )); // match the current texture id. vec4 factors = vec4(0); for(int i = 0; i < 4; i++) factors[i] = (layerSample[i] == texId) ? 1 : 0; // workaround for Intel // This is a custom bilinear filter. vec2 uv = layerCoord * layerSize; //uv += 0.00195; //Adding this offset = 0.00195 eliminate seams vec2 xy = floor( uv ); vec2 ratio = uv - xy; vec2 opposite = 1 - ratio; float blend = ( factors.b * opposite.x + factors.g * ratio.x ) * opposite.y + ( factors.r * opposite.x + factors.a * ratio.x ) * ratio.y; return noBlend * blend; } If it was just settings that would be great!Any way you could pull down the 3.7 release zip and confirm this? https://github.com/GarageGames/Torque3D/archive/release-3.7.zipIt would be helpful if you could verify this with an OpenGl project and post some pics! Hope this helps clarify a bit. Appreciate the help.Cheers :D Quote Link to comment Share on other sites More sharing options...
Duion Posted May 30, 2015 Share Posted May 30, 2015 I have a Linux version with openGL and it does not have the seams, but the terrain textures are all wrong there also but a different issue.But I cannot help you there, I don't understand much of this. Quote Link to comment Share on other sites More sharing options...
koros Posted May 31, 2015 Author Share Posted May 31, 2015 I have a Linux version with openGL and it does not have the seams, but the terrain textures are all wrong there also but a different issue.But I cannot help you there, I don't understand much of this. No problem. :) It's solved for me actually. :D Guessing it's an issue, precision maybe, at least on my OpenGl implementation, with floor().Took me longer than it should have to find it but it was a good intro course on Torque3D for me and a bit of a refresher on glsl. Maybe while I'm here I'll fire up a vm and install some flavor of linux.Crossplatform is part of what caught my eye when I was checking out Torque3D again and I want linux too :) Quote Link to comment Share on other sites More sharing options...
rlranft Posted May 31, 2015 Share Posted May 31, 2015 There are bound to be little tweaks like this that come to light - OpenGL was dropped a while back and is just now making its way back in. And in that gap the terrain system changed - twice.It's probably going to come down to little fiddling differences between drivers, but I hope not. Quote Link to comment Share on other sites More sharing options...
koros Posted June 1, 2015 Author Share Posted June 1, 2015 There are bound to be little tweaks like this that come to light - OpenGL was dropped a while back and is just now making its way back in. And in that gap the terrain system changed - twice.It's probably going to come down to little fiddling differences between drivers, but I hope not. /agreeUnity has a 200+ page bug list, UE4 has issues and I don't mind getting my hands dirty for Torque3D.Seams are solved for my project though. OpenGl works great for me on Win8.1. Can't wait to fire up a vm and test Linux.The seams were the only thing that cropped up and I finally fixed that. :D I am happy as long as I can craft a solution or workaround for an issue.Whether the uv offset is a solution or just a workaround, that's for the real devs here to decide :D Quote Link to comment Share on other sites More sharing options...
rlranft Posted June 4, 2015 Share Posted June 4, 2015 It's a good catch, anyway - T3D has been run on Mac and a few flavors of Ubuntu and this is the first I've heard of this issue since it was fixed in the DirectX version. I suppose my point was that it is important to compare detailed notes between cases so someone can eventually track down the cause and the final solution (even if the final solution is just the uv tweak). Quote Link to comment Share on other sites More sharing options...
koros Posted June 6, 2015 Author Share Posted June 6, 2015 ... I suppose my point was that it is important to compare detailed notes between cases so someone can eventually track down the cause and the final solution (even if the final solution is just the uv tweak). Absolutely. The crew here is obviously working hard and I plan to help where I can with my limited Torque skills.Appreciate the feedback too! :D Quote Link to comment Share on other sites More sharing options...
Azaezel Posted September 10, 2015 Share Posted September 10, 2015 How'd you derive 0.00195? Quote Link to comment Share on other sites More sharing options...
koros Posted September 10, 2015 Author Share Posted September 10, 2015 I'd love to be able to claim I derived it but then I had no idea how Torque textured the terrain. Spent some time playing with shader gen locked down and just squeezing various values into ranges in the shaders, coloring sections, using discard until I made some sense of it. Noticed that number along the way.Looking for my notes, been a while.Stop laughing! :D Quote Link to comment Share on other sites More sharing options...
koros Posted September 10, 2015 Author Share Posted September 10, 2015 Mucked with asst. stuff in generated pixel shaders where the terrain detail blending was being done. Playing with tex coords etc.Some of the files14333febc477acdf_P.glsl blendP.glslterrain.glslDoing stuff like this to visualize the lines if( (detailBlend0 < 1.0) && (detailBlend1 < 1.0) ) {...}or this//auro uv values range: 64 to 128 //if( ( (uv.x <65.0) || (uv.y <65.0) ) || ( (uv.x >127.0) || (uv.y >127.0) ) ) // square perimeter //{ //discard; //} I was just getting started with Torque and has been years since I touched a shader. :oops: Quote Link to comment Share on other sites More sharing options...
Azaezel Posted September 10, 2015 Share Posted September 10, 2015 Thing to remember about shaders, and particularly uvs, is 9999999.99999% of the math is gonna be in percentages, so that 0.00195 may be right when applied to the default tiling setup, but odds are it'll need adjusting for different scales. Make sense? Quote Link to comment Share on other sites More sharing options...
koros Posted September 10, 2015 Author Share Posted September 10, 2015 Thing to remember about shaders, and particularly uvs, is 9999999.99999% of the math is gonna be in percentages, so that 0.00195 may be right when applied to the default tiling setup, but odds are it'll need adjusting for different scales. Make sense? Yep! Thx :) Just so I don't think I'm nuts here are you able to reproduce this? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted September 10, 2015 Share Posted September 10, 2015 Afraid not, it's why I've gotta stick to giving principle-based advice on this one. Quote Link to comment Share on other sites More sharing options...
koros Posted September 10, 2015 Author Share Posted September 10, 2015 I might have to go buy an Nvidia card so I can sleep at night :D Quote Link to comment Share on other sites More sharing options...
Azaezel Posted September 10, 2015 Share Posted September 10, 2015 Trust me, at that point you're just going "crap, what *else* might crop up for potential customers for my games am I'm missing" :P. So, fiddling with either of http://i.imgur.com/dRyPJIc.jpg have any impact on your end? Quote Link to comment Share on other sites More sharing options...
koros Posted September 10, 2015 Author Share Posted September 10, 2015 Trust me, at that point you're just going "crap, what *else* might crop up for potential customers for my games am I'm missing" :P. So, fiddling with either of http://i.imgur.com/dRyPJIc.jpg have any impact on your end? I honestly tried every combo of settings and formats for the textures I could think of including using alpha decals.It could very well be that it's a single card/driver combo and in the proud tradition of broken clocks and blind squirrels I stumbled across the solution for my card. If no one else can repro then it's not really an issue :D I'll revisit this when I get an Nvidia card.Sorry for the wild goose chase. :oops: Quote Link to comment Share on other sites More sharing options...
JeffR Posted September 11, 2015 Share Posted September 11, 2015 I didn't get to it today(trying to get ubuntu beaten into submission) but tomorrow I plan to use the other comp in the house to test, as it has an AMD card. See if I can reliably repo it there.I'll keep ya posted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.