last day (15 days later) » 

7:51 PM
3
A: How do you find the Y position of a point between four vertices? HLSL

ArdaBecause your 4 vertices may not be on a plane, you should consider each triangle separately. First find the triangle that the point resides in, and then use the following StackOverflow discussion to solve for the Z value. I personally like DanielKO's answer much better, but the accepted answer sh...

 
Ok, I have looked at both answers and will try to implement one
 
Let me know if you need help with either.
 
I'm trying to follow DanielKO's answer but I am just having an issue determining if the point is within one triangle or the other. How can I do this? I have a point and a normal for each triangle. float3 p1 = tile[0]; float3 n1 = (tile[2] - p1) * (tile[1] - p1); float3 p2 = tile[3]; float3 n2 = (tile[2] - p2) * (tile[1] - p2);
 
Because that's a well known problem, there should be lots of articles on it. Here's a good one from google search: blackpawn.com/texts/pointinpoly
By the way, it sounds like you already know what tile the point is in. Are your tiles rectangular on the xy plane? If they are, you can do a much faster/easier check than the two described in the article to find the triangular half the point is in.
 
I have tried following the info on the links but I'm not doing something right. Updated the question with what I've tried
 
7:52 PM
Are your tiles rectangular on the horizontal plane? If they are, you can skip Barycentric coordinates altogether and use a much simpler technique. Let me know and I'll explain.
 
 
1 hour later…
9:16 PM
Yes, they'll always be a square shape on the x,z axis but with different y coordinates
 
10:07 PM
Squares are even easier. I've updated my answer to address the "which triangle is the point in" issue too.
 
 
1 hour later…
11:14 PM
Ok, that makes sense, don't know how I hadn't figured that out. Now I just need to fix the actual height finding part, it looks like it's nearly working but it's still acting strange on bumpy terrain, where it is flatter the points seem to be nearly on the mark.
 

  last day (15 days later) »