How to render polylines

In The FleshIn The Flesh Posts: 157

I've been experimenting with the "Convert Ribbons to Lines" and "Convert Tubes to Lines" options under the Edit - Object - Geometry menu.

The commands execute correctly and the viewport displays the converted lines. Line width settings are added under the surfaces pane. However no line settings are added under the parameters pane, and the lines don't render in either the iray viewport render or a full render.

I had a look at the Generate_Polyline_Wireframe.dsa sample script availble here: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_polyline_wireframe/start

I see that a Line Tesselation modifier is able to be added through scripting, so I tweaked the script to the following:

 

/********************************************************************** 	Copyright (C) 2002-2020 Daz 3D, Inc. All Rights Reserved. 	This script is provided as part of the Daz Script Documentation. The	contents of this script, and\or any portion thereof, may only be used	in accordance with the following license: 	Creative Commons Attribution 3.0 Unported (CC BY 3.0)	- http://creativecommons.org/licenses/by/3.0 	To contact Daz 3D or for more information about Daz Script visit the	Daz 3D website: 	- http://www.daz3d.com **********************************************************************/// Source: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_polyline_wireframe/start// DAZ Studio version 4.11.0.36 filetype DAZ Script// Define an anonymous function;// serves as our main loop,// limits the scope of variables(function(){		// Initialize 'static' variables that hold modifier key state	var s_bShiftPressed = false;	var s_bControlPressed = false;	var s_bAltPressed = false;	var s_bMetaPressed = false;		// If the "Action" global transient is defined, and its the correct type	if( typeof( Action ) != "undefined" && Action.inherits( "DzScriptAction" ) ){		// If the current key sequence for the action is not pressed		if( !App.isKeySequenceDown( Action.shortcut ) ){			updateModifierKeyState();		}	// If the "Action" global transient is not defined	} else if( typeof( Action ) == "undefined" ) {		updateModifierKeyState();	}		/*********************************************************************/	// void : A function for updating the keyboard modifier state	function updateModifierKeyState()	{		// Get the current modifier key state		var nModifierState = App.modifierKeyState();		// Update variables that hold modifier key state		s_bShiftPressed = (nModifierState & 0x02000000) != 0;		s_bControlPressed = (nModifierState & 0x04000000) != 0;		s_bAltPressed = (nModifierState & 0x08000000) != 0;		s_bMetaPressed = (nModifierState & 0x10000000) != 0;	};		/*********************************************************************/	// void : A function for printing only if debugging	function debug()	{		// If we are not debugging		if( !s_bAltPressed ){			// We are done...			return;		}				// Convert the arguments object into an array		var aArguments = [].slice.call( arguments );				// Print the array		print( aArguments.join(" ") );	};		/*********************************************************************/	// Boolean : A function for testing whether or not a QObject instance	// inherits one of a list of types	function inheritsType( oObject, aTypeNames )	{		// If the object does not define the 'inherits' function		if( !oObject || typeof( oObject.inherits ) != "function" ){			// We are done... it is not a QObject			return false;		}				// Iterate over the list of type names		for( var i = 0, nTypes = aTypeNames.length; i < nTypes; i += 1 ){			// If the object does not inherit the 'current' type			if( !oObject.inherits( aTypeNames[i] ) ){				// Next!!				continue;			}						// Return the result			return true;		}				// Return the result		return false;	};		/*********************************************************************/	// DzNode : A function for getting the root of a node	function getRootNode( oNode )	{		// If we have a node and it is a bone		if( oNode && inheritsType( oNode, ["DzBone"] ) ){			// We want the skeleton			return oNode.getSkeleton();		}				// Return the original node		return oNode;	};		/*********************************************************************/	// DzObject : A function for getting the object for a node	function getObjectForNode( oNode, bRoot )	{		// Get the node		var oContextNode = bRoot ? getRootNode( oNode ) : oNode;		// If we do not have a root node		if( !oContextNode ){			// We are done...			return null;		}				// Get the object of the root node		var oObject = oContextNode.getObject();		// If we do not have an object		if( !oObject ){			// We are done...			return null;		}				// Return the object		return oObject;	};		/*********************************************************************/	// DzShape : A function for getting the shape for a node	function getShapeForNode( oNode, bRoot )	{		// Get the object of the node		var oObject = getObjectForNode( oNode, bRoot );		// If we do not have an object		if( !oObject ){			// We are done...			return null;		}				// Get the shape of the root node		var oShape = oObject.getCurrentShape();		// If we do not have a shape		if( !oShape ){			// We are done...			return null;		}				// Return the shape		return oShape;	};		/*********************************************************************/	// DzGeometry : A function for getting the geometry for the root of a node	function getGeometryForNode( oNode, bRoot, bCached )	{		// Get the shape of the root node		var oShape = getShapeForNode( oNode, bRoot );		// If we do not have a shape		if( !oShape ){			// We are done...			return null;		}				// If we are getting the cached geometry		if( bCached ){			// Update the working mesh			//oShape.invalidateWorkingMesh();						// Get the object of the root node			var oObject = getObjectForNode( oNode, bRoot );						// Return the geometry			return oObject.getCachedGeom();		}				// Get the geometry of the root node		var oGeometry = oShape.getGeometry();		// If we do not have a geometry		if( !oGeometry ){			// We are done...			return null;		}				// Return the geometry		return oGeometry;	};		/*********************************************************************/	// DzFacetMesh : A function for getting the facet mesh for a node	function getFacetMeshForNode( oNode, bRoot, bCached )	{		// Get the geometry of the node		var oGeometry = getGeometryForNode( oNode, bRoot, bCached );		// If we do not have a facet mesh		if( !inheritsType( oGeometry, ["DzFacetMesh"] ) ){			// We are done...			return null;		}				// Return the geometry		return oGeometry;	};		/*********************************************************************/	// Get the primary selection	var oSrcNode = Scene.getPrimarySelection();	// If nothing is selected	if( !oSrcNode ){		// We are done...		return;	}		// Get the base mesh of the root node	var oSrcBaseMesh = getFacetMeshForNode( oSrcNode, true, false );	// If we do not have a base mesh	if( !oSrcBaseMesh ){		// We are done...		return;	}		// Let the user know we are busy	setBusyCursor();		// Get the source object	var oSrcObject = getObjectForNode( oSrcNode, true );		// Create a "Line Tessellation" modifier	var oTgtModifier = new DzLineTessellationModifier();		// Define the wireframe attributes	var nSides = 3;	var nWidth = 5;		// Add the modifier to the target object	oSrcObject.addModifier( oTgtModifier );		// Let the user know we are done	clearBusyCursor();	// Finalize the function and invoke})();

This does add the Viewport Line and Render Line Tessellation Sides properties to the converted lines, but they still don't show up in renders. I'm not suprised, because my scripting skills are very basic so the edits I did are a complete hack job.

Any ideas what I'm missing?

I have tested in both the last 4.11 release, as well as the last 4.12 beta.

TLDR: How do you get lines to be renderable in Iray when using the "Convert Ribbons to Lines" and "Convert Tubes to Lines" options under the Edit - Object - Geometry menu?

Cheers,

Daniel

Post edited by In The Flesh on

Comments

  • MarcCCTxMarcCCTx Posts: 924

    Are the too thin? Maybe make the material glow (brightly) and see if it produces light.

  • InTheFlesh said:

    I've been experimenting with the "Convert Ribbons to Lines" and "Convert Tubes to Lines" options under the Edit - Object - Geometry menu.

    The commands execute correctly and the viewport displays the converted lines. Line width settings are added under the surfaces pane. However no line settings are added under the parameters pane, and the lines don't render in either the iray viewport render or a full render.

    I had a look at the Generate_Polyline_Wireframe.dsa sample script availble here: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_polyline_wireframe/start

    I see that a Line Tesselation modifier is able to be added through scripting, so I tweaked the script to the following:

     

    /********************************************************************** 	Copyright (C) 2002-2020 Daz 3D, Inc. All Rights Reserved. 	This script is provided as part of the Daz Script Documentation. The	contents of this script, and\or any portion thereof, may only be used	in accordance with the following license: 	Creative Commons Attribution 3.0 Unported (CC BY 3.0)	- http://creativecommons.org/licenses/by/3.0 	To contact Daz 3D or for more information about Daz Script visit the	Daz 3D website: 	- http://www.daz3d.com **********************************************************************/// Source: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_polyline_wireframe/start// DAZ Studio version 4.11.0.36 filetype DAZ Script// Define an anonymous function;// serves as our main loop,// limits the scope of variables(function(){		// Initialize 'static' variables that hold modifier key state	var s_bShiftPressed = false;	var s_bControlPressed = false;	var s_bAltPressed = false;	var s_bMetaPressed = false;		// If the "Action" global transient is defined, and its the correct type	if( typeof( Action ) != "undefined" && Action.inherits( "DzScriptAction" ) ){		// If the current key sequence for the action is not pressed		if( !App.isKeySequenceDown( Action.shortcut ) ){			updateModifierKeyState();		}	// If the "Action" global transient is not defined	} else if( typeof( Action ) == "undefined" ) {		updateModifierKeyState();	}		/*********************************************************************/	// void : A function for updating the keyboard modifier state	function updateModifierKeyState()	{		// Get the current modifier key state		var nModifierState = App.modifierKeyState();		// Update variables that hold modifier key state		s_bShiftPressed = (nModifierState & 0x02000000) != 0;		s_bControlPressed = (nModifierState & 0x04000000) != 0;		s_bAltPressed = (nModifierState & 0x08000000) != 0;		s_bMetaPressed = (nModifierState & 0x10000000) != 0;	};		/*********************************************************************/	// void : A function for printing only if debugging	function debug()	{		// If we are not debugging		if( !s_bAltPressed ){			// We are done...			return;		}				// Convert the arguments object into an array		var aArguments = [].slice.call( arguments );				// Print the array		print( aArguments.join(" ") );	};		/*********************************************************************/	// Boolean : A function for testing whether or not a QObject instance	// inherits one of a list of types	function inheritsType( oObject, aTypeNames )	{		// If the object does not define the 'inherits' function		if( !oObject || typeof( oObject.inherits ) != "function" ){			// We are done... it is not a QObject			return false;		}				// Iterate over the list of type names		for( var i = 0, nTypes = aTypeNames.length; i < nTypes; i += 1 ){			// If the object does not inherit the 'current' type			if( !oObject.inherits( aTypeNames[i] ) ){				// Next!!				continue;			}						// Return the result			return true;		}				// Return the result		return false;	};		/*********************************************************************/	// DzNode : A function for getting the root of a node	function getRootNode( oNode )	{		// If we have a node and it is a bone		if( oNode && inheritsType( oNode, ["DzBone"] ) ){			// We want the skeleton			return oNode.getSkeleton();		}				// Return the original node		return oNode;	};		/*********************************************************************/	// DzObject : A function for getting the object for a node	function getObjectForNode( oNode, bRoot )	{		// Get the node		var oContextNode = bRoot ? getRootNode( oNode ) : oNode;		// If we do not have a root node		if( !oContextNode ){			// We are done...			return null;		}				// Get the object of the root node		var oObject = oContextNode.getObject();		// If we do not have an object		if( !oObject ){			// We are done...			return null;		}				// Return the object		return oObject;	};		/*********************************************************************/	// DzShape : A function for getting the shape for a node	function getShapeForNode( oNode, bRoot )	{		// Get the object of the node		var oObject = getObjectForNode( oNode, bRoot );		// If we do not have an object		if( !oObject ){			// We are done...			return null;		}				// Get the shape of the root node		var oShape = oObject.getCurrentShape();		// If we do not have a shape		if( !oShape ){			// We are done...			return null;		}				// Return the shape		return oShape;	};		/*********************************************************************/	// DzGeometry : A function for getting the geometry for the root of a node	function getGeometryForNode( oNode, bRoot, bCached )	{		// Get the shape of the root node		var oShape = getShapeForNode( oNode, bRoot );		// If we do not have a shape		if( !oShape ){			// We are done...			return null;		}				// If we are getting the cached geometry		if( bCached ){			// Update the working mesh			//oShape.invalidateWorkingMesh();						// Get the object of the root node			var oObject = getObjectForNode( oNode, bRoot );						// Return the geometry			return oObject.getCachedGeom();		}				// Get the geometry of the root node		var oGeometry = oShape.getGeometry();		// If we do not have a geometry		if( !oGeometry ){			// We are done...			return null;		}				// Return the geometry		return oGeometry;	};		/*********************************************************************/	// DzFacetMesh : A function for getting the facet mesh for a node	function getFacetMeshForNode( oNode, bRoot, bCached )	{		// Get the geometry of the node		var oGeometry = getGeometryForNode( oNode, bRoot, bCached );		// If we do not have a facet mesh		if( !inheritsType( oGeometry, ["DzFacetMesh"] ) ){			// We are done...			return null;		}				// Return the geometry		return oGeometry;	};		/*********************************************************************/	// Get the primary selection	var oSrcNode = Scene.getPrimarySelection();	// If nothing is selected	if( !oSrcNode ){		// We are done...		return;	}		// Get the base mesh of the root node	var oSrcBaseMesh = getFacetMeshForNode( oSrcNode, true, false );	// If we do not have a base mesh	if( !oSrcBaseMesh ){		// We are done...		return;	}		// Let the user know we are busy	setBusyCursor();		// Get the source object	var oSrcObject = getObjectForNode( oSrcNode, true );		// Create a "Line Tessellation" modifier	var oTgtModifier = new DzLineTessellationModifier();		// Define the wireframe attributes	var nSides = 3;	var nWidth = 5;		// Add the modifier to the target object	oSrcObject.addModifier( oTgtModifier );		// Let the user know we are done	clearBusyCursor();	// Finalize the function and invoke})();

    This does add the Viewport Line and Render Line Tessellation Sides properties to the converted lines, but they still don't show up in renders. I'm not suprised, because my scripting skills are very basic so the edits I did are a complete hack job.

    Any ideas what I'm missing?

    I have tested in both the last 4.11 release, as well as the last 4.12 beta.

    TLDR: How do you get lines to be renderable in Iray when using the "Convert Ribbons to Lines" and "Convert Tubes to Lines" options under the Edit - Object - Geometry menu?

    Cheers,

    Daniel

    I'm trying to do something similar. It's been a year, but maybe we can put our heads together.

    I think either you were a bit overzealous in ripping things out of the script or the script has been updated because nSides and nWidth are being defined and initialized, but the script as you presented it never actually does anything with these values. The original script has 4 stanzas in between where you declare nSides and nWidth and where you add the modifier that got deleted and they look like they were the lines that would have honoured the sides/width you wanted.

  • @InTheFlesh forgot to tag you.

  • UncannyValetUncannyValet Posts: 201

    @InTheFlesh - your email is exposed See: https://www.daz3d.com/forums/discussion/681551/why-is-daz-exposing-user-email-addresses

    @TheMysteryIsThePoint  - Any luck?  It would be nice if we could import renderable Blender hair.

  • Richard HaseltineRichard Haseltine Posts: 100,810

    UncannyValet said:

    @InTheFlesh - your email is exposed See: https://www.daz3d.com/forums/discussion/681551/why-is-daz-exposing-user-email-addresses

    This is somewhat fixed, at least to thee xtent of not showing the email.

    @TheMysteryIsThePoint  - Any luck?  It would be nice if we could import renderable Blender hair.

  • @UncannyValet No, sorry, I am focused on the opposite direction, i.e getting content out of DS, not into it.

  • In The FleshIn The Flesh Posts: 157

    UncannyValet said:

    @InTheFlesh - your email is exposed See: https://www.daz3d.com/forums/discussion/681551/why-is-daz-exposing-user-email-addresses

    @TheMysteryIsThePoint  - Any luck?  It would be nice if we could import renderable Blender hair.

    Thanks for the heads up, fixed it now!

    I did end up making some progress, but I lost a hardrive recently and been out of the scene working on other projects for a while now. Hopefully I'll get back to it eventually.

Sign In or Register to comment.