Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GeoClipMap and Point Sampling with Linear Interpolation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 15 February 2013 - 11:46 AM

Hi,

 

I just want to check an assumption before I go diving off into code; the standard Vertex Texture Fetch (text2dlod) with "manual" linear interpolation as shown here http://www.catalinzima.com/tutorials/4-uses-of-vtf/terrain-rendering-using-heightmaps/ wont work with a GeoClipMap style of heightmap rendering will it ?

 

I have an initial version which gives very weird results, and I'm attributing it to the fact that the point sampler used in text2dlod is a nearest point sampler, but linear interpolation examples that I've seen for VTF show a simple frac() of the initial texture coords to get the weighting for the neighbour texture pixels.  I think this wont be accurate will it ?; becuase the frac() is carried out on the initial texture coordinates, but the point sampler isn't working on a trunc() basis but a round() basis - if the geometry is fixed to that texture coord then you'd never notice it, but with a GeoClipMap the texture coord is calculated from world space dynamically and constantly changes - which means I get weird jumping artefacts as the camera moves and the vertexes texture coord slides from one pixel to another - suddenly jumping pixels when the rounding point is hit (I presume also that its Bankers Rounding so actually behaves differently for each pixel offset).

 

Can anyone with a geoclipmap implementation tell me if this is the right direction I'm going it, or am I chasing shadows ?

 

Phillip H



Sponsor:

#2 PhillipHamlyn   Members   -  Reputation: 454

Like
1Likes
Like

Posted 18 February 2013 - 01:15 PM

Hi,

 

Just to keep the trail clean, and to answer my own question.

 

Since Point sampling is the only one allowed for a vertex texture fetch (VTF) and it works on nearest point (i.e. round()) not trunc() most examples of manual linear interpolation will not work if the Vertex position moves between frames (such as when you are doing a geoclipmap or other camera-anchored vertexes which then use world oriented data for height lookups or other stuff).

 

Most examples dont really care if the Lerp operation is offset agains the "wrong" pixel in the texture. When you are presenting a camera-anchored vertex buffer then the user will see all sorts of popping and flipping if you dont change the manual linear filter implementation.

 

I haven't tested this thoroughly, but I need to check the actual pixel that is sampled by calculating my texture offset using a trunc() of my initial texture UV * textureSize. I can then safely Lerp() the Frac() of the initial texture UV * textureSize since I know that I have definitely sampled the correct pixel, and not been rounded to the next one (in which case frac() would be useless).

 

I'll post my outcome once I've tested this.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS