[Plugin] Fix Reversed Face Materials

[Plugin] Fix Reversed Face Materials

Postby TIG » Fri Aug 13, 2010 1:38 pm

It is always good practice to create your Sketchup forms correctly with all of the faces oriented the proper way, so that the front-face is facing outwards where you might see it and it has any required material/texture applied to it - and conversely the back-face is inside and never has a material applied, as it's not seen or rendered by most renderers. The way for example that a OBJ/MTL exporter works is that every face is exported as it has been modeled - i.e. if a face's front has no material the 'Default-Material' is used for that face. This can mean that you get unexpected results when rendering your model IF you have some incorrectly oriented faces - i.e. the back-face is actually looking outwards and has a material/texture applied to it, but the front-face is left without a material - it looks fine in the SKP but it is 'blank' in the rendered version. You can fix individual faces by sampling the back-face material, reversing the face and applying the material to the front face - repeating this for every wrong face ! This can be a big chore - BUT you should have made it right in the first place !!! :evil:
BUT I have now written a script for you to help fix this
    (c) TIG 2010-2012
    [incorporates some of ThomThom's UV ideas too]
    FixReversedFaceMaterials.rb
    Usage:
    Plugins > TIG: Reversed Face Tools... > Fix Reversed Face Materials
    Select entities including any suspect faces [edges etc are ignored].
    If any face has a back-material BUT it has no front-material it is assumed
    to have been made incorrectly and to be oriented the wrong way round,
    with the desired material applied to the back instead of the front.
    So then the face is reversed and its front-material is made to match the
    back-material - including any UV-mapping appropriately corrected -
    the back-material is then removed.
    If there is no selection you are asked if you want to process the whole
    model, if you reply "Yes" then absolutely everything is selected !
    If the selection includes groups or components you are asked if you want to
    process these too - if you reply "Yes" then any faces inside them are also
    processed. If there are 'nested' groups or components with these they are
    also processed through the nesting.
    A closing dialog reports how many faces have been fixed.
    To see the affect switch from Texture mode and view in MonoChrome mode, run
    the tool and you should see the changed faces flip - switch back to Texture
    mode and you should see no difference in appearance since all the materials
    should still be the same, but incorrectly oriented faces have been fixed.

    IF there are still backfaces oriented the wrong way then they will have
    materials applied to both sides and so will have been excluded from the fix.
    There is another option to force selected faces to flip, swap the front and
    back materials and then delete the unneeded material that is by then
    swapped onto the back face.
    Plugins > TIG: Reversed Face Tools... > Fix Reversed Face Materials [Forced]
    Use this option with care! It will flip any selected faces that have
    materials applied to both faces, swap the materials over and delete the
    material that is by then swapped onto the back face. Pick only the faces
    you know to be wrong [in MonoChrome], otherwise you might mess up already
    correct faces. As a safety precaution if any of the selected faces have
    their front face towards the camera a dialog asks if you want to continue -
    if you answer 'Yes' then they are all processed, if you answer 'No' then
    the operation is canceled and nothing is changed.

    If you have an object [say an imported OBJ] where faces/materials are inverted
    you can force the faces to reverse keeping the correct material texture
    UV-mapping on the flipped materials...
    Plugins > TIG: Reversed Face Tools... > Reverse Faces and Materials
    Use this option with care BUT you can undo or redo to re-flip back.
    It will reverse any selected faces, and swap the front/back materials over
    so the inside material becomes the outside material, whilst keeping the
    UV-mapping [smething that is lost with simple 'reverse faces' in surfacss].

    Once you are happy that you model has its faces oriented as desired then
    there is another tool to tidy up face-materials...
    Plugins > TIG: Reversed Face Tools... > Delete Back-Materials
    Select entities including any faces with back-materials you want processing
    [edges etc are ignored].
    If any selected face has a back-material its material will be deleted.
    If there is no selection you are asked if you want to process the whole
    model, if you reply "Yes" then absolutely everything is selected !
    If the selection includes groups or components you are asked if you want to
    process these too - if you reply "Yes" then any faces inside them are also
    processed. If there are 'nested' groups or components with these they are
    also processed through the nesting.
    A closing dialog reports how many faces had their back-materials
    deleted.
    Note: Groups and Component-Instances that can have materials applied
    directly onto them - then any faces within them that have the default-
    material [front and/or back] will then appear to have that material applied
    to them. In fact these faces within the Group/Definition will still have
    the default-materials [front and/or back]. If you want to quickly remove
    the appearance of this material on the back-faces within the group then
    explode the group and immediately regroup the geometry - the group's
    previous material will then be individually transfered to each face that
    had the default-material. Now use this 'Delete Back-Materials' to delete
    the unneeded back-material. With component-instances you can similarly
    explode the instance and immediately make its geometry into a Component -
    using a new name if only that instance is to change or using the same name,
    overwriting the original definition to update all instances of it -
    however, remember that you can have several instances of a definition with
    different materials applied to them and displayed in lieu of the default-
    material, so doing this might have unexpected consequences, so think
    beforehand!
    Use 'Delete Back-Materials' this with care and only AFTER using other tools
    to correct flip and/or swap front/back material etc...

    If you have faces with different materials front and back and you would like the
    back to match the front use this tool...
    Plugins > TIG: Reversed Face Tools... > Match Back-Materials
    It will match all selected faces' back-materials with the front-materials,
    maintaining UVmapping if the material is textured etc...
    There is no reversing or flipping of faces - the back-material is simply matched
    to the front-material.
    Do not use this as an excuse for sloppy modeling!

    Donations:
    by PayPal to info @ revitrev.org

    Version:
    1.0 20100806 First Issue.
    1.1 20100811 Text deBabelized.
    1.2 20100816 'Forced' option added and lingvos updated.
    1.3 20100817 New 'Delete Back-Materials' tool added.
    Glitch in translation of strings fixed.
    Updated all lingvos.
    1.4 20100826 New 'Reverse Faces and Materials' added.
    1.5 20120216 Four tools now under "Plugins > TIG: Reversed Face Tools..."
    1.6 20120716 New 'Match Back-Materials' added. Lingvos updated to suit.
This should make fixing your badly made models so that they'll render properly much easier :roll: BUT don't let it become an excuse to be a sloppy modeler :geek:
1.7 20131205 Future-proofed.
1.8 20140304 Some lingvo files updated to be compatible with v2014.

Download

9
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby Dave R » Fri Aug 13, 2010 6:07 pm

Thank you TIG. This plugin will be a good one to recommend to a number of folks I know who are tired of me harping on the subject of reversed faces.
3
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Sat Aug 14, 2010 9:40 am

Here is an updated lingvo file in Spanish [made by Defisto] with some changes in gender and idiom improvements.
Unzip it and put it into the ../Plugins/FixReversedFaceMaterials/ folder.
Aquí un actualizado archivo-lingvo en español [hecho por Defisto] con algunos cambios de género y la mejora de idioma.
Descomprímelo y lo puso en la carpeta ../Plugins/FixReversedFaceMaterials/.
FixReversedFaceMaterialsES.zip
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby Didier Bur » Sat Aug 14, 2010 12:59 pm

Hi TIG,
Here is the FR lingvo file with some gender and grammatical modifications.
I have integrated it in the Zip (and the ES file as well) before uploading it to the Ruby Depot.
Regards,
0
Didier Bur
User avatar
Didier Bur 
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Sun Aug 15, 2010 8:28 pm

Thanks Didier...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Mon Aug 16, 2010 11:20 am

Here's v1.2 viewtopic.php?p=264134#p264134
It has updated lingvo files and an additional tool "Fix Reversed Face Materials [Forced]" that works only on selected faces - it will flip a selected face if it has a back-material and then make its front-material the former back-material and remove the then unneeded back-material - even if there is already a front-material defined. See the notes in the linked thread. Use the new option with care as it could mess up already correctly setup faces, unlike the other option: note that it does warn you if you have selected a face to fix that is facing the camera as this might mean you have picked it in error...
Happy fixing...
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Tue Aug 17, 2010 12:43 pm

Here's v1.3 viewtopic.php?p=264134#p264134
New 'Delete Back-Materials' tool added.
[Read the notes and use with caution...]
Glitch in translation of strings fixed.
Updated all lingvo files to suit.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby mitcorb » Tue Aug 17, 2010 3:30 pm

quoted "BUT don't let it become an excuse to be a sloppy modeler :geek: "
Amen, brother, Amen. ;)

Of course, I am in denial. I never model sloppily :mrgreen:
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby utiler » Wed Aug 25, 2010 2:43 am

Hi TIG, once again wonderful contribution to the SU community.

I gather you only select the faces you need reversed? Can't you already do that then context click and reverse face?

Please pardon my ignorance if I'm missing something..... :?
0
purpose/expression/purpose/....
User avatar
utiler 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby d12dozr » Wed Aug 25, 2010 4:21 am

Andrew,
As I understand it, this plugin reverses faces AND fixes materials that are applied to the back face...usually if you have materials applied to a back face and you reverse that face, the material stays with the back face and you have to reapply it to the corrected front face. Does that make sense?
0
3D Printing with SketchUp Book
http://goo.gl/f7ooYh

d12dozr 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby utiler » Wed Aug 25, 2010 4:49 am

Thanks Mate, I see now. What I was hoping for was it would reverse multiple faces to to correct orientation. You can't rely on Orient face to sort out the I get into....

:thumb:
0
purpose/expression/purpose/....
User avatar
utiler 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Wed Aug 25, 2010 1:06 pm

It's NOT an "orient faces" tool.
The built in 'orient' plus 'reverse' is the best you'll get, and these will fail on edges with more than two faces, because then one face must be oriented wrongly relative to one of the others sharing that edge.
My tool[s] takes faces you have modeled [or inherited in an imported file] that have a texture applied/mapped and that look OK in Textured mode BUT that are actually made 'backwards' when viewed in Monochrome mode. Such faces will NOT import properly in most 3rd party renderers - they just do what you tell them to - the incorrectly oriented front-face has no material and faces away from the required direction anyway and the back-face is not usually given a material by the renderer either. Therefore I wrote this tool to flip any face that has a material on its back-side but not its front-side AND it also swaps the material over to to the front [you don't notice any change except in Monochrome mode]... You will then end up with all of the faces pointing in the same orientation and with their materials applied/mapped, so they look exactly as before. There is also a 'forced' version of the tool that flips a selected face, moves its back-material onto the front-face [properly mapped etc] and then deletes the then unused back-material [which had been formerly on the front-face!] :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby EarthMover » Wed Aug 25, 2010 3:03 pm

This works very well. Thanks TIG, it saved me a ton of time on a recent project where I inherited a model that was poorly built. :thumb:
0
3D Artist at Clearstory 3D Imaging
Guide Tool at Winning With Sketchup
Content Creator at Skapeup
User avatar
EarthMover 
Premium Member
Premium Member
 

Re: [Plugin] Fix Reversed Face Materials

Postby pilou » Wed Aug 25, 2010 3:12 pm

Maybe some little images for speed understand the concept ? :)
1
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Wed Aug 25, 2010 3:32 pm

Here's a simple example
FixRFM.PNG
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby utiler » Wed Aug 25, 2010 11:24 pm

Thanks TIG, clear as crystal now....
0
purpose/expression/purpose/....
User avatar
utiler 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby pilou » Wed Aug 25, 2010 11:52 pm

A black crystal :D
Faces are or are not well oriented :)
If they are false they must be reverse (material or not) :shock:
Then apply material :)

Maybe I miss something :mrgreen:
0
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby utiler » Thu Aug 26, 2010 1:46 am

Pilou wrote:A black crystal :D
Faces are or are not well oriented :)
If they are false they must be reverse (material or not) :shock:
Then apply material :)

Maybe I miss something :mrgreen:



maybe you're just a little crazy my man..... ;)
0
purpose/expression/purpose/....
User avatar
utiler 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Thu Aug 26, 2010 9:03 am

Pilou - There is no way of knowing if a particular face is 'the wrong way round'. Especially if an edge has more than two faces.
The built-in 'Reverse' & 'Orient' will consistently arrange faces that are 'manifold', BUT if you have applied materials to a back-face then that won't flip onto the front-face.
This tool simply finds all selected faces that have a back-material but no front-material - it then can assume you have modeled them 'wrongly' and it reverses the faces and flips the back-material so it becomes the front-material. keeping the UV-mapping intact etc. This is important when 3rd party applications render the image exactly as you've exported it - i.e. most of them do not render the 'back-faces' at all - rendering only the front-face materials - which in such cases will be the 'wrong' side of the face!
This might well often look like an 'orient' operation - in the image example all faces do end up correctly oriented too - BUT 'orient' alone would not sort out the wrongly applied materials, as this tool does.
The tool's 'forced' option is similar, but that works even if a selected face with aback-material that has a front-material, reversing the face and using the back-material on the front-face instead and defaulting the back-material - because it is more 'dangerous' its sphere of operation is more limited...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby pilou » Thu Aug 26, 2010 9:21 am

This tool simply finds all selected faces that have a back-material but no front-material

That the Knot :)

In your image example walls have not thick, does the plug works also with thick walls ?
I suppose yes but... :)
wall.png
0
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Thu Aug 26, 2010 1:39 pm

The tool works for any faces - as long as they only have a material on the back and not the front.
It simply reverses the face whilst leaving the materials in the same 'location' [orientation].
With an 'un-fixed' face - flick between Textured Mode and Monochrome Mode to reveal faces that are 'wrongly' oriented but have their materials on the back so look OK in the SKP-render BUT will fail in the external-renderers.
With a face that's 'fixed' it looks the same in the SKP 'Texture Mode', but it will then render properly in renderers [the Monochrome Mode should then show all faces oriented the same]
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Thu Aug 26, 2010 1:56 pm

Here's v1.4 viewtopic.php?p=264134#p264134
It has an additional Tool 'Reverse Faces and Materials' - this reverses faces keeping their materials with correct UV-mapping - effectively turning the form 'inside out': if it is 'brick' outside and 'wood' inside with the 'back-faces' oriented to the 'outside', then using the tool reverses the faces so that the back-faces are oriented to the 'inside', AND now the 'wood' material will be on the 'outside' and the 'brick' material will be on the 'inside' - UV-mapping will have been correctly reapplied.
For example I recently had an imported OBJ object that had all some objects with faces reversed ['blue' outwards] and so their materials were mapped [correctly] on their 'insides'. Simply 'reversing' the faces failed to keep the UV-mapping on the new face orientations [on 'smoothed' surfaces it's especially problematical] - but this tools now solves that problem.
The included lingvo files have all been updated to match the changes.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby pmolsen » Wed Sep 08, 2010 12:55 am

TIG wrote:Note: Groups and Component-Instances that can have materials applied
directly onto them - then any faces within them that have the default-
material [front and/or back] will then appear to have that material applied
to them. In fact these faces within the Group/Definition will still have
the default-materials [front and/or back]. If you want to quickly remove
the appearance of this material on the back-faces within the group then
explode the group and immediately regroup the geometry - the group's
previous material will then be individually transfered to each face that
had the default-material. Now use this 'Delete Back-Materials' to delete
the unneeded back-material.


Excellent plugin! Exactly what I have been waiting for.

I think I must be missing something with your above comment though. As you say if a group or component is textured with a material without first opening the group or component, all untextured faces, including the back faces, appear to be painted with that texture.

To fix the problem there is no need to ungroup and regroup as stated above. Simply select the default texture (either from the materials window or by sampling an untextured front or back face) then paint the unopened group or model. All untextures faces go back to untextured the way they should be.
0

pmolsen 
 

Unexpected Error on Load

Postby pmolsen » Wed Sep 08, 2010 1:06 am

When I start Sketchup after installing the plugin I get the following error:

Error Loading File FixReversedFaceMaterials.rb
No such file to load -- deBabelizer.rb

I checked the zip file and there is no such file in it. I found a copy in the Lattice Maker plugin but it should really be in this one as well.

Also what is the Sketchup8 link that is installed in the subfolder?
0

pmolsen 
 

Re: Unexpected Error on Load

Postby TIG » Thu Sep 09, 2010 9:14 pm

pmolsen wrote:When I start Sketchup after installing the plugin I get the following error:
Error Loading File FixReversedFaceMaterials.rb
No such file to load -- deBabelizer.rb
I checked the zip file and there is no such file in it.
I found a copy in the Lattice Maker plugin but it should really be in this one as well.
Also what is the Sketchup8 link that is installed in the subfolder?

Sorry about this... it is always the same 'deBableizer.rb' file... BUT I have now added it to the zip [ viewtopic.php?p=264134#p264134 ] - it was packaged with the earlier zipped versions, but I missed it out of this one :oops:
I also managed inadvertently to add a shortcut linking to my copy of SUp v8 [luckily it's all public now anyway] - but that's now gone too !!! I just had a really bad day :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby Aerilius » Sun Sep 12, 2010 11:17 pm

No problem, that shortcut was not dangerous :)
Many thanks, this is the best reversed-faces-plugin that I ever found :thumb:

I saw, maybe you'd like to have a german translation ;)
FixReversedFaceMaterialsDE.lingvo.zip
0

Aerilius 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Sun Sep 12, 2010 11:36 pm

Thanks for the DE lingvo.
I'll include it in any future release - unless someone else wants to jump in with another version or comments...
My German is not up to much [as you probably noticed!]... ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Tue Oct 19, 2010 1:52 pm

Here's a tweaked German lingvo file [by Aerilius]...
FixReversedFaceMaterialsDElingvo.zip
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Fix Reversed Face Materials

Postby Ecuadorian » Tue Dec 14, 2010 11:04 pm

Thank you, TIG!

This is a life saver... :thumb:
0

Ecuadorian 
 

Re: [Plugin] Fix Reversed Face Materials

Postby TIG » Mon Jan 03, 2011 5:18 pm

Here's another version of the DE lingvo [by User2012] - try them and choose which you want...
FixReversedFaceMaterialsDE.zip
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: ArialBoled, NatoxD and 6 guests