Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Constrain pixel coordinates to Blender units when UV mapping


TheMagician
 Share

Recommended Posts

I've been doing a bit of searching for a solution to this but haven't had much luck yet.

I'm trying to create a generic developers' tileset that uses a precise grid for a texture. The texture has lines every 32 game units (similar to the dev textures used by other developers in their map editors, eg. Half-life 2, FEAR, etc.) so that other modders can plan models and textures for the generic tileset by examining heights and distances on the dev texture. Here is a screenshot of the idea -> devTile.

So far, I haven't been able to figure out a way to reliably constrain the pixel dimensions of the texture (which is 256 x 256 pixels) to Blender units so that the grid is correct (where 1 pixel equals 1 game unit). I have tried doing it by hand, but it's extremely time-consuming, tedious, and imprecise. If anyone knows a way to do this (via options in Blender, script, or an accurate, reliable work-flow) I would be eternally in your debt. So far, my search has ended in a lot of forum threads that seem to imply that there is no way to do this in Blender. That makes me  aa_sad.gif

Link to comment
Share on other sites

There are at least two ways to do what you want.  First, see my response to Rowan in Rowan's Help Topic.  The ruler, calibrated in CS/Oblivion units, can be imported into Blender and used to adjust your tileset.  That should get you very close.  The method below gives you an exact answer.

If you always use the same Scale Correction Factor in the .Nif Import/Export dialog panels, the ratio of the mesh size in Blender units and CS/Oblivion units will remain constant.  So make a plane in Blender 256x256 Blender units*.  Orient the plane so it's parallel to the plane of the 3D view and UV map your texture using Project From View.  Now you will have an object that is a plane, exactly 256 by 256 Blender units, with exactly one texture pixel per Blender unit.  Export it using the default Scale Correction Factor of 10.00.  Load it into the CS and Measure it's size.  One way is to move the panel until one edge is exactly aligned with some sharp edge or similar feature in the CS.  Now move it along one axis until the far edge is aligned with the same feature.  The distance you moved it is the size of the panel in CS/Oblivion units.  Now you know the size in both Blender and Oblivion units for a Scale Correction Factor of 10.00.  You  can figure out what to do from there.   aa_biggrin.gif

* If 256 by 256 Blender units is impractically large, just use something like 2.56 by 2.56 Blender units, and adjust your calculations accordingly.

Link to comment
Share on other sites

Thanks for the reply, Vince.

I can construct a plane 25.6 x 25.6 BU which will translate to 256 x 256 GU (scale factor 10) but how do I apply a texture that is 256 x 256 pixels to a plane that is not 25.6 BU without distortion along one or both axes?

It may be that I worded my original request poorly, or that I'm just not drawing the proper conclusions from your answer (I am a noob at Blender and modeling, after all) but it seems like you're describing a method for measuring things (which is great and useful) but what I'm really looking for is a way to correctly and efficiently UV map a large collection of simple interior models using a texture that tiles exactly without stretching, regardless of the dimensions of the panel that it's applied to. Iif I create a door frame with a rectangular plane on either side of the door, one over the door, and one along each side of the inside of the frame, how can I UV map it so that the grid lines on the texture all line up properly without having to painstakingly adjust each polygon in the UV editor (which is time-consuming and very hard to get good results with)? Are you suggesting that I should create a standard plane and then use it to correct my texture mapping for non-standard planes by eye? I was hoping there would be some way to automatically constrain the UV map to set 1 pixel = 1 BU. (Or, in this case, 1/10th BU.)

My original idea was to create a generic tileset with a large number of simple pieces that have already been UV mapped in a straightforward and consistent fashion. Modders could then use the geometry of the meshes (along with the collision) and simply retexture them to get the effect they're looking for without having to know a lot about UV mapping. The problem I'm having is that Project from View will fit a 256 x 256 texture into a plane that is only 192 x 192 (for example), thus distorting the grid. What I'm looking for is a way to constrain the mapping so that, if my plane is 192 x 192, the texture starts at 0,0 and stops at 191,191, even though the texture goes to 255,255. Is there just no way to do this? The ruler idea is good, and will make mapping easier by hand, but even with a ruler I don't want to hand adjust 200+ pieces if there is an easier way to do it. It's not a deal-breaker if there isn't an easy solution (I just won't do it) it just seems like this would be an option somewhere.

Link to comment
Share on other sites

Quote

Thanks for the reply, Vince.I can construct a plane 25.6 x 25.6 BU which will translate to 256 x 256 GU (scale factor 10) but how do I apply a texture that is 256 x 256 pixels to a plane that is not 25.6 BU without distortion along one or both axes?I
The Magician, I'm confused by your first sentence.  You say you can construct a plane 25.6 x 25.6 BU then question how you can apply a texture that won't distort "to a plane that is not 25.6 BU... ".  Does that make sense to you?  Understand, I'm not being sarcastic, that just doesn't make sense to me.  In general you can apply a square texture (like 256 x 256) to any square face without distortion.  Relative to the rest of your post, I read it over a couple of times then my eyes started to glaze over (yes, I am being a bit sarcastic here).  Hopefully, as we go through the modeling class and explore Blender's UV mapping in detail, you will find the answer to your question.   aa_biggrin.gif
Link to comment
Share on other sites

@VInce: yeah I was confused at first too. He's looking fow a way to UV map the same texture onto multiple differently scaled objects and have the texture grid the same size in game. For example if you had 256x256 unit plane and and a 64x128 unit plane sitting in game, the grid texture would look the same on both of them (although you'd see less of it on the smaller plane). I have no experience with Blender so I don't know if there's any way to do it other than by eye.

WT

Link to comment
Share on other sites

@WindmillTilter  :blush:

Yes. I was having some trouble articulating it. I apologize for the length of my posts. It's a character defect I've never been able to overcome. (Rather like my excessive use of emoticons.)  :bagged:  

I understand that the UV mapper in Blender uses a scale from 0 to 1 to accommodate textures of any size (where 1 is the full length or width of the texture) but I want to know if there is a way to unwrap a mesh so that the planes are always unwrapped at the same scale instead of being stretched to fill the available space. If I unwrap a plane that is 25.6 units square, it fills the whole UV map. But if I unwrap a plane that is 12.8 units square, it still fills the whole UV map. I need to be able to unwrap all planes to the same scale so that I don't have to try to scale them all by eye. Otherwise, if I have a 12.8 square plane beside a 25.6 square plane the grid texture is twice as large on one as the other and I have to scale them to get them to match. Easy enough to do on a single piece, but hard to do when you are planning on creating dozens (or even hundreds) of separate pieces that have to tile seamlessly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...