Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

###My Task I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this questionthis question to get a image of it how it's working ).

###My Approach I want to interpolate the height of two points by using the normal of them. To do this i need the tangent of both. When having the tangents i want to interpolate this way:

float resultHeight = Interpolate(TangentVector0, TangentVector1, 0.5f);

public float Interpolate(float p0, float p1, float amount)
{
    amount = Math.Sin(x* Math.PI - Math.PI/2) / 2 + 0.5;
    // Move vectors along tangents
    p0 = p0 * (amount - 1f);
    p1 = p1 * amount;
    return (p0 + p1) / 2f;
}

###Problem ( Question ) I'm a little bit stuck with the math behind. How to i get the tangent of the x or z axis when having a 3D normal.

###My Task I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this question to get a image of it how it's working ).

###My Approach I want to interpolate the height of two points by using the normal of them. To do this i need the tangent of both. When having the tangents i want to interpolate this way:

float resultHeight = Interpolate(TangentVector0, TangentVector1, 0.5f);

public float Interpolate(float p0, float p1, float amount)
{
    amount = Math.Sin(x* Math.PI - Math.PI/2) / 2 + 0.5;
    // Move vectors along tangents
    p0 = p0 * (amount - 1f);
    p1 = p1 * amount;
    return (p0 + p1) / 2f;
}

###Problem ( Question ) I'm a little bit stuck with the math behind. How to i get the tangent of the x or z axis when having a 3D normal.

###My Task I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this question to get a image of it how it's working ).

###My Approach I want to interpolate the height of two points by using the normal of them. To do this i need the tangent of both. When having the tangents i want to interpolate this way:

float resultHeight = Interpolate(TangentVector0, TangentVector1, 0.5f);

public float Interpolate(float p0, float p1, float amount)
{
    amount = Math.Sin(x* Math.PI - Math.PI/2) / 2 + 0.5;
    // Move vectors along tangents
    p0 = p0 * (amount - 1f);
    p1 = p1 * amount;
    return (p0 + p1) / 2f;
}

###Problem ( Question ) I'm a little bit stuck with the math behind. How to i get the tangent of the x or z axis when having a 3D normal.

Interpolate heighmap How to interpolate a height-map with normals

Tweeted twitter.com/#!/StackGameDev/status/166710192304685056
Source Link

Interpolate heighmap with normals

###My Task I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this question to get a image of it how it's working ).

###My Approach I want to interpolate the height of two points by using the normal of them. To do this i need the tangent of both. When having the tangents i want to interpolate this way:

float resultHeight = Interpolate(TangentVector0, TangentVector1, 0.5f);

public float Interpolate(float p0, float p1, float amount)
{
    amount = Math.Sin(x* Math.PI - Math.PI/2) / 2 + 0.5;
    // Move vectors along tangents
    p0 = p0 * (amount - 1f);
    p1 = p1 * amount;
    return (p0 + p1) / 2f;
}

###Problem ( Question ) I'm a little bit stuck with the math behind. How to i get the tangent of the x or z axis when having a 3D normal.