I'm writing a converter for curves from Houdini to Maxwell. The code below successfully generates a single linear hair curve that renders fine.
Code: Select all
#generate a single strand of hair
from pymaxwell5 import *

#create an extension manager object
scene = Cmaxwell(mwcallback_cb)
mgr = CextensionManager.instance()
geoProceduralExtensionHair = mgr.createDefaultGeometryProceduralExtension('MaxwellHair')
extensionData = geoProceduralExtensionHair.getExtensionData()

extensionData.setByteArray('HAIR_GUIDES_COUNT',[1, 0, 0, 0])
extensionData.setByteArray('HAIR_GUIDES_POINT_COUNT',[4, 0, 0, 0])
extensionData.createFloatArray('HAIR_POINTS',[0.0, 0.0, 0.0, 10.0, 100.0, 0.0, -10.0, 200.0, 0.0, 0.0, 300.0, 0.0])
extensionData.setDouble('Root Radius',2.0)
extensionData.setDouble('Tip Radius',2.0)

#create hair 
hair = scene.createGeometryProceduralObject("hair",extensionData)

#inspect hair params
paramsHair = hair.getGeometryProceduralExtensionParams()[0]
print 'HAIR_GUIDES_COUNT',paramsHair.getByName('HAIR_GUIDES_COUNT')[0]
print 'HAIR_POINTS',paramsHair.getByName("HAIR_POINTS")[0]
My questions are
1: Am I calling the get methods correctly?
Code: Select all
CmaxwellObject_getGeometryProceduralExtensionParams(CmaxwellObject self) -> PyObject *
paramsHair = hair.getGeometryProceduralExtensionParams() returns a tuple and MX paramListRef is in index[0]. The 2nd value in the tuple is True or False . I'm confused as to why I would ever need a tuple.
2. The Maxwell hair strand I made is linearly interpolated between the points. I think cubic bezier is supported but I'm not sure.
3: HAIR_GUIDES_COUNT[a,b,c,d]. I put 1 for 'a' and in the .mxs example Fernando gave me it read [39,26,0,0] and I calculated 6695 strands of hair. What are these values?
4. HAIR_GUIDES_POINT_COUNT[a,b,c,d] . I think 'a' is the number of points in each hair strand ? What are b c d?

Thanks for any guidance
1.yes, you are using ok the methods
1.b the tuple returns the mxparamlist structure and a boolean with true or false depending on success or failure of the call.

2. The hair strand is made of straight cone sections in between two guide points. The more points it has, the smoother curved hair you'll get.

3.HAIR_GUIDES_COUNT is an array with a single element telling how many hair guides are present.
4.HAIR_GUIDES_POINT_COUNT can be either a single value, meaning that all guides have the same # of points, or an array with how many points each guide has. In this case the array length is stored in HAIR_GUIDES_COUNT

These two arrays have a little quirk. In C++, they are declared as byte arrays, but they store integer numbers in LSB order. Each integer is made of 4 bytes (a,b,c,d) so each four-tuple has to be interpreted as or cast into an integer number.

Hope this helps.

5.HAIR_POINTS are, as its name tells, all the guide points in order, from the first guide to the last guide, and each guide from root to tip.
Thanks Miguel

Fernando sent me the link https://nextlimitsupport.atlassian.net/ ... axwellHair which is not linked to from the front page so I missed it. Now I realize I need to use the search bar to find the buried treasures.

bytearray[39,26,0,0] = 00001a27 = 6695 hair strands totally makes sense now with your explanation.

I plan to write a general purpose Python Module to support all features in Maxwell 5 that can be used by a separate Python add-on in Houdini, Blender and Modo.
These pages are for Maxwell 2.6 so they don't cover newer extensions like MaxwellSea, MWObjectAlembic etc. Do you have any direct links to newer documentation?

A followup question Miguel, I think the following parameters were added post Maxwell 2.7 therefore the web documentation doesn't list them.

HAIR_CUT_OFF (FLOATARRAY) is this like "Cut off" in MaxwellGrass?

Can you tell me what they are for?

I have done a full file contents search of "HAIR_POINTS" from the top-level sdk of a windows install and there is nothing. The docs only cover the Maxwell core and none of the extensions and modifiers. The only viable information can be found at https://nextlimitsupport.atlassian.net/ ... axwellHair which has no info on "HAIR_CUT_OFF" which I believe is a newer parameter. Also extensions created after Maxwell 2.7 have no web pages for MaxwellSea, MWObjectAlembic and others.
Hi Harvey,

HAIR_FLAG_POINTS_RADII is a byte array of length 1. (yeah, it could have been a single byte element, but wtf....let's make it complicated). If its value is 1, then we expect the float array HAIR_POINTS_RADII to be filled. This last array has, for each hair, the root and tip radius. This is useful if you wanna make some hairs thicker at the tip and thinner at the root. Normally, the radius at the root is bigger than at the tip. The length of this array must be 2 * #hairs.

HAIR_NORMALS and HAIR_CUT_OFF are not used. This last one was meant to be like CutOff in grass, but the code got too complicated and we let it go. If you want shorter hairs, just make the guides shorter....

Hope this helps.
Thanks Miguel

I know 5.2+ is a big development hill and I appreciate all the improvements and features but maybe when you guys get to 6.x that somebody could spend 2 days to update the sdk docs to include Modifiers and Extensions so I don't have to bother the programmers with such simple questions about parameters.

First Maxwell render for some time!

Hi, A just for fun project to model and render th[…]

Hi everyone, has anybody found a way to use and e[…]

Modeling from spline

Thanks - I came across the same thing myself recen[…]

Agate-type crystal / SSS

Hi all, Compared to biased render engines I reall[…]