• Create Account

#ActualSuperVGA

Posted 08 January 2013 - 04:28 AM

I'm sorry I don't have time to dive into your code right now, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a right-angled triangle is 0.5h*b)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA) is
area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
(the surrounding triangle) / (the opposing triangle to the triangle-point in question (here: A))

A.y*wA + B.y * wB + C.y * wC
to get the resulting P.y.

#5SuperVGA

Posted 08 January 2013 - 04:28 AM

I'm sorry I don't have time to dive into your code right now, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a right-angled triangle is 0.5h*b)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA) is
area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
(the surrounding triangle) / (the opposing triangle to the triangle-point in question (here: A))

A.y*wA + B.y * wB + C.y * wC
to get the resulting P.y.

#4SuperVGA

Posted 08 January 2013 - 04:27 AM

I'm sorry I don't have time to dive into your code right now, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a rect triangle is 0.5h*g)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA) is
area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
(the surrounding triangle)(the opposing triangle to the triangle-point in question (here: A))
A.y*wA + B.y * wB + C.y * wC
to get the resulting P.y.

#3SuperVGA

Posted 08 January 2013 - 12:48 AM

I'm sorry I don't have time to dive into your code right now, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a rect triangle is 0.5h*g)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA) is
area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
(the opposing triangle)
A.y*wA + B.y * wB + C.y * wC
to get the resulting P.y.

#2SuperVGA

Posted 08 January 2013 - 12:47 AM

I'm sorry I don't have time to dive into your code right bow, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a rect triangle is 0.5h*g)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA) is
area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
(the opposing triangle)
A.y*wA + B.y * wB + C.y * wC
to get the resulting P.y.

#1SuperVGA

Posted 08 January 2013 - 12:45 AM

I'm sorry I don't have time to dive into your code right bow, but I suggest, if you have further trouble making it work,
That you base the y value on the result of a concept called "Barycentric Coordinates". If you're using a grid of quads,
it's easy to compute. (Given that the area of a rect triangle is 0.5h*g)

It revolves around weighted coords of the triangle (A, B, C) that currently surround your camera (P).
Basically, the weight of A (wA).is area(B.xz, P.xz, C.xz) / area(B.xz, A.xz, C.xz)
So you can add together A.y*wA + B.y * wB + C.y * wC to get the resulting P.y.

PARTNERS