# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : tvertex_remover.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Removes TVertices from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \ Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D from logical_operators import NotUP1D from shaders import pyTVertexRemoverShader Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) shaders_list = [ IncreasingThicknessShader(3, 5), ConstantColorShader(0.2, 0.2, 0.2, 1), SamplingShader(10.0), pyTVertexRemoverShader(), ] Operators.create(TrueUP1D(), shaders_list)
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : invisible_lines.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Draws all lines whose Quantitative Invisibility # is different from 0 from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D from logical_operators import NotUP1D upred = NotUP1D(QuantitativeInvisibilityUP1D(0)) Operators.select(upred) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) shaders_list = [ SamplingShader(5.0), ConstantThicknessShader(3.0), ConstantColorShader(0.7, 0.7, 0.7), ] Operators.create(TrueUP1D(), shaders_list)
# Filename : multiple_parameterization.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : The thickness and the color of the strokes vary continuously # independently from occlusions although only # visible lines are actually drawn. This is equivalent # to assigning the thickness using a parameterization covering # the complete silhouette (visible+invisible) and drawing # the strokes using a second parameterization that only # covers the visible portions. from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingColorShader, \ IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ TextureAssignerShader, TrueUP1D from shaders import pyHLRShader Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain following the same nature, but without the restriction ## of staying inside the selection (0). Operators.bidirectional_chain(ChainSilhouetteIterator(0)) shaders_list = [ SamplingShader(20), IncreasingThicknessShader(1.5, 30), ConstantColorShader(0.0, 0.0, 0.0), IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), TextureAssignerShader(-1), pyHLRShader(), ## this shader draws only visible portions ] Operators.create(TrueUP1D(), shaders_list)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : apriori_and_causal_density.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Selects the lines with high a priori density and # subjects them to the causal density so as to avoid # cluttering from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \ Operators, QuantitativeInvisibilityUP1D, TrueBP1D from PredicatesU1D import pyDensityUP1D, pyHighViewMapDensityUP1D from logical_operators import AndUP1D, NotUP1D upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST)) Operators.select(upred) bpred = TrueBP1D() Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) shaders_list = [ ConstantThicknessShader(2), ConstantColorShader(0, 0, 0, 1), ] Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list)
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : qi1.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Draws lines hidden by one surface. # *** Quantitative Invisibility must have been # enabled in the options dialog to use this style module **** from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D from logical_operators import NotUP1D Operators.select(QuantitativeInvisibilityUP1D(1)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1))) shaders_list = [ SamplingShader(5.0), ConstantThicknessShader(3), ConstantColorShader(0.5, 0.5, 0.5, 1) ] Operators.create(TrueUP1D(), shaders_list)
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : sketchy_topology_preserved.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : The topology of the strokes is built # so as to chain several times the same ViewEdge. # The topology of the objects is preserved from ChainingIterators import pySketchyChainSilhouetteIterator from freestyle import ConstantColorShader, IncreasingThicknessShader, Operators, \ QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ TextureAssignerShader, TrueUP1D upred = QuantitativeInvisibilityUP1D(0) Operators.select(upred) Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, True)) shaders_list = [ SamplingShader(4), SpatialNoiseShader(20, 220, 2, True, True), IncreasingThicknessShader(4, 8), SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5), ConstantColorShader(0.6, 0.2, 0.0), TextureAssignerShader(4), ] Operators.create(TrueUP1D(), shaders_list)
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : occluded_by_specific_object.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Draws only the lines that are occluded by a given object from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ Id, Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D from PredicatesU1D import pyIsInOccludersListUP1D from logical_operators import AndUP1D, NotUP1D ## the id of the occluder (use SHIFT+click on the ViewMap to ## retrieve ids) id = Id(3, 0) upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)), pyIsInOccludersListUP1D(id)) Operators.select(upred) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) shaders_list = [ SamplingShader(5), ConstantThicknessShader(3), ConstantColorShader(0.3, 0.3, 0.3, 1), ] Operators.create(TrueUP1D(), shaders_list)