Notifications
Clear all

[Closed] Retopology from the UV mesh

Marvelous Designer will not add this option. they are lying to their customers to update to the new versions.i think in 2013 they gave an official statement that it doesnt work how they envisioned

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Still U can use fantastic Zbrush (ZRemesher) or Mudbox Advanced Retopology solutions.

I not used till now Skin Wrap motifier. Change parameters and you can tell me what is the best settings.
Latter I can add these also in the script.
U can also continue with MassFx Cloth or default Cloth modifier or use Freeform Conform tools from Ribbon.

Can i ask for a video tutorial about this handy script?
I try it without success maybe i do something wrong…
Thanks in advance.

First download tool from here.
See how to export models (original and flat) from M.D.
http://www.youtube.com/watch?v=B7ZwPjCubs0
http://www.youtube.com/watch?v=ZMuw0sfMKQs
I don’t have installed Marvelous Designer but you can use code from post #4 as example.
Put this “example” code in Listiner , select whole code and press Shift+Enter.
U will see Master (green) and Flat (blue) object in the scene.
Take a look this Thumbs for more info.

would it be possible so that both the flattened and the retopo mesh are aligned to the marvelous designer mesh? since the retopo mesh has a different topology its hard to move and snap it to the right position.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Try when you imported obj’s (master and flat object) to aligne pivots at the center and then use this tool. If this not help send me some example. I not have M.D. for testing.

i have a test file. its 10mb big. where can i upload it?

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

I tested your example file (preview of example on above image)
The problem that you have is:
Your master object is the single object (one element) but your flat object, although it is a single object, it have 3 elements.
So you master and flat object have different number of verts and also verts ID placement is not the same.
Conclusion:
Master and flat object must have identical vertex count and disposition of indices.

i didnt find the right settings to have the same vertex count and placement. for now i use this script to make the flattened version
http://www.scriptspot.com/3ds-max/scripts/uv-2-mesh

i found this inspiration
http://www.evermotion.org/tutorials/show/8468/cloth-mesh-to-quadify-mesh

1 Reply
(@polytools3d)
Joined: 11 months ago

Posts: 0

I just wrote this little script that should help to rebuild the source object based on the UVW elements, so the number and index of vertices should match, allowing you to use a Morpher Modifier with them.

It won’t produce good results in some cases, for example if you have welded uvw faces, but it should works well for most meshes.
(
    /*
        Jorge Rodríguez
        jorge@polytools3d.com    
    
        Version 0.1 | 08.18.12
        Version 0.2 | 02.08.14
            + Added Fix Elements Option
                 http://forums.cgsociety.org/showthread.php?f=98&t=1153097 
    
        This tool will help you create a mesh from an object UVW Channel.
        
        *Fix Elements:
            If the number of UVW elements is different than the number of the
            object elements, it can reconstruct the source object to match the
            number of UVW elements.
    */
    
    try (destroydialog ::RO_UVW_MESH) catch()
    
    rollout RO_UVW_MESH "UVW Mesh v0.2" width:136 height:160
    (
    
        pickbutton bt_pick "Pick Object" pos:[8,8] width:120 height:24
        dropDownList ddl_channel "UVW Channel:" pos:[8,40] width:120 height:40 enabled:false
        
        checkbox chk_fix "Fix Elements" pos:[8,88] width:120 height:16 checked:true enabled:false
        button bt_build "Build" pos:[8,120] width:120 height:32 enabled:false
    
        local sourcenode
        
        fn BuildUvMesh node channel:1 fixelements:false size:100 =
        (
            m1 = snapshotasmesh node
            numtverts = meshop.getnummapverts m1 channel
            
            getmapvert = meshop.getmapvert
            getmapface = meshop.getmapface
    
            verts = for j = 1 to numtverts collect (getmapvert m1 channel j)*[size,size,0]
            
            meshop.setnumverts m1 numtverts
            meshop.setvert m1 #{1..numtverts} verts
            
            for j = 1 to m1.numfaces do
            (
                face = getmapface m1 channel j
                setface m1 j face[1] face[2] face[3]
            )
    
            if fixelements do
            (
                m2 = snapshotasmesh node
                m3 = copy m1
                
                for j = 1 to m1.numfaces do
                (
                    f1 = getface m1 j; f2 = getface m2 j
                    
                    setvert m3 (f1[1]) (getvert m2 f2[1])
                    setvert m3 (f1[2]) (getvert m2 f2[2])
                    setvert m3 (f1[3]) (getvert m2 f2[3])
                )
                
                mesh mesh:m3
                delete m2
                delete m3
            )
            
            mesh mesh:m1
            delete m1
            gc light:true        
            
        )
        
        fn UpdateUI flag arg items:#() =
        (
            ddl_channel.enabled = flag
            chk_fix.enabled = flag
            bt_build.enabled = flag
            bt_pick.caption = arg
            ddl_channel.items = items
        )
        
        on bt_pick picked node do
        (
            if superclassof node == GeometryClass do
            (
                m = snapshotasmesh node
                channels = for j = 1 to meshop.getnummaps m where (meshop.getmapsupport m j) collect j
                
                if channels.count > 0 then
                (
                    UpdateUI true node.name items:(for j in channels collect j as string)
                    sourcenode = node
                )else(
                    messagebox (node.name + " has no UVW channels.") title:"UVW Channels Not Found"
                    UpdateUI false "Pick Object"
                )
            )
        )
        
        on bt_build pressed do
        (
            if isdeleted sourcenode == false then
            (
                setwaitcursor()
                uvwchannel = ddl_channel.selected as integer
                fix = chk_fix.checked
                BuildUvMesh sourcenode channel:uvwchannel fixelements:fix
                if fix do hide sourcenode
                setarrowcursor()
            )else(
                messagebox (bt_pick.caption + " was deleted") title:"Node Deleted"
                UpdateUI false "Pick Object"
                sourcenode = undefined
            )
        )
        
    )
    
    createdialog RO_UVW_MESH style:#(#style_toolwindow, #style_sysmenu)
    
    )

Hey Jorge,
you did very nice job.
I added small update.


  (
 /*
 Jorge Rodríguez
 jorge@polytools3d.com	
 
 Version 0.1 | 08.18.12
 Version 0.2 | 02.08.14
 	+ Added Fix Elements Option ( http://forums.cgsociety.org/showthread.php?f=98&t=1153097) 
 Version 0.3 | 02.11.14
 	+ Added Real Scale Option
 
 Description: This tool will help you create a mesh from an object UVW Channel.
 
 *Fix Elements:
 	If the number of UVW elements is different than the number of the
 	object elements, it can reconstruct the source object to match the
 	number of UVW elements.
 *Real Scale:
 	User can now choose between custom scale input value (default 100) or auto "real" scale value 
 	which approximately matches polygon size.
 */
 
 try (destroydialog ::RO_UVW_MESH) catch()
 rollout RO_UVW_MESH "UVW Mesh v0.2" width:136 height:180
 (
 	local sourcenode
 	
 	pickbutton bt_pick "Pick Object" pos:[8,8] width:120 height:24
 	dropDownList ddl_channel "UVW Channel:" pos:[8,35] width:120 height:40 enabled:false
 
 	checkbox chk_rs "Use Real Scale" pos:[8,78] width:120 height:16 checked:true enabled:false
 	spinner spn_scale "Scale: " pos:[8,100] fieldwidth:75 range:[.1,1e5,1e2] enabled:false
 	
 	checkbox chk_fix "Fix Elements" pos:[8,120] width:120 height:16 checked:true enabled:false
 	button bt_build "Build" pos:[8,140] width:120 height:32 enabled:false
 	
 	fn getRealScale node channel =
 	(
 		local v1 = getVert node 1
 		local v2 = getVert node 2
 		local mv1 = meshop.getmapvert node channel 1
 		local mv2 = meshop.getmapvert node channel 2
 		(distance v1 v2)/(distance mv1 mv2)
 	)
 	
 	fn BuildUvMesh node channel:1 fixelements:false size:396.34 realScale:on = 
 	(
 		size = if realScale then getRealScale node channel else size
 		local m1 = snapshotasmesh node
 		local numtverts = meshop.getnummapverts m1 channel
 		local getmapvert = meshop.getmapvert
 		local getmapface = meshop.getmapface
 		local verts = for j = 1 to numtverts collect (getmapvert m1 channel j)*[size,size,0]
 		
 		meshop.setnumverts m1 numtverts
 		meshop.setvert m1 #{1..numtverts} verts
 		
 		for j = 1 to m1.numfaces do
 		(
 			face = getmapface m1 channel j
 			setface m1 j face[1] face[2] face[3]
 		)
 
 		if fixelements do
 		(
 			m2 = snapshotasmesh node
 			m3 = copy m1
 			
 			for j = 1 to m1.numfaces do
 			(
 				f1 = getface m1 j; f2 = getface m2 j
 				
 				setvert m3 (f1[1]) (getvert m2 f2[1])
 				setvert m3 (f1[2]) (getvert m2 f2[2])
 				setvert m3 (f1[3]) (getvert m2 f2[3])
 			)
 			
 			mesh mesh:m3
 			delete m2
 			delete m3
 		)
 		
 		mesh mesh:m1
 		delete m1
 		gc light:true		
 		
 	)
 	
 	fn UpdateUI flag arg items:#() =
 	(
 		ddl_channel.enabled = chk_fix.enabled = bt_build.enabled = chk_rs.enabled = flag
 		bt_pick.caption = arg ; ddl_channel.items = items ; spn_scale.enabled = not chk_rs.enabled
 	)
 	
 	on chk_rs changed state do spn_scale.enabled = not state
 	
 	on bt_pick picked node do
 	(
 		if isKindOf node GeometryClass do
 		(
 			m = snapshotasmesh node
 			channels = for j = 1 to meshop.getnummaps m where (meshop.getmapsupport m j) collect j
 			
 			if channels.count > 0 then
 			(
 				UpdateUI true node.name items:(for j in channels collect j as string)
 				sourcenode = node
 			)else(
 				messagebox (node.name + " has no UVW channels.") title:"UVW Channels Not Found"
 				UpdateUI false "Pick Object"
 			)
 		)
 	)
 	
 	on bt_build pressed do
 	(
 		if isdeleted sourcenode == false then
 		(
 			setwaitcursor()
 			uvwchannel = ddl_channel.selected as integer
 			fix = chk_fix.checked
 			BuildUvMesh sourcenode channel:uvwchannel fixelements:fix
 			if fix do hide sourcenode
 			setarrowcursor()
 		)else(
 			messagebox (bt_pick.caption + " was deleted") title:"Node Deleted"
 			UpdateUI false "Pick Object"
 			sourcenode = undefined
 		)
 	)
 	
 )
 createdialog RO_UVW_MESH style:#(#style_toolwindow, #style_sysmenu)
 )	
 
1 Reply
(@polytools3d)
Joined: 11 months ago

Posts: 0

Thank you Branko, size was coming next, but now it’s done

PD: There is a minor bug in the “getRealScale” function:

fn getRealScale node channel =
 (
 	local v1 = getVert node 1
 	local v2 = getVert node 2
 	local mv1 = meshop.getmapvert node channel 1
 	local mv2 = meshop.getmapvert node channel 2
 	(distance v1 v2)/(distance mv1 mv2)
 )
Page 2 / 4