PDA

View Full Version : UV distortion on subdiv surfaces (again and again...)



TerryFord
03-27-2003, 03:49 PM
On the old message board there was a thread/feature request to fix the texture distortion that happens with UVs on subdivided objects. IIRC Arnie Cachelin explained some of the technical problems involved, at which point I stopped arguing for it :)

Anyway, I just came across this Maya workaround, it appears to address the texture distortion issue with "smoothed" meshes (not exactly subdiv as we know it but a similar "metaform" effect). So I'm wondering; would applying the metaform algorithm to the 2D UVs (as though it were a flat 3D object) fix the distortion problem, as it appears to here;

UV smoothing? (http://www.drone.org/tutorials/uv_smoothing.html)

I hope this doesn't come across as a grandmother/egg sucking tutorial to the Newtek guys, it's probably not a simple as this. Just food for thought... :)


Regards,
Terry

Tom Speed
03-30-2003, 09:14 AM
Hi,

I've been messin with some scripting and I'm glad I did, I've accidentaly found a solution to a task I always wanted to automate somehow, so thanks for that! LOL

Anyway, back to the Smoothing stuff, try these 2 scripts. Unweld your mesh, make the UV map you want copied to a Morph the current map in the UV window, have the BASE MorphMap selected, run 'UV to MorphMap' and it copies the UV to a MorphMap.

Mergepoints on the Mesh then you can use any of Modelers tools to adjsut the Mesh (NOT the UVs!) ...Drag, Magnet, Smooth :)

When you've finished, keep your original UV map selected and Deselect the UVMorphMap! VERY important this as I'm not sure how to get access to the Base meshes Point Positions while you have a MorphMap selected (yet).

So make sure you have the (base) Morph selected and run MorphMap to UV. It will copy the shape back to the original UV map, you might want to Mergepoints again after this step.

The cool stuff I found by accident? Well, when you Mergepoints on the Morphed Mesh, you end up with a nicely welded Mesh with NO discontinuous UVs! This is something I was after for my game Mesh exporter! :)

Oh, currently it ignores selections. I'll see if I can make it better later, dinner is calling me :)

Have fun
Tom

Castius
03-30-2003, 11:02 AM
I Just wanted to be the first to Thank you for this publicly. In case any was interesting any any ideas try this. Copy the uvmorphmap and make a few different projections and then use the airbrush to paint them into one map to blend between differnt typs of progections.
Great work Thanks

Tom Speed
03-30-2003, 01:05 PM
Hey Cas,

I can't believe the simplicity of it, and I'm suprised it wasn't done sooner! Cheers to Terry for the post b.t.w, this could have gone missed for a while if he hadn't brought this up.

Here's a slightly updated version, I'm using Absolute Morph Map now so you don't have to deselect the Morph Map before running the 'MorphMap to UV' script. The second script just mentioned also takes selections into account now, though I don't know if that's useful?

I've also made it create the Morph centred on the X axis, so you can use Symmetry mode, if you'd prefer to have it on 0,0 like in the UV window then edit the 2 scripts and take out the 2 references in each to '- .5' and '+ .5'

i.e:

vec.x=v[1] - .5; becomes vec.x=v[1];

To recap:

1: Unweld your Mesh
2: Select the UV map you want to be copied to a MorphMap
3: Run 'UV to MorphMap'
4: Mergepoints

Edit your Morphed UV Mesh, DON'T Edit in UV window :)

At any time while you have your original UV Map selected, run 'MorphMap to UV' to copy the Morphed Mesh shape back to the UV Map .

The script doesn't delete the 'UVMorphMap' Morph so you can do that when you're finished.

Any ideas for improvement?

Cya!
Tom

TerryFord
03-30-2003, 01:21 PM
Great script Tom, it opens up all of Modelers tools for UV editing. I did a quick test with a frozen subpatched head to see if the Maya technique holds up;

Normal freeze, distortion typical of UV on subdiv:
http://www.terryf.dsl.pipex.com/gif/smallmaps/uvtest2.jpg

Freeze including UV morph, morph transfered back to UVs (in effect applying subdiv algorithm to the UV map):
http://www.terryf.dsl.pipex.com/gif/smallmaps/uvtest1.jpg

Just a quick test, but interesting (the lump on top of the second head is a result of unmerged points, fixable but I couldn't be a*sed)...

This script won't completely fix the distortion on an unfrozen subpatch object (because there's no way to access the extra verts that subdivs create without freezing), but it will decrease distortion, and seems to prove that if the subdiv UVs are "smoothed" the distortion problem gets fixed (or at least drastically reduced). I wonder if it holds up with a heavily edited or segmented UV map...

Kudos Tom. :)

Regards,
Terry

Valter
03-30-2003, 03:04 PM
hmmmm....
very cool

Tom include a little doc on zip file if possible. :D

thanks Tom I will try it.

ninjaman
03-30-2003, 04:54 PM
Darn! Hey Admin! Can´t download the script from here! I´m logged in and everything. On a Mac with Explorer.

Johan Grönwall

Tom Speed
03-31-2003, 04:45 PM
Hi,

The lump on the head is because of subdividing while you have the morphmap active. Because the 'seem' is unwelded in this state, it doesn't receive any smoothing during the subdivision process, so a little tweaking will be needed afterwards.

I noticed something else, while you have an Absolute morphmap (pretty sure it applies only to Absolute morphmaps which I use in the script), regardless if you have the base morph selected or not, when you mergepoints it will not merge any points on the seems, similar to the above side effect. So remove the morphmap before you do the final mergepoints.

Someone has requested a version of the script that will work on LScript 2.5 because of Mac 7.5b update problems, I'll sort something out for you guys.

Cya later
Tom

JDaniel
04-01-2003, 12:33 AM
(because there's no way to access the extra verts that subdivs create without freezing),
Terry, that is key. So here is the only true LW distortion free/uvSubd tutorial. I'm simply Frnt. Projecting my maps in Layout and Baking to UVmap. Just like a 3d paint program. (Aura 3d!!!) :D


http://www.jackydaniel.com/pages/Tutorial.htm

Raul3d
04-01-2003, 04:44 AM
hello everyone, how do I can get this uv map?. I only can get this ugly uv map
http://www.iespana.es/raul3d/uvmap.JPG

regards

TerryFord
04-01-2003, 09:40 AM
Here's the old fashioned way;

For safety creat a temporary morph
Select Mode - Action center: selection
Select polys you want a cylindrical UV map for
Rotate 90 degrees around Y axis ("e" shortcut in top viewport)
Create new UV
Rotate back - 90 degrees ("r" shortcut) or delete the temporary morph
Merge points (when you've finished moving the UVs around)

Or you could get this in-development UV guide tool;
UV Guide II (http://vbulletin.newtek.com/showthread.php?s=&threadid=1272)

:)


Regards,
Terry

ninjaman
04-01-2003, 01:17 PM
The LW community is simply frikkin awesome! What fantastic talents you find out there! I wonder if it is the same with other 3d communitys. Doubt it.

Johan Grönwall

Tom Speed
04-01-2003, 01:44 PM
Hi,

Here's 7.5 versions of the scripts for the Mac guys, you'll have to select the UV map each time from a requester. Let me know if there's anything wrong with them.


Cya!
Tom

p.s Terry, didn't realise you're the author of SpinTris, there's not many plugs/scripts I'll give a hotkey to, but SpinTris sure gets one! :)

Raul3d
04-01-2003, 01:53 PM
Thanks terry for your reply and your help. This plugin is really awesome ,thaks Lynx3d for share.

Regards

ninjaman
04-01-2003, 02:13 PM
Admiiiin...! There is some sort of d/l problem on the Mac. All I get is a file called "attachment.php" when I try to d/l the script. I´m on Explorer 5.1, but this is the same for Explorer 4.5, Netscape, 4 and 6.01. Yeah, got´em all.

Johan Grönwall

jin choung
04-08-2003, 03:58 AM
hey tom,

that's a freakin' great lscript! being able to automate these workarounds almost make it seem like they're not workarounds!

say, you should check out that link to the front projection dealy because that is indeed a way to create a non distorting texture projection onto a non frozen SDS mesh.... basically, it does it by "counter distorting" your texture map....

that makes editing the texture map and the process of mapping a bit less fluid than one would like.... but perhaps you may have some scripting ideas to address it.

other than that, just make sure your docs are included in the zip (or perhaps embedded somehow in the script - or it takes you through it step by step) and the thing rocks.

newtek should keep an official 'workaroud plugs' department to treasure gems like yours.

jin

JDaniel
04-08-2003, 04:49 PM
Jin, I don't think some people are understanding my discovery. My tutorial is'nt the best written either. I hate writing. Jin, if you could Bake in Modeler, then you could do this w/ out Layout. Like a 3d paint package. :D How many times have I said that?!


newtek should keep an official 'workaroud plugs' department to treasure gems like yours.
I sent this to Newtek months ago. but I guess they're real busy.

dobermunk
04-09-2003, 03:29 AM
:)
I've subscribed to this thread, and you're right - I don't understand you're work yet. But that's only because I haven't had the time to check it out.

If it does what I think it does: enable 'smoothing' of the uv map within modeler, then I thank you profusely!



Perhaps a tutorial in the way of a thanks?
http://www.stickman.de/content/stuff/process/tutorials/tut_select.htm

jin choung
04-09-2003, 03:56 AM
hey jack,

yah, i get the feeling that most people don't grasp the significance of your find either... but then again, it would only really register in people's consciousness if they tried it... and understood the underlying reasons for it.

probably everyone who participated in the thread where you made your announcement as well as several previous threads about sds distortion 'get it' and get it big time.

but it's there if people need it and you write fine.... plenty of great example screenies too.

as for this current thread, it addresses FROZEN meshes... in which case it's very conceivable you can make non distorting mappings. but the primary selling point is being able to use lw's modeling tools like "smoothing" (relaxing) on the "uv's"....

jin

jin choung
04-09-2003, 04:00 AM
hmmmmm,

hey tom, since the primary advantage IS being able to use lw modeler tools on the 'uvs' (after processing that is), it might actually be simpler to just lscript UV VERSIONS of lw modeling tools that don't work in uv view!

cuz, if the mesh is frozen, even within uv space, it is possible to create a non distorting uv map... albeit manually... especially if you use a grid bitmap while you adjust....

jin

JDaniel
04-10-2003, 01:17 AM
True Jin.

as for this current thread, it addresses FROZEN meshes... in which case it's very conceivable you can make non distorting mappings. but the primary selling point is being able to use lw's modeling tools like "smoothing" (relaxing) on the "uv's"....
You can do this w/ Meni's tech. if you freeze it.
Frozen meshes don't distort, if uvmap is reapplied after freezing. Or make map after freezing. But who wants to render a frozen sds object?
Meta-nurb and meta-form add geometry to the mesh. LW uv maps don't unless applied after.
And all workarounds I see are basically the same as Meni's, except done another way.
Baker applies texture to uv map after freezing, therefore working around the distortion from the added vertices.
3 differant uv results (http://www.jackydaniel.com/pages/uv_screen_ex.htm)

jin choung
04-10-2003, 02:24 AM
"But who wants to render a frozen sds object?"

exactly right!

jin

faulknermano
04-10-2003, 02:35 AM
Originally posted by jin choung
hey jack,

yah, i get the feeling that most people don't grasp the significance of your find either...

i do. and oh boy, do i EVER. :D


thanks again jack. i'm one big fan. :D

ninjaman
04-10-2003, 08:33 AM
JDaniel,

you have come up with some smart solution to the UV problem! But as you hint, your tut is somewhat hard to grasp for us mortals. As I read the tut, I get the impression that you "write as you think", that is - snappingly fast and from a standpoint of really knowing what you talk about. It´s just that, for a dumb guy like me who never saw this groundbreaking technique before, it gets a bit confusing, cause it´s not all a linear and logical layed out.

I know you hate to write, as you told us. But your technique is too good not to be made understandable to all LW users. Whenever I don´t get what people are saying, I always ask them to "explain it to me like I am a two year old". It might seem silly, but I think if you took your time and really described ALL steps in your technique from A-Z, using only one model, without thinking that anyone understood anything, then everyone would get everything! I sincerely hope you do!

Regards

Johan Grönwall

faulknermano
04-10-2003, 10:57 AM
it's a "re-projection of the of the texture maps against the UV VMap by allowing Layout to first freeze the object before applying the texture, thus remapping, or remodifying the texture map itself to suit the intrinsic UV distortions."

does that make it clearer.


(hehehehe :D)

JDaniel
04-11-2003, 12:50 PM
faulknermano, you're welcome. I appreciate that.:o
ninjaman, do Meni's tutorial before mine. He explains why we use endomorphs to make custom uv maps. The only problem is when rendering Subd objects, Layout freezes geometry for processing, which adds vertices and hence, makes your map slightly distorted. The way around this is to freeze your mesh and reapply uv map. YUK!!!
I learned that Baker processes your map after freezing. So now your map is distorted but when applied it is perfect!
You can front project to your uv's on a Smart shaped endomorph or on the base object. Incident angled alphas help alot.
Hope this helps.:)

facial deluxe
09-19-2003, 07:05 AM
Awesome just freaking AWESOME :D

Any chance to have it on 7.5, seems it works only on 7.5b (and perhaps 7.5c) but I'm not confident with those releases...

dobermunk
09-19-2003, 07:11 AM
Hi Facial! Why 7.5 b?
It's been a while, but I'm sure I've done this in 7.5.

When does it go awry? Or what step doesn't work in 7.5?

JDaniel
09-19-2003, 06:51 PM
What doesn't work Facial? :confused:

The ripper
09-20-2003, 10:54 AM
Great scripts Tom Speed... have you ever considered make it a plugin??... I guess it would speed up the process on dense meshes!

Again... very useful scripts ;)

Keep on.

JDaniel
09-20-2003, 01:53 PM
Oh, the scripts. :)

The ripper
09-22-2003, 03:52 PM
Tom Speed: I did some tests with your scripts and I have a little problem with them.

When i use the Uv To Morphmap script, It creates a MorphMap from the UV map I have but if I try to apply that MorphMap to the base object... It says 'No MORF Vmaps to apply (create some first)'... is there something wrong with what I did?

The MorphMap appears in the Morph popup menu, I can delete or copy it but It seems the object doesn't recognize it.
Thanks.

FenrirWolf
11-19-2003, 02:57 AM
Ack, I'm trying to wrap my head around this distortion of UVs thing.

I've tried the two Lscripts, but I'm not sure what to do at the "edit your morphmap" part.

I assume this is what people are talking about? --->

http://www.gapingwolf.com/artwork/uvdistort.jpg

JDaniel
12-01-2003, 12:19 PM
Originally posted by Tom Speed


Any ideas for improvement?



After we create the morph, if you could do a morph of Normal info of the base to the morph. If a normal is the average of it's surrounding vertices, then this normal morph will make the uv2morph's vertice spread accurately? Like an Apply Morph, but on 1 axis.