Home Technical Talk

Turbosmooth VS Relax (to soften curves)

polycounter lvl 14
Offline / Send Message
THE 5 polycounter lvl 14
Asked that in "how u model dem shapes" too but I feel thats the wrong place.
So I want to put this question in a seperate thread.
While adding extra loops Turbosmooth also seems to average the curved surface in a specific way, different to a relax.
You all know the Vertex tweaking when defining a curved basemesh in order to give it a nice flow. Now turbosmooth seems to actualy do this automaticaly compared to relax somewhat killing the shape.
I think that method (turbosmooth + removing loops) could be a nice and fast way to average curves with not much effort, especialy when packed into a script.
I hope this graphic illustrates what I mean.
Turbosmooth-VS-Relax.gif
I'd like to know what you guys think about it.
Did I miss a function that already does this (in Graphite maybe)?
Does this give any advantage in tweaking lowpoly curves?
Is Relax superior?

Replies

  • THE 5
    Offline / Send Message
    THE 5 polycounter lvl 14
    Do you see any use for this script perna or are there better methods to soften bent surfaces?
    Anyways, I used the macro recorder like you said and got this:
    subobjectLevel = 2
    [B]actionMan.executeAction 0 "40021"[/B]
    $.EditablePoly.SetSelection #Edge [COLOR="Red"][B]#{1..840}[/B][/COLOR]
    modPanel.addModToSelection (meshsmooth ()) ui:on
    $.modifiers[#MeshSmooth].subdivMethod = 1
    $.modifiers[#MeshSmooth].iterations = 3
    macros.run "Modifier Stack" "Convert_to_Poly"
    subobjectLevel = 2
    [B]actionMan.executeAction 0 "40044"[/B]
    $.EditablePoly.SetSelection #Edge [COLOR="Red"][B]#{HUGE AMMOUNT OF NUMBERS HERE}[/B][/COLOR]
    $.EditablePoly.Remove ()
    

    The script seems not to remove the Edge's Verticies like I did with [Ctrl+Remove]. Behind the "#Edge" Statements,there are these arrays of integers, probably indicating what edges are selected. If I remove them completely the script won't work anymore, maybe I should use something like "#{NULL}"? And there are also this actionMan parts... huh?
    I don't realy expect someone to explain me maxscript now, I'm going to learn it during my semester break.
  • Revel
    Offline / Send Message
    Revel interpolator
    Hi 5, if I get your question right your question is to smoothed out some of the existing edges to better fit the surrounding without adding more geometry right?..then what I usually do is by going into Graphite>Loops>Set Flow (and turn on the Auto Loop if necessary) and Max will automatically adjust the placement if the edge(s) to make it look smooth with the surrounding. Hope this help.

    _Revel
  • cw
    Offline / Send Message
    cw polycounter lvl 17
    ok guys I was feeling helpful this morning so I spent 10 mins knocking this up.
    function  smoothshape obj =
    (
    	if classof obj == Editable_poly then
    	(
    		--copy object in case of disaster
    		backup = copy obj
    		backup.ishidden = true
    		if getcommandpaneltaskmode != #Modify then setCommandPanelTaskMode #Modify
    		subobjectLevel = 2
    		-- select all edges
    		polyop.setEdgeSelection obj #all
    		-- add meshsmooth mod
    		the_ms_mod = meshsmooth()
    		the_ms_mod.iterations = 3
    		the_ms_mod.isolineDisplay = on
    		addmodifier obj the_ms_mod
    		collapsestack obj
    		subobjectLevel = 2
    		isosel = polyop.getedgeselection obj
    		polyop.setedgeselection obj -isosel
    		update obj
    		--polyop struct does not support remove function so do it the other way
    		obj.remove()
    		subobjectlevel = 0
    		delete backup
    	)
    	else
    	(
    		messagebox "Please use editable poly object"
    	)
    )
    
    smoothshape $
    

    It's wrapped up in a function so anyone can plug it into ther stuff if they need to. Not much error checking etc. but you guys are smart, right? :)
  • THE 5
    Offline / Send Message
    THE 5 polycounter lvl 14
    Oh thanks Revel, that looks usefull!
    Gonna experiment with it.
    (Is there some sort of Graphite tools video-walktrough? I have seen one a while back, but it did not cover all tools.)

    cw: Thanks! Will give it a go ASAP.
  • Revel
    Offline / Send Message
    Revel interpolator
    Well not really, or maybe I just don't know of any video tutorial for Graphite specific (probably you can check the How-To videos from Autodesk website, I haven't check all of 'em)..but if you use the Polyboost toolset before, I guess you should be familiar with 80% of Graphite tools.

    And you can always hover the mouse over each tool to read the tool tips...it is a LONG explanation I know, but its worth the time..you just only need to read it 1 time and you good to go for the rest of the time.

    Btw, if you haven't notice this before, you can use Grapite>Edit>Swift Loop and holding SHIFT while click, you will add another edge loop with an adjusted "contour" to the surrounding surface to make it smooth (same with Set Flow but SHIFT+Swift Loop will add an edge loop with an auto Set Flow applied when you created it)

    Glad it can help you :)

    _Revel
  • THE 5
    Offline / Send Message
    THE 5 polycounter lvl 14
    Revel:
    I started 3D Modelling with Max 2010, so my first experiance with the poly-tools is from the Graphite-tools. The explanations are good but they don't describe secnarios where this could be usefull.
    I'll have a look at this Tutorial aggain.


    cw:
    Even with a EPoly selected it gives me the else statement.
    I put that whole thing into a macroscript and wrapped a undo arround but I am unexperianced with Maxscript. I guess I did something wrong :S
    macroScript Smoothshape category:"Fabians_tools" toolTip:"Smooth"
    (on Execute do
    	if classof obj == Editable_poly then(
    		undo "Smooth Poly" on
    		(
    		--copy object in case of disaster
    		backup = copy obj
    		backup.ishidden = true
    		if getcommandpaneltaskmode != #Modify then setCommandPanelTaskMode #Modify
    		subobjectLevel = 2
    		-- select all edges
    		polyop.setEdgeSelection obj #all
    		-- add meshsmooth mod
    		the_ms_mod = meshsmooth()
    		the_ms_mod.iterations = 3
    		the_ms_mod.isolineDisplay = on
    		addmodifier obj the_ms_mod
    		collapsestack obj
    		subobjectLevel = 2
    		isosel = polyop.getedgeselection obj
    		polyop.setedgeselection obj -isosel
    		update obj
    		--polyop struct does not support remove function so do it the other way
    		obj.remove()
    		subobjectlevel = 0
    		delete backup
    		)
    	)
    	else
    	(
    		messagebox "Please use editable poly object"
    	)
    )
    

    Ulimately this whole script should apply only on selected faces and keeps their boundary points fixed. But that shurely requires hardcore scripting skills, hehe ;p (I think the script I want will turn out to just be the same as relax.)
  • cw
    Offline / Send Message
    cw polycounter lvl 17
    hm not sure why that is. i will make it work on a selection and reup the script, let me know if it doesn't work next time.

    edit: on further investigation the method perna suggests doesnt work on sub selection very neatly at all. I think it might be sensible to look for a way of doing a relax like meshsmooth rather than actually doing it by meshsmooth. It's outside my comfort zone but I will have a look into it! It might be easy!
  • cw
    Offline / Send Message
    cw polycounter lvl 17
    tell a lie, I found a sneaky way to do it.
    function  smoothshape obj =
    (
    	if classof obj.baseobject == Editable_poly then
    	(
    		--make our smooth version
    		smt = copy obj
    		the_ms_mod = meshsmooth()
    		the_ms_mod.iterations = 3
    		the_ms_mod.isolineDisplay = on
    		the_ms_mod.ignoreSel = on
    		addmodifier smt the_ms_mod
    		collapsestack smt
    		
    		--get selected verts from original model
    		vertsel = (polyop.getVertSelection obj) as array
    		
    		--loop through array and reposition vertices to positions given by smoothed mesh.  indices line up conveniently.
    		for i = 1 to vertsel.count do
    		(
    			vert_i = vertsel[i]
    			this_vert = polyop.getvert obj vert_i
    			smt_vert = polyop.getvert smt vert_i
    			
    			polyop.setvert obj vert_i smt_vert
    		)
    		update obj
    		delete smt
    		gc()
    	)
    	else
    	(
    		messagebox "Please use editable poly object"
    	)
    )
    
    
    smoothshape $
    

    let me know if it doesnt work for you. Make a mesh, select some verts, then run the script. Should do the task required.
  • THE 5
    Offline / Send Message
    THE 5 polycounter lvl 14
    EDIT!
    Sorry it was my fault!
    When I load your new code into a new Maxscript and hit "evaluate all" it works perfectly! (In my macroscript I trimmed off the function declaration and it's execution, thus there was no object given to the function)
    Now how to put this into a macroscript and make it undo-able.
  • cw
    Offline / Send Message
    cw polycounter lvl 17
    I was thinking, it is probably simple to make a morpher modifier on the stack with the new vertex positions, then you can delete it from the stack, or lerp between the 2 sets of positions as you choose before collapsing.

    maybe too fiddly to be actually useful though?

    I'm glad you got it to work in the end. I hope it is useful. :)
Sign In or Register to comment.