Modelling a map
From OpenArena
The easiest way to convert a map to a model format is running the q3map2 to convert the bsp to ase. Q3map2 auto discards all brush faces that are outside the map's volume, in the void. It also inverts all face's normals, because in the additive csg world of quake the inside of a mesh is the playable zone. Q3map2 doesn't convert the whole map in a single mesh object but rather many separated mesh objects.
There are some issues in modelling a map or converting an already made map to a model though:
- Visibility doesn't work with models, if the whole map is one model, then the whole model is rendered. Models aren't part of the BSP tree, so they doesn't count for visibility or collision. If a map is going to be modelled, the way to deal with oclusion is by making the map not out of one large mesh, but rather many smaller chunks. The map will still need structural brushes to not leak, but textured with caulk since the map's visible triangles are going to be those from the meshes. Meshes that fall in ocluded clusters won't be rendered, but if part of it becomes visible, then the whole mesh is rendered, that's why large meshes are bad in this case.
- Textures. If you look in the uncompiled map file in a text editor you'll notice texture UV coordinates. When making a map in radiant nobody worries about UV, because radiant isn't constructing the map with meshes, but solid primitives. However, by making the map a mesh, the map will need to be textured trought the UV unwrapping process, which takes much more time.
- Shaders. It is possible to use shaders on models. However, it's a bit tricky to set everything up. For ASE models here it goes: *MATERIAL_NAME and BITMAP (this one under *MAP_DIFFUSE) should both match "/textures/somefoldername/sometexturename" exactly. *MAP_NAME (under map_diffuse too) and shader filename should (untested wheter missmatching here causes problems or not) match exactly too. And finally, the shader's name "/textures/somefoldername/sometexturename" should match the material and bitmap lines. Due to all those matching names and paths, shaders could be possibly hard-constrained to one model - one shader.
- Lightmaps. When a map is compiled, q3map2 has some internal algorithm that automatically packs X surfaces in one or more lightmap bitmaps; somewhere in the BSP lies the coordinates or UV maps for all the computed lightmap bitmaps. If the lightmap is rendered externaly, then q3map2 is unable, it doesn't feature import or export UV maps, to use externaly generated UV maps for lightmaps. In that case, the map should be compiled without lightmap stage and/or with lights that only affects entities.
- Baking all textures. One thing that can be done with models is baking all textures to UV maps. That would make the map run faster on old video cards, since there gpu won't need to blend lightmaps and textures in realtime, at the expense of needing a lot of memory to load very large baked textures.
- Materials. It's better to use one material (materials in 3D modelling aren't the texture bitmap itself) per mesh to avoid overdrawn.
- Lightmap UVs. Since sunflow doesn't feature an algorithm for achiving the most optimal lightmap bitmaps : face scale ratio, it's kinda impossible, or at least too demanding, to make an even distribution of UVs. One model can have a lightmap splitted in more than one bitmap, or one bitmap containing faces from different models, however doing that manually should be a nightmare. Another possible, altought too demanding as well, trick is to overlap UVs, deleting repeated faces that all share the same lightmap and overlapping UVs to save bitmap area space. One idea for simplyfing the process: unwrap the whole map in one UV map, then render the lightmap at a very large size, later split the huge bitmap in smaller pieces and remap the UVs using those pieces.
- UV unwrap: compile the BSP without fixing T-junctions, with fewer edges it should be much easier to unwrap the model. Note: the converted ASE outputted from q3map2 has overlapping UVs, which can't be used to bake in renders.
- ASE: q3map2 converts each face, or co-planar surfaces, to one separated object. Each one with its own UV map.
For a bit more of info and a tutorial, see this guide on LevelDK.
[edit] Baking lightmaps in external render
q3map2 radiosity solution seems to compute only local light, color bleed, no global light.
Blender internal render has means to calculate radiosity with much greater control over how light is calculated. Another free option is sunflow, a java basead render with global illumination and high quality features available on professional, paid, renders.
Another free solution is going for renderman format. http://sourceforge.net/projects/ribmosaic With that exporter one can export blender scenes to renderman format.
The last option is to get access to a professional render with render to texture capability, such as mental ray or brazil render.
Orthogonal camera: in almost all render communities there are discussions about "render to texture" capability. Some users have suggested that by placing orthogonal cameras in front of a face, it's possible to bake that surface's texture. However, there isn't a ready to use script that would auto place one orthogonal camera for each face and batch render that.
Some tips with sunflow:
-The fast GI method is good enough to generate lightmaps with baked global illumination, path tracing and irradiance caching are much slower, while generating lightmaps with almost no noticiable difference for in game rendering.
-The best way in blender to unwrap meshes for texture baking purposes is standard unwrap + marked seams. Then edit all UV vertex coordinates to keep all edges straight, either perfectly horizonal or vertical, lines. That should avoid aliased edges. Or simply exagerate the borders of the islands to "cover" the edges.
-Sunflow can't generate lightmaps with +1 pixel borders to avoid seams, to compensate for that, shrink all UV islands, leaving a 1 pixel border. Or edit the lightmaps in a image editor, expanding all islands by 1 pixel.
-Sunflow can only render if the exported scene has a camera and a material, even if the material has no textures. The exporter script also appears to have a bug, which causes exported scenes to be blank or corrupted files if the scene wasn't rendered first in blender.
-Sunflow doesn't support texture mapping, only UV mapping. It also can't scale or tile textures. The only way to do it at this time is by programming a janino shader.
Rendering renderman rib:
-Unlike common raytracers, in renderman rendering world there is no direct raytracing that creates all sorts of lighting effects almost straightfowardly. You'll need to learn the renderman shading language to bake lightmaps with raytraced effects.
Free renders with bake capability:
Important note on renders: error 0xc000001d means that your CPU lacks SSE instruction set. Therefore you won't be able to run it.
[edit] Further reading
http://www.hourences.com/book/tutorialsmeshrendering.htm
This tutorial will explain how meshes are rendered in a lot of real time engines such as Unreal Engine 2
http://www.katsbits.com/htm/tutorials.htm Blender 3D, modelling and modding, level design and texture making tutorials, resources and downloads.
http://www.bakdesign.net/tm/tutorial/3dsmax_tutorial.html
http://www.modwiki.net/wiki/ASE_(file_format)
[http://en.wikibooks.org/wiki/GtkRadiant]
[https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk/COMPILING]
[http://modulatum.wordpress.com/2008/07/26/creating-a-map-in-gtkradiant-for-openarena/]
