Blender to DX ( Or OGL to DX ) ???

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
JackRabbit
Posts: 0
Joined: Sun Aug 17, 2003 7:26 pm
Location: Sweden

Blender to DX ( Or OGL to DX ) ???

Post by JackRabbit »

Hi,

I've written an export script for a game im making.
The game uses DirectX9, but im not using .X ( Dont ask why since it is
irrelavant )

Now, ive got some problems getting the texture coords to map correctly.
Most of the faces look really screwed up and stretch, but look fine
in blender.

Now, since Blender uses OpenGL for rendering, and probably for its data
to, im wondering if anyone has any tips for me on what to think about
when doing this OpenGL to DX which it boils down to.

And i do think that this is where my problem lies, even though it could
just as well be my export script thats at fault, but im "pretty" ;)
sure it works ok, ive been going through it over and over, and its
pretty basic.

I know that DX and OpenGL use different coordinate systems, and also
for texture mapping but i cant seem to get my head around this problem,
so, any help on this would be greatly appreciated.

Thanks for your time!

PS:
I know, its a bit of a fuzzy question, but just let me know if im unclear
about something.

nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Re: Blender to DX ( Or OGL to DX ) ???

Post by nyoxi »

JackRabbit wrote:Hi,
I know that DX and OpenGL use different coordinate systems, and also
for texture mapping
They don't use different coordinate system (it depend on how you set it up:). And texture coordinates are treated in the same way too.

There is probably problem in the export script (or maybe in Python interface, but review your script first before thinking about errors in the interface).
Try exporting some simple object (like cube) with texture mapped on it and then look at the number you receive and verify if they are all right (yeah, and maybe the problems is in your program :lol: ).

JackRabbit
Posts: 0
Joined: Sun Aug 17, 2003 7:26 pm
Location: Sweden

Post by JackRabbit »

Actually they do use different.

To be exact, the main diff is the direction of the Z axis.

For OGL positive is "into" the screen, and vice versa for DX.
( Or was the other way around ? oh well)

As for texture mapping, a UV coord of 0.0f, 0.0f is the upper-left corner
of the image, where in OGL 0.0f, 0.0f is the bottom left.

So, my thought was that some faces gets 0.0 in both ends, and hence,
the texture gets stretched on some faces.

But, ofcourse, you can set them up differently, atleast for the world
coordinate system, if im not mistaken. But, be that as it may, i dont know
what setup Blender uses, so im not sure if need to compensate for this
when i load the exported data.

Anyway, i have been playing with only a simple face ( triangulated ofcourse)
but, half of the face gets messed up.

So, i was just wondering how Blender assigns the texture coord values.

Post Reply