chronokun

Q3 .map -> Reflex .map converter

154 posts in this topic

Did a bit more testing... placing darkcaulk texture on a brush in Reflex, and comparing it with what the conversion yields, there is a factor of two between them. So from Radiant to Reflex the texture dimension get halved. Or put differently after conversion 8 darkcaulk fit into 128u, Reflex itself fits 4 darkcaulk textures into 128u by default.

 

This could be due to the way Radiant works with textures, by default any texture you add to a Q3A map is halved (scale x,y: 0..5) in size before it gets displayed in Radiant. So that you get 2 pixel per 1u.

 

Interestingly the ratio used in Reflex is different... the 256px darkcaulk texture fits 128u, four times, so 8px per 1u.

Ok, I think I've fixed it, gonna work on adding some command line switches to set patch tessellation levels and whether to keep clip and trigger brushes and stuff before posting up another build though

Share this post


Link to post
Share on other sites

Thanks...

 

I have AEpyraR almost cleaned up completely now. I used a huge amount of cylinders as decoration in the map, and the converter (r10) turned that into 20 MB+ of converted patches. I went into the original and manually converted all the cylinders, into 16-sided brushes... no more patches... and also cut off the back side of them if it could not be seen. Anyway the converted file size went down to 1.5 MB... my present edit should be even less now. Ironic in Q3A I never used 16-sides brushes... ever... I liked the patch cylinders :).

 

At this point  I would colour the trigger brushes in a stark Reflex texture, like brutal white, and even do that manually for the target locations, to remember where they are...

 

It should be wonderful to see an old map in Reflex... with a work time of 8 hours to get it there (so far)...  only possible thanks to your converter.

Devil likes this

Share this post


Link to post
Share on other sites

The map I converted is mirrorized, left is right and right is left.  :huh:

- edit -

New version of the converter fixed this issue.

Share this post


Link to post
Share on other sites

finally got around to adding some of that stuff

https://www.dropbox.com/s/bmcux6b2w723678/Q3ToReflex_r11.zip?dl=0

Available switches are:

-nopatches

-notrigger

-noclip

-tessfactor <1-7>

 

Neat... so that means you added command line parameters...

-nopatches         // Any patches in the Q3A map will be ignored and not converted.
-notrigger         // Trigger brushes are not converted and are ignored.
-noclip            // "Player" clip brushes, that work differently in Reflex, are ignored.
-tessfactor <1-7>  // A e.g. 90° bevel patch is approximated by 1 to 7 "straight" brushes?

Would that be the correct interpretation of these new switches?

 

So by default, patches are converted, so are triggers and player clip ones. What is the default tessellation factor?

 

And a trigger brush in Q3A can be a JP or a Teleport trigger (door triggers also exist and I am probably forgetting something here)... are these "interpreted" and converted to the appropriate Reflex entities by default now?

 

Thanks for continuing support of your tool.

Share this post


Link to post
Share on other sites

Morgoth,

 

You wouldn't for Q3A...  what you normally find in that .pk3 (zip) file is e.g.

map-aepyra.pk3mapsaepyra.aas
map-aepyra.pk3mapsaepyra.bsp

and almost no mapper includes the source .map file... among other reasons to avoid having "someone" simply taking their work and converting it. Even decompiling the .bsp to .map is very much frowned upon. If you created the maps yourself, this is of course no problem. Otherwise I would contact the mapper first before even thinking of converting his/her work.

 

There are a very few exceptions, where the authors explicitly include the .map and allow the use of it. I'd still contact them and ask if they are OK to see their work converted to Reflex.

Share this post


Link to post
Share on other sites

Morgoth,

 

You wouldn't for Q3A...  what you normally find in that .pk3 (zip) file is e.g.

map-aepyra.pk3mapsaepyra.aas
map-aepyra.pk3mapsaepyra.bsp

and almost no mapper includes the source .map file... among other reasons to avoid having "someone" simply taking their work and converting it. Even decompiling the .bsp to .map is very much frowned upon. If you created the maps yourself, this is of course no problem. Otherwise I would contact the mapper first before even thinking of converting his/her work.

 

There are a very few exceptions, where the authors explicitly include the .map and allow the use of it. I'd still contact them and ask if they are OK to see their work converted to Reflex.

I only intended on doing some stuff for personal use(and learning), no harm done to anyone. I suppose GTKradiant would suffice for decompiling .bsp's?

Share this post


Link to post
Share on other sites

Q3map2 can probably do it. Pretty sure I used it at one point to get some defrag maps into QL that weren't compatible otherwise.

Share this post


Link to post
Share on other sites

Hey,

 

Fastastic job doing this script. Would it be possible to make a plugin for blender too?

 

Theres this thing called http://sourceforge.net/projects/q3mapexporter/

 

Its .py plugin which allows user to export in q3 .map format, would be fanstastic if you could add that reflex conversion code to it so you could actually compile straight for Reflex from Blender.

 

There is a lot more to it if you got the skills and motivation, like automatically generating blocks from advanced shapes so that artist can just make things look as he wishes and compiler would do the splitting of geometry. Another thing is adding items / teles etc functional stuff to Blender side. The easiest and most important thing would be just getting geometry exported from Blender to Reflex :)

Share this post


Link to post
Share on other sites

Using Blender for any kind of mapping is pretty much a total waste of time. I recently looked into it and also into the python script. The script is extremely limited, and will not export any slightly more complex bevelled brush... to GTKradiant.

 

The only use for Blender to Reflex would be in ASE or some other modelling format. But for Reflex none have been defined (officially) and models cannot be using in Reflex either.

Share this post


Link to post
Share on other sites

Using Blender for any kind of mapping is pretty much a total waste of time. I recently looked into it and also into the python script. The script is extremely limited, and will not export any slightly more complex bevelled brush... to GTKradiant.

 

The only use for Blender to Reflex would be in ASE or some other modelling format. But for Reflex none have been defined (officially) and models cannot be using in Reflex either.

Yeah well it exports only primitives as of now, so you need to split all your models to cubes before exporting them. What I personally find working pretty decently was to create all geometry from planes -> edgesplit for all faces + solidify => generates geometry which consists only of cube primitives and is exported correctly. Currently it has its problems, but if someone would put a bit thought in it creating maps would become infinitely faster.

 

We just need a some script that can split our complex shapes into those simple primitives, right?

 

The fact is that creating maps in ingame editor is extremely slow and painfull when you have used to use some real 3d-software, obviously its way to go for beginners as its easy.

Share this post


Link to post
Share on other sites

Hmmm, you could probably get reasonable results if you keep the geometry simple by simply extruding each n-gon to a pyramid or prism(within the script, not beforehand) so long as you're carefully to keep your n-gons planar. I'm not very experienced with blenders python api or with python however but I had thought of doing a wavefront .obj -> .map converter which might be useful. Maybe someone who does python stuff could create something more integrated though.

Edit: obligatory Suzanne
SftSF1c.jpg

Share this post


Link to post
Share on other sites

Here's that obj to map converter I mentioned in-case it's useful to anyone: https://www.dropbox.com/s/j0lw4765hwq75ro/ObjToReflex_r1.zip?dl=0 and the github page: https://github.com/chronokun/ObjToReflex

Nice!

 

Tried it out and theres some big issues though, for now it works even worse than using method I described before. See my image attachement, I have explained there how the script should work.

reflex-obj-converter.jpg

 

Keep at it!

Share this post


Link to post
Share on other sites

Nice!

 

Tried it out and theres some big issues though, for now it works even worse than using method I described before. See my image attachement, I have explained there how the script should work.

reflex-obj-converter.jpg

 

Keep at it!

Looks like the normals are inverted, it adds a point behind(or atleast it should be) each face to turn it into a pyramid so the uneven triangled surface should be inside the object and not visible(atleast in theory), I may have accidentally got this backwards somewhere but can you just double check your input mesh with show normals to be sure? I might also need to check the vertex normals against computed face normals, not sure if the polygon winding of what blender spits out is guaranteed to match the normals or not, will need to find out.

Share this post


Link to post
Share on other sites

Ok, il test the new patch thought the problem i posted before was due normals. 

 

However I tested further and it seemed to work only when i combine all objects to one object. Another thing is that when shapes get more complicated it seems to lose some parts of them like in screenshot below:

reflex-obj-convert-test.jpg

 

 

 

edit: problem still persists in v2

Share this post


Link to post
Share on other sites

Just another simple test to demonstrate how it wont convert some simple shapes, hope it helps. This is just a bezier curve beveled and then solidified, all quads no ngons or triangles.

reflex-obj-convert-test2.jpg

Share this post


Link to post
Share on other sites

Ok, il test the new patch thought the problem i posted before was due normals. 

 

However I tested further and it seemed to work only when i combine all objects to one object. Another thing is that when shapes get more complicated it seems to lose some parts of them like in screenshot below:

 

 

edit: problem still persists in v2

This version should now work with multiple objects (and apply nolight to the hidden surfaces): https://www.dropbox.com/s/eo0eh5403avy7ln/ObjToReflex_r3.zip?dl=0

As for the complex shapes getting destroyed, as far as I can tell it's because they are non-planar or near enough to non-planar that reflex is discarding them. I guess those polygons will need to be triangulated, I can add that to the converter but for now just triangulate those particular polygons in blender I suppose.

Edit:

all quads no ngons or triangles.

Btw, n-gons and triangles should be fine as long as they're planar.

Share this post


Link to post
Share on other sites

Triangulated it and it seems to work. Great!

 

Do you have any estimate how efficient performance wise creating maps from triangles this way is compared to creating them from cube-shaped brushes as it is intended? Is this valid way of generating geometry or should this used only for fast sketching and final version then hand made from cubes?

 

Thanks for fast answers and version updates! :)

Share this post


Link to post
Share on other sites

Triangulated it and it seems to work. Great!

 

Do you have any estimate how efficient performance wise creating maps from triangles this way is compared to creating them from cube-shaped brushes as it is intended? Is this valid way of generating geometry or should this used only for fast sketching and final version then hand made from cubes?

 

Thanks for fast answers and version updates! :)

Hmmm, I suppose if you can keep your geometry clean enough to have around one n-gon per wall it should be reasonable but if there's lots of stuff being triangulated or lots of convex objects(things like cylinders that can be made from a single brush) being recreated from meshes it's probably going to give completely awful results compared to working with brushes.

The ideal approach would probably be to model arbitrary solid objects and then have a tool to decompose them into the minimum possible number of convex solids but I don't think I can be bothered attempting something like that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now