UV Sub-coordinate in polygon

Everything related to 3D programming
User avatar
STARGÅTE
Addict
Addict
Posts: 2266
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: UV Sub-coordinate in polygon

Post by STARGÅTE »

In 3D you need the position of the tiangle (especially the z-depth) and the projection mode, to get you correct u-v-position.
You have it ?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
STARGÅTE
Addict
Addict
Posts: 2266
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: UV Sub-coordinate in polygon

Post by STARGÅTE »

your "coef"s are wrong (so I think).

try this:

Code: Select all

det.f = 1.0 / ( (*B\y-*C\y)*(*A\x-*C\x) - (*B\x-*C\x)*(*A\y-*C\y) )
coefA = ( (*B\y-*C\y)*(*P\x-*C\x) - (*B\x-*C\x)*(*P\y-*C\y) ) * det
coefB = ( (*C\y-*A\y)*(*P\x-*C\x) - (*C\x-*A\x)*(*P\y-*C\y) ) * det
coefC = 1.0 - coefA - coefB
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply