Simple texcoord variant?

Questions and answers about the how and why of making maps.
Post Reply
User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Simple texcoord variant?

Post by The Purple Panzer » Mon Jan 04, 2010 9:15 pm

I have a very simple problem to solve, but to do so seems to involve so much hair that I can't believe that there isn't a better way.

I've used texcoords, for instance to put an image on a sign. I have something very simple I'd like to do, but the texcoord machinery might be annoyingly ponderous to use for it. Basically, I've got textures that represent one story of a building, e.g. a row of windows. Right now I create meshblocks with these as the textures, and it looks OK, but often half of a story is cut off at the top of the block. What I want is to be able to guarantee that *an integer number* of these textures is tiled vertically, so that the building has (say) 12 stories or 13 stories, not 12.75. And I don't care if the integer number is 12, 13, 7, or 19; I only care that it be an integer.

To use the texcoord machinery I'd have to worry about the horizontal tiling as well (I don't care about corner wrap), so as not to change aspect ratio. The only way I can see to do this now is to compute a complete mapping (texcoord layout) for the entire block, which while doable just gives me a headache thinking about, since it provides near zero value.

Ideally, I suppose, bzfs would allow some sort of "integer tiling" option for a mesh in a given dimension.

Without that, I could build each building out of individual stories, as groups, put one on top of the other. This might be slightly less tedious (I'd only have to work out the texcoords for one story), but the aspect ratio/horizontal texcoord layout problem still shows up.

Alternatively, if I could get bzfs to tell me what it will do with a given texture, I could adjust the block height so that an integer number of tiles would result. I don't know how to do this - right now I'd just experiment with different building heights, but I have no reason to assume that what works on my machine/video card/video settings/BZFlag settings would look the same to someone else.

This seems such a basic and possibly widespread problem that maybe someone either has a good solution at hand, or an approach I should know about. Help! Help? Thx.

User avatar
Runic
Private First Class
Private First Class
Posts: 23
Joined: Fri Jul 02, 2004 8:51 pm

Re: Simple texcoord variant?

Post by Runic » Tue Jan 05, 2010 12:05 am

Sounds like your texcoords are incorrect, can you post a simple example of the issue?

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

Re: Simple texcoord variant?

Post by JeffM » Tue Jan 05, 2010 12:43 am

This would be more of a feature of your modeler not really a feature of BZFS or of the map format. Some modelers let you define UVs as simple repeats with planar mappings. Meshes are assumed to just be the results of some other application output.

User avatar
The Purple Panzer
Field Marshal
Field Marshal
Posts: 244
Joined: Tue Sep 23, 2003 8:13 pm
Location: Stonington, CT
Contact:

Re: Simple texcoord variant?

Post by The Purple Panzer » Tue Jan 05, 2010 1:28 am

Well, I don't have a "modeler"; if BZFlag specs say that I need to produce a mesh, etc. of a certain sort, I usually write software to do that. There's something unstated and a little disturbing here, that the spec isn't quite the thing, but that one is supposed to adopt a tool (perhaps one of a suggested set) that will feed into it. If so, please be specific about it - I have never had the time or energy to learn a 'modeler' for use only for BZ maps.

I thought I was clear, I didn't want to do a full texcoord solution to this, only to apply a relatively minor constraint. If that answer is that I need to do a full texcoord mapping of a texture across a meshbox to get it right, or learn a modeling program that will do this for me, I think something is really wrong. More than that, the really annoying thing, is that this fact has gone unstated.

Idesigning maps requires mastery of a modeling program, just say so - if it's decent, I'll invest the time. It seems to me that people are playing both sides, saying that it's an open standard, but if you really want to use it you can't use the documented spec, you have to go off into a modeling world.

You might think I'm just being annoyed - not so. I can do what needs to be done, but what really burns my buns is people not telling me what it is that I will need to know. If I can't do basic, simple, and clearly necessary statements in the formerly simple ASCII text file that represents a world, declare that. I don't want to be strung along trying to do reasonable things, only to find out later that decisions have been made that require (specific) automated tools to do what needs to be done. If I need to adopt a specific tool, say that. It is not adequate to say that the function is there, but can't be done directly, only via a tool. (I've often written better tools than what's available, as well).

Sorry if I seem to be over-reacting. I would think my request would be a very sound one, but it seems that it will be ignored because "the people who really know how things work" do it differently, and no one has bothered to state what this is.

If I seem mad, it's not just BZFlag, and I apologize in advance - lots of personal stress. As a solution to that I sometimes fall back to fun map design, as a kind of secret pleasure, but that seems to be failing too.

User avatar
Runic
Private First Class
Private First Class
Posts: 23
Joined: Fri Jul 02, 2004 8:51 pm

Re: Simple texcoord variant?

Post by Runic » Tue Jan 05, 2010 2:23 am

if you use a mesh (not a bunch of meshboxes) you have to use texcoords (UV) to define how that texture is applied to the mesh

it is possible to write a very simple mesh by hand, but anything more complicated and you would want to use a modeler that supports adding UV texture coordinates and export to a wavefront object file. Then you use a tool available on bzflags SVN called modeltool to convert the object file to a BZW map file that contains your mesh.
BZFlag ROCKS!!!

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

Re: Simple texcoord variant?

Post by JeffM » Tue Jan 05, 2010 6:57 am

The Purple Panzer I understand what you are asking for, it's just out of the scope of what a mesh was intended for. The mesh was implemented as a very generic way of getting an arbitrary 3d model into the game. It uses a number of conventions used in other games and 3d software to do this. By specifying exact UV coordinates for every vertex there is no question about what the texture mapping will be in the final model, regardless of where the source model comes from, this is the main reason for doing this. The repeat system you describe would not work well on any arbitrary mesh, it is best suited to large flat surfaces (walls, etc). That isn't say that walls and stuff are not something that gets modeled a lot in bz ;)

We created and provided tools to convert to and from a very common model format into our mesh format (OBJ). This allows any tool to be used, as long as it can write or read a standard OBJ file.

You are correct, the documentation on meshes is less detailed, then that of other objects, mostly because it uses common conventions in 3d modeling, and it is expected that those who use them will have experience in 3d modeling. I'm sorry that what you are looking for doesn't exist in our map format, it can't have everything. In reality all the map should be is a description of the world geometry, not a text based modeling system.

You will need some kind of tool to do what you want, that's the simple answer for it. It may be an existing tool (a modeler) or some tool/script you write, but yes some tool will be needed.

The method you describe for making UVs would be a good addition to the BZWorkbench map editor, as it is an easy way for people to think about UVs a number of mesh shapes (wallpaper on walls). But it would go in that tool, not the map format.

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Re: Simple texcoord variant?

Post by trepan » Tue Jan 05, 2010 7:40 am

If you are using BZ2 auto-converted boxes (not meshboxes), negative
values for the texsize will probably do what you want (tl;dr...)

The texautoscale material property that was added to SVN code
might also be of interest. It's similar in effect to the anti-flicker
back-port that I made for BZ2.

User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: Simple texcoord variant?

Post by zaphod » Tue Jan 05, 2010 10:59 am

what helped me was using "Google SketchUp" to size and place the image ("right click" > Texture > Position) and with modeltool to convert it to a bzw file ....
(let me know if i could give you a hand?!)

Post Reply