Image map size relative to world units

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Image map size relative to world units // New Users

1  |  

Post by Grommit // Mar 23, 2007, 5:13am

Grommit
Total Posts: 32
pic
Hi everyone,


Is it possible at all to map an image to a surface in a way that the image is displayed as a fixed size in measured world units?


For example, I'm simulating kitchen wall tiles, where I know the exact dimensions of each tile in millimeters. I'd like to be able to set up a texture that uses an image of one tile and which will be applied to any surface while retaining the correct dimensions. I.e. the number of U and V repeats will be worked out automatically so that the tile is the correct size on the surface.


This would be really useful for all sorts of architectural surfaces.


Is this possible within TS at the moment? If not, it would make a very useful addition.


Many thanks

Grommit

Post by Jack Edwards // Mar 23, 2007, 5:27am

Jack Edwards
Total Posts: 4062
pic
Hi Grommit,


If you know the dimensions of your wall and your tile, then you should be able to figure out U and V by dividing the Wall dimension by the corresponding tile dimension.


Alternatively you could make each tile a separate object...


-Jack.

Post by prodigy // Mar 23, 2007, 5:48am

prodigy
Total Posts: 3029
pic
For example you have a titled texture with four squares black and wite.. 2 rows 2 columns..


on the model you know that any square are 10cm. then your texture must be on the model from 40x40cm.. and you get the correct dimetion on the Texture..


4999


It depends on how many tiles you have and know what is his real dimention to translate to the uv mapping

Post by Grommit // Mar 23, 2007, 6:46am

Grommit
Total Posts: 32
pic
Unfortunately, that is what I was afraid of, that you have to manually work out how to scale each dimension.

Rats. I do think a tool to work out U & V repeat values automatically based on inputting a standard dimensions would be an incredibly useful addition to any 3d program.

It seems an unnecessary waste of effort to have to work this out for each new surface, when the desired result is the same final mapped image size.


Thanks for the info guys.

Grommit

Post by Jack Edwards // Mar 23, 2007, 9:32am

Jack Edwards
Total Posts: 4062
pic
A more visual way you could do it is to place a box the size of a tile at the corner of the wall and scale the wall's planar mapping to match.


-Jack.

Post by Chester Desmond // Mar 23, 2007, 10:00am

Chester Desmond
Total Posts: 323
Textures are measured in pixels, objects in dimensional units. I'm not sure if there would be a way to match the two up. I guess as a feature, you would have to tell TS the dimensions of the texture (not the actual pixel dimensions, but the desired dimensions..ie 50mm x 50mm) when you load it and it would tile it according to the size info it gets from the object or specified face.

One way that might work is to select the wall or floor object (or whatever you are putting the 'tiles' on) paint it with the texture you are using and then bring up object info box. At this point it will look like one huge tile.

Enter planar UV mode and, in the object info box, set object conv. to mm (or whatever unit of measure you're using) and type in the xy dimensions of your tile.

Now you can move the (now small) UV space to one of the corners and it will tile from there, kind of like setting the very first tile in real life.

Post by Grommit // Mar 23, 2007, 1:22pm

Grommit
Total Posts: 32
pic
Ah, now that sounds like a good idea. I'll give it a try over the weekend. Thanks Chester.

Post by Délé // Mar 24, 2007, 12:03pm

Délé
Total Posts: 1374
pic
Hey Grommit,


Are you using tS7.1? If so I believe what you are looking for is possible. A while back I created a script called the Magic Box (here (http://forums1.caligari.com/truespace/showthread.php?t=1307)). When you apply an image texture to any of the planes, the plane automatically scales to the relative scale of the image so the texture doesn't warp at all. I think what you are looking for could be done with a little modification to the script. Instead of scaling the plane it would just set the UV reps. I'm kind of busy right now but I'll try to make this modification and post it when I get some time. :)

Post by Grommit // Mar 25, 2007, 12:33am

Grommit
Total Posts: 32
pic
I am indeed using 7.1 and eagerly awaiting my 7.5 upgrade. That sounds much more like the solution I've been looking for. I haven't got as far as scripts yet - thought I ought to learn how model properly first ;)


I'll look forward to trying out your script in due course.

Many thanks,

Grommit

Post by Délé // Mar 26, 2007, 12:50am

Délé
Total Posts: 1374
pic
Ok, well I don't know if this will be useful for you or not. I did put a little script together but it only works with DX materials. This might be adaptable to lightworks material but I'm not sure yet.


Anyway, this script does automatically determine the tiling based on the image size relative to the plane size. You can set the number of pixels you want to equal 1 meter. Measuring is done by Player side, not Model side. So 1 meter on Player side would actually be 2 on Model side. If you want me to change it to Model side measuring it would be easy enough, I would only need to divide my calculations by two within the script. :) This script uses the new architecture so the bridge will need to be on if you intend on using it in the Model view.


IMPORTANT: Do NOT use the widget for scaling the plane. This will cause the projection to scale and it will no longer be accurate. Use the scrubbers on the objects node in the LE. You CAN use the widget to move and rotate the plane without any problems.


5030

Post by Grommit // Mar 26, 2007, 9:47am

Grommit
Total Posts: 32
pic
Hi Dele, that's really kind of you :) Thanks very much indeed!

I'll try this very soon. Can't right now as we're having new carpet put in over the whole house tomorrow and we're in total chaos. Boxes & debris everywhere.

But I'll try it out very soon.

Best wishes

Grommit

Post by Nez // Apr 3, 2007, 2:59am

Nez
Total Posts: 1102
pic
This is one of those classic problems that particularly affects architectural type modelling - e.g. trying to apply a brick texture to the outside of the building and getting it to match the brick size/scale on each surface. Typically, you have to adjust the UV settings for each face that's being textured to ensure a correct match - very annoying.... I'm only back in TS5 and would definitely like a workaround to this....

Post by TomG // Apr 3, 2007, 5:32am

TomG
Total Posts: 3397
Procedural shaders can help overcome this, especially for repeating texture like brick which they can be quite good at. If you set the procedural texture to use World or Object mapping instead of UV mapping, then the scale of the texture is determined by position in space and not by the UV map (so is unaffected by scale of the object).


Other difficulties arise with this approach though of course, such as position in space affecting the texture, and it doesn't work so well on unusually shaped objects (in fact, it may begin to have problems when the face is not aligned exactly in a regular plane).


These problems are generally tougher to solve, which is why UV mapping is the standard method for working with textures - it avoids more problems than it causes. However, the approach is there as an alternative and it can help in some cases!



HTH!

Tom

Post by Nez // Apr 3, 2007, 6:46am

Nez
Total Posts: 1102
pic
Thanks - I'll have to look into that and see if I can figure out how to do it...

Post by TomG // Apr 3, 2007, 7:55am

TomG
Total Posts: 3397
PS - the items to look for, to use procedural shaders, would be Shader Lab, Shader Magic, and Darktree. These are procedural shader plugins that let you adjust whether a shader uses UV map, object co-ords, or world co-ords, so you can load up a brick texture (say) and then adjust how it is generated.


All three are available free these days.


HTH!

Tom

Post by SteveBe // Apr 3, 2007, 8:04am

SteveBe
Total Posts: 282
pic
A NURBS plane may work as well. Attached vid shows a NURBs plane with
planer mapping applied. One tile is sized to proper dimensions and then it
can be resized in edit mode and tile will repeat.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn