Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Texel to UV Map

Author
Message
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 24th May 2017 08:41
Hi all,

There is a way to convert a texel position from a mesh to the uv map ?

Like "GetScreenXFrom3D()" but for uv map.

Thanks for the help.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th May 2017 11:55 Edited at: 24th May 2017 11:58
you will write a painting tool?

some interesting commands
CreateMemblockFromObjectMesh
GetMeshMemblockVertexU
GetMeshMemblockVertexV
GetMeshMemblockVertexX
GetMeshMemblockVertexY
GetMeshMemblockVertexZ
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 24th May 2017 22:49
Exactly !

I am currently in in 3D Game Arts in a school in Geneva for a Bachlor, and i need to write somting about videogames... I have one year to make somting. I want to make a software (not a game for this time...^^) And i want to make it with AGK.
I think that a paint tool ""like"" Quixel or Substance may be fun to make.

Thanks for the help Markus. I gona check this closer.

Cheers.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th May 2017 00:22
oh that need some good vector math understanding.
the vertices have uv coords but the fill region is interpolated.
see how you know is a point inside a triangle or not, that needs some transform into |_ and the len of a and b is normalized to 1.
uv's are easy to understand its same as x,y 0 is left and 1 is right or 0 is top and 1 is bottom in a square image.






AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th May 2017 13:41 Edited at: 25th May 2017 13:41
Thats interesting,

You might need to find the triangle that you are drawing to.
You could iterate through all of the models triangles and ignore those who are facing away from you.
Which also means that the vertices seem to be clockwise in view space.
So you consider all triangles which are CCW(counter clockwise) in view space and ignore all who are not.

Then you want to know if the Point is inside the triangle you are looking at.

Using AGKv2 Tier1
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th May 2017 15:36
@janbo
your example is 2d?
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th May 2017 16:14 Edited at: 25th May 2017 21:17
Yes, sort of... I expect you to transform the 3D Coordinates into screen coordinates and then sort out if the triangle is CCW and if the point you are drawing is inside the corresponding triangle.
What If I say I have it working after two and a half hour already ?

Using AGKv2 Tier1

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-16 14:48:20
Your offset time is: 2024-04-16 14:48:20