[SOLVED] Convert from right-handed coordinate system

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
ItsBritneyBitch
Posts: 18
Joined: Mon Apr 16, 2012 5:04 pm
Location: Calabasas, CA
Contact:

[SOLVED] Convert from right-handed coordinate system

Post 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.
Last edited by ItsBritneyBitch on Mon Apr 16, 2012 10:05 pm, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Convert from right-handed coordinate system

Post by hendu »

How are you loading those? I have no issue loading my own maps.
ItsBritneyBitch
Posts: 18
Joined: Mon Apr 16, 2012 5:04 pm
Location: Calabasas, CA
Contact:

Re: Convert from right-handed coordinate system

Post 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?
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Convert from right-handed coordinate system

Post by Mel »

Irrlicht loads QIII maps natively (.bsp)
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
ItsBritneyBitch
Posts: 18
Joined: Mon Apr 16, 2012 5:04 pm
Location: Calabasas, CA
Contact:

Re: Convert from right-handed coordinate system

Post 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.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Convert from right-handed coordinate system

Post 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.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
ItsBritneyBitch
Posts: 18
Joined: Mon Apr 16, 2012 5:04 pm
Location: Calabasas, CA
Contact:

Re: Convert from right-handed coordinate system

Post 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.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

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

Post 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.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

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

Post 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.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post by hendu »

Yep, the compilation also removes unreachable spaces and does various other niceties. OP, why do you want to load a .map?
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

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

Post 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.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post by hendu »

Yes, I read the post; but I want to hear the OP.
ItsBritneyBitch
Posts: 18
Joined: Mon Apr 16, 2012 5:04 pm
Location: Calabasas, CA
Contact:

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

Post 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.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

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

Post 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?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post by hendu »

Are you writing the compiler yourself, or just outputting .map and using one of the existing ones?
Post Reply