Vector graphics

   5342   5   6
User Avatar
Member
6 posts
Joined: Feb. 2017
Offline
Is Houdini suitable for vector graphics production?
I'm mainly interested in SVG, but other formats (such as pdf, eps, gs, etc) are good as well.

Thanks in advance for any help.

Bye, Ivano.
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Moin,

> Is Houdini suitable for vector graphics production?

depends on what you consider “vector graphics production”, since almost everything you do in Houdini *is* vector graphics production.

> I'm mainly interested in SVG, but other formats (such as pdf, eps, gs, etc) are good as well.

Writing a postscript (for EPS or PDF) could be done as a shader, the same goes for SVG. As far as I know there is no “official” export for these formats, though. You could (easily) convert 3d object formats into SVG using an external conversion tool or, as mentioned, write your own exporter/shader.

But I *think* this is not the kind of response you are looking for. In the end, I think, what you need is some kind of render/shader output, not so much something “Houdini-internal”.

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
6 posts
Joined: Feb. 2017
Offline
Yes, that was exactly what I meant.
So the short answer is no.
Thanks.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
It apparently has been done and can be done in a Python SOP:
https://www.sidefx.com/forum/topic/28764/?page=1#post-131959 [sidefx.com]

GrayOlorin wrote this:

def exportSVG():
    
    geo = hou.pwd().geometry()
    node = hou.pwd()
    filename = node.evalParm("location")
    sizeMult = node.evalParm("sizeMult")
    setColor = node.evalParm("setColorFromAttr")
    colorAttr = node.evalParm("colorAttr")
    addStroke = node.evalParm("addStroke")
    strokeColorR = node.evalParm("strokeColorr")
    strokeColorG = node.evalParm("strokeColorg")
    strokeColorB = node.evalParm("strokeColorb")
    strokeThickness = node.evalParm("strokeThickness")
    
    import xml.dom.minidom as minidom
    svgFile = minidom.Document()
    svgElement = svgFile.createElement("svg")
    svgFile.appendChild(svgElement)
    # Add code to modify the contents of geo.
    for prim in geo.prims():
    
        positionString = ""
        
        for vertex in prim.vertices():
        
            position = vertex.point().position()  
            positionString =  positionString + (str(position[0]*sizeMult) + "," + str(position[1]*sizeMult*-1) + " ")
        
        #now write to SVG
        
        polygonElement = svgFile.createElement("polygon")
        polygonElement.setAttribute("points", positionString)
        #Set Fill
        
        if (setColor == 1):
            color = prim.attribValue(colorAttr)
            red = hou.expandString("`inttohex(round(" + str(color[0]*255) + "))`")
            green = hou.expandString("`inttohex(round(" + str(color[1]*255) + "))`")
            blue = hou.expandString("`inttohex(round(" + str(color[2]*255) + "))`")
            hex = "#" + red[6:8] + green[6:8] + blue[6:8]
            polygonElement.setAttribute("fill", hex)
            
        else: 
            polygonElement.setAttribute("fill", "None")
        #Set Stroke
        if (addStroke == 1):
            red = hou.expandString("`inttohex(round(" + str(strokeColorR*255) + "))`")
            green = hou.expandString("`inttohex(round(" + str(strokeColorG*255) + "))`")
            blue = hou.expandString("`inttohex(round(" + str(strokeColorB*255) + "))`")
            hex = "#" + red[6:8] + green[6:8] + blue[6:8]
            polygonElement.setAttribute("stroke", hex)
            polygonElement.setAttribute("stroke-width", str(strokeThickness))
            
        svgElement.appendChild(polygonElement)
    
    #print svgFile.toprettyxml(indent="  ")
    #print filename
    
    newFile = open(hou.expandString(str(filename)),"w")
    
    newFile.write(svgFile.toprettyxml(indent="  "))
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
761 posts
Joined: April 2014
Offline
Look at that.

I've spent the past year alot of time with vector graphics, you can do so much I'm surprised web pages aren't more lavish.
【T】【C】【S】
User Avatar
Member
24 posts
Joined: Aug. 2012
Offline
Here is Entagma's tutorial on how to import and export SVG:



If you can figure out a way to export a sequence, let me know! :-)
Houdini Indie 18
Win 10 64-bit
  • Quick Links