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 / AGK obj parser

Author
Message
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 19th Jan 2013 12:53
I noticed that the 3D level provided with AppGameKit has four values for each vertex texture coordinate:



The obj I am trying to load has three, and the third is always 0. This model does not have correct uv coordinates when loaded into AGK. I may be able to write something to convert it for use in AppGameKit but I need to understand what the four values are for.

Is AppGameKit supposed to be able to handle vt with 2 or 3 values? If so then perhaps something else is wrong with my obj file?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2013 00:47
Normally a obj file uses 2 values for vt, they are U and V co-ordinates. There is an optional W value which normally corresponds to weight but since there are two extra values I would guess these are UV values for the light map. I'd have to check with Lee to be sure but that's my guess Matty. I have been experimenting a little with creating my own obj files too for a personal project I started over Christmas.


this.mess = abs(sin(times#))
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 20th Jan 2013 01:30
Yes it would make sense Not a standard OBJ structure but ingenious
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 20th Jan 2013 14:35
Thanks for the response, just after I posted I realised that it will be two sets of uv coordinates, which is a handy option.

But one set should be accepted also, otherwise the format is not too useful for standard obj files.

I think if I add another 0 to my obj files uv data they may parse correctly?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2013 18:21
Yes, I think zero is the default.


this.mess = abs(sin(times#))
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 22nd Jan 2013 01:30
The standard OBJ spec allows up to three UVW values as baxslash says. If AppGameKit finds three values it reads the first two (UV) and ignores the last (W). We made a special case that if it has four values then we read the first two as normal, but then read the second two as a second set of UV coordinates, in this case they were for a light map.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 5th Mar 2013 00:04
I think I found the problem. It seems the uv coordinates can't be above 1.0?

I could be wrong since I am not a modeller so perhaps the mistake is on my part. Anyway, using milkshape I can set the uv coordinates outside the range of 0.0 -> 1.0 and it works, it also shows up correct in other model viewers but AppGameKit has a problem and the texture looks all stretched.

Is this a bug, or is it just agk is using a different texture mode, if so, can we change it? Perhaps using our own shaders?

Thanks.

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 5th Mar 2013 01:56
Over 1.0 is texture repeats. You have to normalize to 1.0

For example : 1.5 will be 0.5.

Simply mod you uv values like this only if greater than 1.0) :

Login to post a reply

Server time is: 2024-05-06 23:21:33
Your offset time is: 2024-05-06 23:21:33