Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualWilhelm van Huyssteen

Posted 13 June 2012 - 06:59 AM

hmmm

maybe this is a little expensive Im not sure but you could just change the colour of the fragment based on the final world position of the pixel. I wasnt able to download your attached image. In the future you should convert it to a jpeg (since its much smaller) and include it in the post itself so im only geussing this is what you want.

So lets say the map extends along the x and y coords you can have something like this in your fragment shader to create grid like lines on your terrain. Best have a seperate shader for your terrain.

if (fragmentPosition.x%20<1 || fragmentPosition.y%20<1) //fragmentPosition is a varraying variable that passes the final vertex position to the fragment shader.
{
  finalColor = vec4(0,0,0,1) //black
}
else
{
  finalColor  = whatever else it would have been normaly.
}

This would create a solid black line on the terrain every 20 units on both the x and y axis.

#2Wilhelm van Huyssteen

Posted 13 June 2012 - 06:59 AM

hmmm

maybe this is a little expensive Im not sure but you could just change the colour of the fragment based on the final world position of the pixel. I wasnt able to download your attached image. In the future you should convert it to a jpeg (since its much smaller) and include it in the post itself so im only geussing this is what you want.

So lets say the map extends along the x and y coords you can have something like this in your fragment shader to create grid like lines on your terrain. Best have a seperate shader for your terrain.

if (fragmentPosition.x%20<1 || fragmentPosition.y%20<1) //fragmentPosition is a varraying variable that passes the final vertex position to the fragment shader.
{
  finalColor = vec4(0,0,0,1) //black
}
else
{
  finalColor  = whatever else it would have been normaly.
}

This would create a solid black line on the terrain every 20 units on both the x and y axis.

#1Wilhelm van Huyssteen

Posted 13 June 2012 - 06:58 AM

hmmm

maybe this is a little expensive Im not sure but you could just change the colour of the fragment based on the final world position of the pixel.

I wasnt able to download your attached image. In the future you should convert it to a jpeg (since its much smaller) and include it in the post itself so im only geussing this is what you want.

So lets say the map extends along the x and y coords you can have something like this in your fragment shader to create grid like lines on your terrain. Best have a seperate shader for your terrain.

if (fragmentPosition.x%20<1 || fragmentPosition.y%20<1) //fragmentPosition is a varraying variable that passes the final vertex position to the fragment shader.
{
  finalColor = vec4(0,0,0,1) //black
}
else
{
  finalColor  = whatever else it would have been normaly.
}

This would create a solid black line on the terrain every 20 units on both the x and y axis.

PARTNERS