Page 1 of 2

[SOLVED] Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 5:19 pm
by ItsBritneyBitch
Hi everyone, I'm trying to load Quake III .MAP files into Irrlicht, but I can't make it load correctly. While it is rendered ok, all the geometry is flipped horizontally and vertically. Because these files use a Z-up right coordinate system, I thought it would be just a matter of converting to Irrlicht's left-handed Y-up system rotating the X axis (i.e, switching Y and Z axes). But it doesn't work. In fact, doing this doesn't display anything at all.
Do you guys have any suggestions? Thanks.

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 5:28 pm
by hendu
How are you loading those? I have no issue loading my own maps.

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 7:54 pm
by ItsBritneyBitch
Oh...I guess I should've posted this in Advanced Help?
hendu wrote:How are you loading those? I have no issue loading my own maps.
I'm using the algorithm to get the vertices from the planes intersections that I got from a couple of sources. Are you loading .MAPs too?

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 8:57 pm
by Mel
Irrlicht loads QIII maps natively (.bsp)

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 9:10 pm
by ItsBritneyBitch
Mel wrote:Irrlicht loads QIII maps natively (.bsp)
Lawl :D, I think it was quite clear that i'm trying to load *.MAP* files, not BSPs. .MAP is the format used by Quake-like engine editors, like Radiant, WorldCraft or Hammer, where the geometry is stored as the intersection between planes.
I'm aware that converting coordinate systems isn't rocket science, but again, should I move this to Advanced Help? Thanks a lot.

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 9:25 pm
by Mel
Oh! i see... loading QIII BSP maps is well supported, unlike loading the .MAP files.

Well, The simplest way is to load them, and then, flip them as needed (no coordinate conversion at all...) Only keep in mind that when the faces are flipped, their normals should be flipped too, after.

Re: Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 10:05 pm
by ItsBritneyBitch
I don't know if this can be helpful for someone, but I made it work by inverting every axis and swapping the Y and Z axes. Then use the irrlicht plane constructor with the 3 points using a descending winding order (which sets the face normal), i.e

Code: Select all

irr::core::plane3df myplane(v3, v2, v1);
Mel wrote:Oh! i see... loading QIII BSP maps is well supported, unlike loading the .MAP files.

Well, The simplest way is to load them, and then, flip them as needed (no coordinate conversion at all...) Only keep in mind that when the faces are flipped, their normals should be flipped too, after.
Swapping axes is part of a coordinate system conversion.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Mon Apr 16, 2012 10:37 pm
by Mel
I think it would be very interesting that Irrlicht supported the loading for .MAP files. Mainly aimed to physics wrappers, because .MAPS are defined by convex brushes, which in exchange, can be very eficiently parsed by physics engines, and i think they can translate almost directly.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Tue Apr 17, 2012 8:42 am
by hybrid
But what would be the advantage of reading map files instead of bsp, which is compiled from the map files and hence has more compact representation.
And yes, can be moved even though it's already solved even here. But no, don't start another topic with the same theme on your own, admins will move your thread.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Tue Apr 17, 2012 10:23 am
by hendu
Yep, the compilation also removes unreachable spaces and does various other niceties. OP, why do you want to load a .map?

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Tue Apr 17, 2012 11:38 am
by REDDemon
Mel wrote:I think it would be very interesting that Irrlicht supported the loading for .MAP files. Mainly aimed to physics wrappers, because .MAPS are defined by convex brushes, which in exchange, can be very eficiently parsed by physics engines, and i think they can translate almost directly.
I quote you.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Tue Apr 17, 2012 12:01 pm
by hendu
Yes, I read the post; but I want to hear the OP.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Wed Apr 18, 2012 7:02 pm
by ItsBritneyBitch
hendu wrote:Yes, I read the post; but I want to hear the OP.
My music is out everywhere! :lol:
Seriously though, I wanted to load .MAP files cause...*drum rolls*... I'm making a CSG editor (using Irrlicht for rendering), with BSP compiling, PVS and radiosity calculations.

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Wed Apr 18, 2012 11:01 pm
by Mel
Now that sounds really awesome :) i recomend you to use Spherical Harmonics for the radiosity storage (Both Irradiance Volumes, and Irradiance Maps). they can be a bit dificult to understand, but it is worth the effort.

So if i get it correctly, what you are going to do is to create the brushes somehow, compile them into a .MAP file, load it and perform all the calculations to create a BSP with portals and all the stuff?

Re: [SOLVED] Convert from right-handed coordinate system

Posted: Thu Apr 19, 2012 3:00 pm
by hendu
Are you writing the compiler yourself, or just outputting .map and using one of the existing ones?