Square Enix © Goodbye Kansas

Table of Contents

This example using Post-Translate Python Script shows how to set a constant hair width in pixels, effectively applying it for Paint FX toon lines.

 

Set Hairs Width In Pixels
from vray.utils import *

# Get all GeomMayaHair nodes and set their widths_in_pixels
hairs = findByType("GeomMayaHair")
for hair in hairs:
   hair.set("widths_in_pixels", True) 


The widths_in_pixels option will instruct V-Ray to treat the line widths (exported as hair strands) as screen-space width values in pixels, rather than the default world-space widths.

Note that the hair width pixel override will not show in IPR. 

 

In addition, using the Post-Translate Python Script, you can override the material of the pfxToon nodes. This script relies on your pfxToon strokes being named pfxToonShape1, 2, etc., so if you've changed their name from the default, edit it accordingly.

Set VRayMtl to pfxToon nodes
# if material is not assigned to any object it will not be exported, export it here
vraymtl = exportMaterial('VRayMtl1')
nodes = findByType('Node')
for node in nodes:
    if node.name().startswith('pfxToonShape'):
        node.set('material', vraymtl)

For more information on Post-Translate Python Script, refer to the dedicated page.