OpenGl Terrain blend seams

Materials, textures, lighting, postfx
24 posts Page 1 of 3
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
by koros » Fri May 29, 2015 8:00 pm
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.1
Tested with Torque v3.6.3 and 3.7 Release

Solution / 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 here
https://github.com/GarageGames/Torque3D/issues/1318

Image

Image

Image
Duion
Posts: 966
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Fri May 29, 2015 10:17 pm
How does it look with a normal terrain material with all layers enabled?
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
  by koros » Sat May 30, 2015 12:27 am
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.glsl
uv += 0.00195;

Hope this helps
:)
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
by koros » Sat May 30, 2015 1:13 am
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
:)
Duion
Posts: 966
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Sat May 30, 2015 3:02 am
I mean using all layers, at least base and detail texture.
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
by koros » Sat May 30, 2015 6:30 am
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
Duion
Posts: 966
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Sat May 30, 2015 11:24 am
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.
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
by koros » Sat May 30, 2015 5:16 pm
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.glsl

A few more pics might help clarify this. I should probably do a video.

OpenGl
Image

Image

Image

Image

D3D9
Image

Image



Terrain.glsl

Code: Select all

//----------------------------------------------------------------------------- // 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 ... se-3.7.zip
It 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
Duion
Posts: 966
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Sun May 31, 2015 1:41 am
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.
koros
Posts: 46
Joined: Thu Apr 09, 2015 2:54 am
by koros » Sun May 31, 2015 4:47 am
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 :)
24 posts Page 1 of 3

Who is online

Users browsing this forum: No registered users and 3 guests