Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vec_for_uv() return World Pos #110861
02/05/07 17:18
02/05/07 17:18
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline OP
Expert
xXxGuitar511  Offline OP
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Could a function be created that returns the world position of the uv coord on a models skin? Or is there a work-around to do this that I havn't seen yet?

If this were implemented, then Users could create their own lightmaps/shadowmaps for their model levels. (My plan for this feature)


xXxGuitar511
- Programmer
Re: vec_for_uv() return World Pos [Re: xXxGuitar511] #110862
02/05/07 19:01
02/05/07 19:01
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
UV coordinates are for the skin and have nothing to do with a "World Pos". You're confusing this with mesh coordinates.

The basic concept of a model, a mesh, and UV coordinates is described in the programmer's section of the manual

Re: vec_for_uv() return World Pos [Re: jcl] #110863
02/05/07 21:34
02/05/07 21:34
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline OP
Expert
xXxGuitar511  Offline OP
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
My goal is to scan through the skin of a model, and do a trace to the sun pos to see if the light hits it. however, unlike the shadowmap gen. already made, I was planning on using it for more complex models with normals facing in any direction, such as on a sphere for example.

However, I could not find any way to get the position in world space from the models skin corrds. I was planning on using a black uv mapped skin, then using similar code to the previous terr. shadow gen.. Hoewever, that used the simple fact that the taerrain was "flat", or only on the x and y planes, I was hoping to use z also...

So my goal here lies that I need a way to take a texture, get which face the current pixel is located on, and get the world corrds of where that pixel is being displayed...


If I'm still not making any sense, please let me know...


xXxGuitar511
- Programmer
Re: vec_for_uv() return World Pos [Re: xXxGuitar511] #110864
02/06/07 17:50
02/06/07 17:50
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
No, you need to do it the opposite way. You need the mesh coordinates. Scan through all vertices and interpolate their XYZ world positions along their UV coordinates. Then calculated the lighting every x pixels and paint that on the skin.

Before that, you normally first create an UV mapping on the second UV coordinate set for the lightmap. This is non-trivial and there are several algorithms for that. The easy way would be just to duplicate the UV coordinates, but that does not work always.

Re: vec_for_uv() return World Pos [Re: jcl] #110865
02/06/07 22:22
02/06/07 22:22
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline OP
Expert
xXxGuitar511  Offline OP
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Quote:

No, you need to do it the opposite way. You need the mesh coordinates. Scan through all vertices and interpolate their XYZ world positions along their UV coordinates. Then calculated the lighting every x pixels and paint that on the skin.




I see... I was thinking about what I posted and also figured that what I wrote was the wrong way of doing it. However, I didn't get as far as you posted.

Is there a way to scan through the faces? I know you can't do it simply with the ent_vertices() command, because there is no way to tell which meets which. If not, then this is what I was hoping to post as a request...


xXxGuitar511
- Programmer
Re: vec_for_uv() return World Pos [Re: xXxGuitar511] #110866
02/07/07 17:45
02/07/07 17:45
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
I suppose that you don't want to create a lightmap compiler in C-Script, but use C++? Then you can get the mesh object by ent_mesh, and thus extract the faces from it:

http://manual.conitec.net/ent_mesh.htm

Re: vec_for_uv() return World Pos [Re: jcl] #110867
02/08/07 15:49
02/08/07 15:49
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline OP
Expert
xXxGuitar511  Offline OP
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
I was planning on using c-script, but I guess c++ is the way to go. Now to finally learn c++

Thank you Jcl for your support and replies. I will get started immediatly, and if it works, then I will upload it to the user contributions for free...


xXxGuitar511
- Programmer

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1