![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Apr 2009
Location: UK
Posts: 16
![]() |
Hi
I am using a fragment shader (below) to create a greyscale earth, but it's causing a problem with some tiles (see screenshot). Looks like the its sometimes using the texture coordinates from the neighbouring tile for some reason. Anyone had this problem or know how to solve it? Note the tiles are rendered correctly if I disable the shader. Thanks Code:
uniform sampler2D testTexture;
void main( void )
{
vec4 texelColor = texture2D( testTexture, gl_TexCoord[0].xy );
vec4 greyWeights = vec4(0.3, 0.59, 0.11, 1.0);
vec4 scaledColor = texelColor * greyWeights;
float luminance = scaledColor.r + scaledColor.g + scaledColor.b;
gl_FragColor = vec4( luminance, luminance, luminance, texelColor.a );
}
Last edited by jwheeler; 08-16-2010 at 02:37 PM. Reason: Clarification |
|
|
|
|
|
#2 |
|
weekend warrior
Join Date: May 2008
Posts: 95
![]() |
I'm not saying that this is your problem, but I have seen similar behavior on 'vanilla world' wind setups where the terrain data has become corrupted or when graphics driver updates are needed. You might trying deleting all of your elevation data and/or updating graphics drivers. It might just help
![]() |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2007
Posts: 218
![]() |
"Normal" World Wind rendering uses an alpha mask texture (through multi-texture rendering) so that it only renders the portion of the surface tile which is covered by the texture. That's how it combines several different textures of various sizes together to cover a tile.
Once you use a shader, you no longer necessarily benefit from the alpha masking which all takes place in the fixed-function pipeline. So in your fragment shader, you need to discard any pixes for texture coords less than 0 or greater than 1. Something like: if (gl_TexCoord[0].s < 0 || gl_TexCoord[0].s > 1) discard; if (gl_TexCoord[0].t < 0 || gl_TexCoord[0].t > 1) discard; |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jan 2008
Location: Huntsville, AL
Posts: 24
![]() |
I just came across this posting and it fixed an issue have been having since upgrading WWJ this week.. I had been using the version of world wind java from about May 2010, and it worked fine with my shader. I upgraded this week to the newest world wind java and started getting the same incorrectly rendered tile. Adding those 2 lines to my shader fixed the issue. Thanks.
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Normal mapping (GLSL shader) | Omega | Feature Discussion | 12 | 09-11-2011 10:53 PM |
| Updating GLSL support with new JOGL | what_nick | Development Help | 7 | 09-28-2010 10:35 AM |
| Custom terrain tile visibility/altitude problem | Peter Skvarenina | Development Help | 6 | 02-26-2010 10:55 PM |
| GLSL Shader support that renders tiles correctly | tve | Development Help | 7 | 09-09-2009 08:53 AM |
| Problem with terrain and its modification | bako | Development Help | 1 | 02-23-2009 05:35 PM |