Blender Texture Mapping for Game Levels (Similar to Radiant/Hammer editor or 3DS Max UVW Map Modifier)

Started by
9 comments, last by ShadowFlar3 10 years, 6 months ago

Are there any modern methods or addons for Blender 2.6 that help with the texture mapping process of levels?

UV Unwrapping is good for some types of models, but when I'm designing architecture I want to select a face and arbitrarily tile and rotate a texture over it. I'd also want some kind of alignment tools. If anyone's ever edited levels with Doom Builder and used the texture align tool, I'd want something similar.

This is the closest I've found, but it's pretty old. It probably won't even work with the BMesh system even if I get it compiling.

http://irrlicht.sourceforge.net/forum//viewtopic.php?t=14441

I'm familiar with the texture mapping tools in editors like Radiant for games like Quake 3 and Doom 3. Others are probably familiar with UDK or Source engine texture mapping. I'd want a tool similar to that.

In 3DS Max I was able to use the UVW Map Modifier to do this, and even then it was a bit cumbersome compared to the above mentioned level editors. It was hard to align textures between faces and base tiling off of real world units. I'm switching to Blender for now since I'm no longer a student working on student things, and Blender's Python API is infinitely better than Max Script and faster to iterate on than C++ dll plugins.

If no one has any suggestions I may try modifying the above linked script to work with current versions of blender and add a few things of my own if needed/doable.

Advertisement
Good topic because I've been thinking about the same stuff with my levels. I've never looked into scripts myself. For the time being I'm using just fully tileable textures and Cube projecting the UVs. In material -> texture I adjust each material tiling so that the scale is right for my game. In level design I of course try to avoid seams on surface which I need to continue but sometimes in doorways I either project from view or adjust the cube projected texture UVs manually.
I assume this is nothing groundbreaking to you but maybe to someone struggling with how to UV map their environment consistently :)

I can see how UV mapping is very different from what some level editors such as Valve Hammer do but modeling has it's plusses as well. Mainly that you can do complex mappings and you have perfect control over it.

Yeah I was thinking about this some more and would want a combination of these different tools. So far, as far as modeling packages go, 3ds max's uvw map modifier is the closest thing ive found that works for this kind of thing. Ill have to try the box projection. Is it possible to do box projection per face relative to the face normal? That would probably give me what I need.

The texturing was always one of the most tedious parts of level design and I feel like the level editors themselves are the only ones who got it right for plain walls so far. Id definitely go with uv unwrap for more detailed things.

Is it possible to do box projection per face relative to the face normal?

Unfortunately, no :( If you don't have the face normals aligned to local x,y or z axis you can't use cube projection for "square" results.

You'd have to use unwrap (reset works too for single quad ofc) to get it properly, but this won't maintain the proper relative scale to other UV mapped walls.

Some form of script would come in handy but it's probably hard to do it so that it would suit everybody's needs. Keep us posted if you start modifying AutomapUV or similar script :)

I'm starting to think I'll definitely need a little script. The absence of a plane projection unwrap like there is in 3DS max makes this work extremely difficult.

The worst was a fairly irregular roof polygon that I just wanted to place a texture on top of. Even in 3DS max, I'd be able to do that easily, although tediously. In blender, there's just no way. With a script that does some of these things life would be even easier.

The worst was a fairly irregular roof polygon that I just wanted to place a texture on top of. Even in 3DS max, I'd be able to do that easily, although tediously. In blender, there's just no way. With a script that does some of these things life would be even easier.

So what makes UV -> unwrap not work for that for you? Did I miss something?

It works in some cases. But have you ever used a level editor for games like Quake or Doom 3 or Unreal? Their texture mapping tools let you tile a texture with a simple click of a button. You can say, I want this brick texture to appear on that wall and be tiled 5 times horizontally and once vertically. This is good for architectural low poly environments like what I'm doing 90% of work for. Imagine doing this for arbitrary angled surfaces where cube mapping isn't good enough.

Then when you have some high poly model with organic curves, etc... That's when you need Unwrap.

Here's a good example of a scene in Counterstrike: Global Offensive

cb0a1fed802533f027aef52723697217_lightbo

The floors and walls would be textured by selecting a face and saying that you want some arbitrary texture tiled a certain way. Then you have props like couches, bookshelves, doors, the fireplace, which are higher poly models. For that you use UV Unwrap.

During the past 15 years I have used Quark (Quake I & II), Worldcraft (Half-Life, Counter-Strike) and Valve Hammer (Source) with the most sophisticated being Hammer. Of course there is good interface for texturing options in form of a buttons but there's not an actual UV editor which I find lacking.

Blender does so much more than level editing so obviously it can never be as specifically tailored to that task as some software that is purely a level editor and I think it's fine. There's not a button for this and that out-of-the-box but you can always make your own scripts for the things you want to automate. What I find good about Blender compared to Valve Hammer is the total control over UVs.

I think you got my advice about UV unwrap a bit wrong. I know marking seams and unwrapping as a process because I've also done a lot of 3D character and prop modeling. My point was that in Blender you can select any face/faces oriented freely in 3D space and choose UV->unwrap to send the face to UV editor to without any distortion. Regardless on if you work with character, prop or just organic level.

Hmm I can try that. I just hope I can work as quickly as I would normally without having a nice script that does this.

If I were you, I would work on a script that would compute the UVs for clusters of co-planar triangles of a mesh based on world units.

First you go through every face, identifying clusters of co-planar, adjacent triangles. A floor that has several triangles would be an example of a cluster.

You can find the 'transformation' of each cluster by considering the cluster's normal as a rotation and its center (given by averaging the vertex positions) as the location. You can then transform the vertices of the cluster by the inverse of this transformation so the vertices are aligned and centered on the horizontal plane, and map them more easily.

With the vertices transformed to the horizontal plane like this, you would give each vertex their UV values based on their 3D coordinates - you are mapping world units to UV units based on a predefined value of how many "tiles" you want per world unit. In other words, you are giving the UV space a size in 3D world units.

If you want 'one texture tile per five world units' for example, and a vertex of the cluster is located at 5 world units on a certain axis, then you would give this vertex a UV value of 1.0 in its corresponding UV axis, to have a single texture tiling it.

If a vertex of the cluster happens to be located at 15 world units on a certain axis, you would give this vertex's corresponding UV axis a value of 3.0 (with an U or a V value of 3.0 it's located outside of the UV space and the texture applied to it wraps or repeats itself 3 times, giving the tiling).

Once the script is done, your entire level should be mapped with tiling. Irregular or curved regions such as hills, arches etc. will probably look wrong and you will have to manually map these, but the rest will be done.

So this script is something that you process your level with once you're finished with modelling it. Then you can apply UV Textures to the faces of your level and it should generaly look good.

The target result should be something like the following. When you replace the grid textures with the in-game textures it should look proper.

TWW_I_Test_M1.png

This topic is closed to new replies.

Advertisement