[Plugin] Fix Reversed Face Materials
-
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 !!!
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 BUT don't let it become an excuse to be a sloppy modeler
1.7 20131205 Future-proofed.
1.8 20140304 Some lingvo files updated to be compatible with v2014.
http://sketchucation.com/resources/pluginstore?pln=FixReversedFaceMaterials -
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.
-
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 -
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,
-
Thanks Didier...
-
Here's v1.2 http://forums.sketchucation.com/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... -
Here's v1.3 http://forums.sketchucation.com/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. -
quoted "BUT don't let it become an excuse to be a sloppy modeler "
Amen, brother, Amen.Of course, I am in denial. I never model sloppily
-
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.....
-
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? -
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....
-
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!] -
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.
-
Maybe some little images for speed understand the concept ?
-
Here's a simple example
-
Thanks TIG, clear as crystal now....
-
A black crystal
Faces are or are not well oriented
If they are false they must be reverse (material or not)
Then apply materialMaybe I miss something
-
@unknownuser said:
A black crystal
Faces are or are not well oriented
If they are false they must be reverse (material or not)
Then apply materialMaybe I miss something
maybe you're just a little crazy my man.....
-
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... -
@unknownuser said:
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...
Advertisement