Jump to content

Lscm Texture Unwrapping


Recommended Posts

Ok so the nights are drawing in and the summer has gone, in England any way.. so I'm poking around with a bit more code.

I've been looking at texture unwrapping using LSCM. As used by the Blender and Roadkill apps among others.

There's still much to do but here is an initial cut, usual warnings apply. When its a bit further along I'll post it up on Houdinitools

I couldn't get it to work with the HDK built in matrix solvers so I've used OpenNL which is very easy to include, I think its pretty cross platform but I'm only working on windows, maybe someone on Linux can test for me???

Currently the list of things to do is as follows in rough order of importance

1. Automatically create seams from a user input edge list. Currently I use my point slide sop to do it just because it was there and did the job.

2. Add support for groups

3. Add colour coding of the stretching after the unwrap - this might be handy as a seperate sop actually (Sesi?)

4. Add ABF to the LSCM method to improve the unwrap for certain cases

5. Optimise the code by using SuperLU

Its pretty much usual as is but adding ABF will be important I think.

Adding SuperLU support will mean it can handle super sized meshes, the test one I used is fairly light but pretty typical I think, it solves pretty fast so its very usuable.

post-509-1192638667_thumb.jpg

TextureUnwrap.zip

Link to comment
Share on other sites

Hey Simon,

I've just tried to compile your SOP under Linux with HDK 9.0. There are some errors related to C++:

>/usr/bin/g++ -DUT_DSO_TAGINFO='"3262197cbf1359152da71e83421a82e5381f86a28f7c87fa59d592554743ed893fde2a8e853269430602adc7248e310d5ceee407f5d6e05e47063dea67fa96865bbe45a0ff924994a364d41247ba50acea6e94a384e7f3"' -DVERSION=\"9.0.734\" -DDLLEXPORT=  -D_GNU_SOURCE -DLINUX -DI386 -march=i686 -DSESI_LITTLE_ENDIAN -DENABLE_THREADS -DUSE_PTHREADS -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DOFSTREAM_PERMISSIONS="" -c  -DGCC3 -Wno-deprecated -I/opt/sidefx/hfs9.0.734/toolkit/include -I/opt/sidefx/hfs9.0.734/toolkit/include/htools -Wall -W -Wno-parentheses -Wno-sign-compare -Wno-reorder -Wno-uninitialized -Wunused -Wno-unused-parameter -O2 -DMAKING_DSO -o SOP_UVunwrapLscm.o SOP_UVunwrapLscm.c
In file included from SOP_UVunwrapLscm.c:36:
include/nl2.c: In function `void nlGetFunction(NLenum, void**)':
include/nl2.c:3667: error: invalid conversion from `NLboolean (*)()' to `void*'
include/nl2.c:3670: error: invalid conversion from `void (*)(double*, double*)' to `void*'
include/nl2.c:3673: error: invalid conversion from `void (*)(double*, double*)' to `void*'
SOP_UVunwrapLscm.c: In member function `void SOP_UVunwrapLscm::lscmMatrix(GU_Detail*)':
SOP_UVunwrapLscm.c:302: warning: unused variable 'row1'
SOP_UVunwrapLscm.c:303: warning: unused variable 'row2'
SOP_UVunwrapLscm.c: In member function `int SOP_UVunwrapLscm::splitVertices(GU_Detail*)':
SOP_UVunwrapLscm.c:457: error: variable `GB_PointRefArray prefarr' has initializer but incomplete type
SOP_UVunwrapLscm.c:488: error: no matching function for call to `GEO_Closure::findPolysUsingEdge(GEO_Point&, GEO_Point&, UT_IntArray&, <type error>)'
/opt/sidefx/hfs9.0.734/toolkit/include/GEO/GEO_Closure.h:56: note: candidates are: void GEO_Closure::findPolysUsingEdge(const GEO_Point&, const GEO_Point&, GB_PrimitiveGroup*, GB_PointRefArray&)
/opt/sidefx/hfs9.0.734/toolkit/include/GEO/GEO_Closure.h:63: note:				 void GEO_Closure::findPolysUsingEdge(const GEO_Point&, const GEO_Point&, UT_IntArray&, GB_PointRefArray&)
SOP_UVunwrapLscm.c:489: error: no matching function for call to `GEO_Closure::findPrimsUsingPoint(GEO_Point*&, UT_IntArray&, <type error>)'
/opt/sidefx/hfs9.0.734/toolkit/include/GEO/GEO_Closure.h:67: note: candidates are: void GEO_Closure::findPrimsUsingPoint(const GEO_Point*, GB_PrimitiveGroup*, GB_PointRefArray&)
/opt/sidefx/hfs9.0.734/toolkit/include/GEO/GEO_Closure.h:74: note:				 void GEO_Closure::findPrimsUsingPoint(const GEO_Point*, UT_IntArray&, GB_PointRefArray&, unsigned int)
SOP_UVunwrapLscm.c:480: warning: unused variable 'count'
SOP_UVunwrapLscm.c:461: warning: unused variable 'test'
SOP_UVunwrapLscm.c: In member function `void SOP_UVunwrapLscm::defaultPins(GU_Detail*)':
SOP_UVunwrapLscm.c:652: warning: unused variable 'i'
SOP_UVunwrapLscm.c: In member function `virtual OP_ERROR SOP_UVunwrapLscm::cookMySop(OP_Context&)':
SOP_UVunwrapLscm.c:845: warning: unused variable 'i'
Compile failed

Edited by hoknamahn
Link to comment
Share on other sites

I notice a lot of these uv apps have the ability to auto pack multiple sections into one set of uv coordinates, I think if I add group support I'll leave it to the user to pack the groups themselves using the output ranges. You probably end up with a better pack that way anyhow and it saves me a lot of work.

Anyone know what this error means

SOP_UVunwrapLscm.c:457: error: variable `GB_PointRefArray prefarr' has initializer but incomplete type

the line it refers to is this

GB_PointRefArray prefarr(gdp,0);

It compiles fine on windows and not on Linux...

Edited by sibarrick
Link to comment
Share on other sites

updated code...

number of linux fixes, plus colour coding for stretching...

Thanks very much for giving these to the community! :)

If you are ever interested in a shell account to a linux box on which you can test building these, then PM me. 64-bit suse is the flavor.

Link to comment
Share on other sites

  • 2 weeks later...

From what I understand of this method in order to fix those areas you need to add some more pins.

Pick a couple of vertices in each of those areas and create uv pins for them that are a little further apart.

If you do a search for tutorials on LSCM you'll find quite a few that use blender

Blender tut 1

Blender tut 2

Blender tut 3

and others

Other

The workflow is different but the results and issues should be much the same. I've posted a basic workflow tut on my website for using my sop, hopefully you can apply that to the above tuts.

PS the quickest way to sort out the situation you show is with the UVbrush in smooth mode...

Edited by sibarrick
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.

×
×
  • Create New...