News | Forum | People | FAQ | Links | Search | Register | Log in
OBJ-2-MAP V1.1
So I added a few new features to my OBJ-2-MAP utility and put together a small web page explaining how to use it.

This is a utility that can take OBJ files exported from any modeling app and convert the geometry inside into Quake brushes.

http://www.wantonhubris.com/obj-2-map/

Have at it! I think everything will work.

[edit: updated url]
First | Previous | Next | Last
"index Was Out Of Range" Error 
Hi, I created a terrain mesh in roblox studio and exported it out in order to test this tool, the unmodified version works just fine however it's very high poly so it creates a fuckton of brushes (about 5.6k) obviously I want less so I put it into blender and ran it through the remesh and decimate modifiers to reduce the poly count but this new low poly version won't convert, it just gives a "index was out of range. Must be non negative and less than the size of the collection" error and i don't quite know why, tested with both extrusion and spikes with depth of 1 
Error Message 
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at OBJ2MAP.MAPCreation.LoadOBJ(MainForm _MainForm, String[] fileLines, EGRP egrp, StreamWriter streamWriter, List`1& _Vertices, List`1& _Faces, List`1& _UVs, List`1& _Brushes, Single scale, Char[] separator1, Char[] separator2)
at OBJ2MAP.MainForm.GoButton_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
Therektafire 
I have absolutely zero chance of being able to debug the code, and given how the download is served off archive.org I suspect nobody else will either. So my idea is to see if the bug can be worked around.

If you try running the Blender tool with a different level of decimate modifiers (maybe start with a very low level of alteration) does the same error still strike? If not, try incrementing the levels until the bug strikes or you have something you can work with.

If not, check if just importing into blender and re-exporting without any modifiers causes the crash. If so, might have to rule Blender out entirely, if not then alternative modifiers are the order of the day. 
 
Depth of 1 is the possible suspect. Try 8 or more.
The larger the faces, the higher the chance that a pyramid would end up as a degenerate brush (i.e. an original face coincides with one of its extruded ones). Since you're increasing face area, increase the depth accordingly.

Also make sure to triangulate the mesh, I don't think OBJ2MAP checks for planar faces. 
 
Try using this: https://bitbucket.org/khreathor/obj-2-map/downloads/obj2map_130_prev.zip

also few tips:
1) Triangulate whole mesh;
2) Set all normals outside;
3) UV it - can be automatic;
4) best to treat 1 blender unit as 1 quake unit, so scale your mesh properly;
5) apply position/rotation/scale before export

When you apply all changes above, you should get flawless conversions. 
 
...

Didn't realise there was a version that could do UVs. That's amazing. Going to port this into a Blender exporter after HWJam (unless that already exists as well). 
 
UVs works only in valve220 format 
 
As promised, here's a .map exporter for Blender 2.80

Exports either individual faces as pyramids, or objects as convex brushes. Uses material names for texture assignment and material image size for scaling. Supports UVs both in standard Quake and in Valve220 format (adapted from EricW's implementation for OBJ2MAP). Offers custom grid. Allows saving to clipboard.

The exporter ensures that the brushes are convex and the faces planar. You don't have to triangulate the meshes in advance, but in some cases it can help with UVs (e.g. with mid-edge vertices). There's room for improvement, but it should work fine as is.

Standard format UV export is lossy (no shearing). I don't really expect anyone to be using it over Valve220 anyway, but it should produce decent results for id1-style detailing. Single-axis curves should be fine, no miracles though.

Only tested in Trenchbroom for now. Might need to change precision for other editors. Let me know if it works/breaks elsewhere. 
 
That is an amazing plugin, Chedap! Thank you so much for what you do. It works really really well! 
@Chedap 
Installing the .py file through the plugin menu in Blender 2.80 or 2.91 like normal and it doesn't show up. Does this not work anymore? 
 
Hi, I'm trying to convert a level from Unreal Gold and it's full of Infinities and NaNs.
https://mega.nz/file/ADYmXZJB#NIogY6csRsOdwGfK4VElcPpt0rGouUfI3JOWNHFi5oQ

Blender plugin needs "division by zero" protection in one place. 
 
 
@Tintin: the plugin is a single python script. That's what you should download (rather than a .zip) and point to in the Blender's "Install..." dialog.

@crystallize: I have added a check for missing images. This prevents the error, but you should not expect sane UVs on export, since without the files there's no way for the exporter to determine the scale. 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.