User avatar
By deadalvs
#379911
Hi !

I'm searching a bit more info on the Maxwell scatter modifier in Maya ..

I found:
http://support.nextlimit.com/display/mx ... ll+Scatter
http://support.nextlimit.com/display/mxdocsv3/Maya

Is there more ?

Questions :
------------
- When I scatter objects on a surface, the object's centroid is considered for the position of the insertion, not the pivot. e.g. tree cones sit half-through the surface instead of sitting 'on' the surface, when the pivot is at yMin of the cone. What could be the issue ?
- Is there a way to assign multiple objects to be scattered on a surface ( not only one ) ?

Please let me know .. Thanks !

Matt
User avatar
By ababak
#379913
Hi,

As far as I know you need to place an object at zero point and freeze the transformations.

Currently there is no way to scatter multiple objects but you may assign several scatter modifiers to one surface (although you'll probably need to paint non-intersecting density maps)
User avatar
By ababak
#379916
I am currently playing with scatter as well. I have some problems with object orientation though which I try to investigate here: http://maxwellrender.com/forum/viewtopi ... 35&t=42261

No, as far as I know there is no way to limit one instance per polygon. I suggest to have a look at your host application's particle capabilities for such kind of distribution.
User avatar
By deadalvs
#379917
hmm.

if the .bin file format were an ascii file format (text), then I could use the 'maxwell cloner' modifyer in my workflow, because I can get all precise point positions.

does anybody know how I could get e.g. the center points of all the faces of a mesh out to a .bin file ?
is there a python-based methodology to create bin files without the need for a realflow license ?

any input welcome !

matt
User avatar
By dariolanza
#379925
Hello dedalvs,

We know no other way to create a .bin file given certain known particles positions than RealFlow, in which, instead of simulating them, you can write an script that can place the particles in the positions you give. Then RealFlow would allow to save that particle cloud to a .bin file as usual.

You can do it with the 30-days free tiral demo version of RealFlow, with no other limitation.

Let me know if this answers your question.

Greetings
User avatar
By deadalvs
#379926
Hi !

Ok, good to know ..

I'll need to try this then.

For future reference:
--------------------
Maybe the pyMaxwell API could be enhanced to let the user create .bin files via a new python method (without the need of RealFlow) ?

Cheers !

matt
User avatar
By Mihnea Balta
#379928
If you know the exact positions where you want to create the instances, you have several options:

1. Create a Maya particle system with particles at those positions and use an instancer on it. The plug-in will export Maxwell instances.

2. Create Maya instances at those positions. This will slow down the viewport, though.

3. Create maxwellInstance objects at those positions. You can set a low LOD on the instance objects so that the Maya viewport doesn't slow down.

4. Use the API of the Maya plug-in to create Maxwell instances at those positions at export time.

5. Use the API of the Maya plug-in to create a MaxwellCloner object at export time, and pass it the object positions in the PARTICLE_POSITIONS attribute (the extension doesn't require a BIN file, it's also possible to give it the positions directly, as vectors). I wouldn't go this way though, because you won't be able to control the orientation of the instances.

The documentation for the plug-in API is here: http://support.nextlimit.com/display/ma ... lug-in+API. In your case, you can add a post-scene hook which creates the instances, e.g.:
Code: Select all
import maxwell
import maya.OpenMaya as OpenMaya

def MakeInst():
    tm = OpenMaya.MTransformationMatrix()
    pivot = OpenMaya.MMatrix()
    pivot.setToIdentity()
    
    # Assume there's an object called pSphere1 in the scene, which we will instance.
    sphere = maxwell.FindShape('pSphere1')
    
    # Create an instance at (5, 0, 0).
    inst1 = maxwell.Instance('inst1', sphere)
    pos = OpenMaya.MVector(5, 0, 0)
    tm.setTranslation(pos, OpenMaya.MSpace.kObject)
    m = tm.asMatrix()
    # The parameters for this method are: world matrix, pivot matrix, time, scaleTranslation.
    # The time parameter is used for motion blur and must be in the range [0..1], where 0 means
    # shutter open time and 1 means shutter close time. You can call the method several times
    # with different time values to specify the transformation of the object at each step.
    # The scaleTranslation parameter is a boolean which asks the Maxwell plug-in to convert the
    # translation part of the matrices from the Maya system unit to meters, and also apply the
    # global scale factor which is set in the render settings panel. Please note that the Maya
    # system unit is always centimeters, regardless of the unit configured in the Maya preferences.
    inst1.SetTransformation(m, pivot, 0, True)

    # Create a second instance at (0, 0, 5).
    inst2 = maxwell.Instance('inst2', sphere)
    pos = OpenMaya.MVector(0, 0, 5)
    tm.setTranslation(pos, OpenMaya.MSpace.kObject)
    m = tm.asMatrix()
    inst2.SetTransformation(m, pivot, 0, True)

# This makes the plug-in print some debug messages in the Maya script editors, including error messages
# caused by improper API usage.
maxwell.EnableDebugMessages(True)

# Tell the Maya plug-in to call our MakeInst() function after the entire scene has been exported,
# but before the MXS is written.
maxwell.SetExportCallback('MakeInstExample', maxwell.ExportCallbackType_AfterScene, 'MakeInst()')
If you really want to create a cloner extension, you will have to create a maxwell.ExtensionParams object (see the documentation of the CreateExtensionParamBlock() C++ function for details), fill in parameters with its Set*() methods and then create a maxwell.ExtensionShape object with it (see the equivalent CreateExtensionShape() C++ function for details). To get the list of parameters that an extension supports you can use the MEL command "maxwell -listExtensions true".

PS: don't confuse the API of the Maya plug-in with the pyMaxwell API, or with the Maxwell SDK. They are completely unrelated.
User avatar
By deadalvs
#379932
Hi Mihnea,


Thanks for the inputs. I'll figure out which one serves me best.

I'm aware of the difference between the APIs and the SDK. I was just mentioning pyMaxwell as an option.

Hopefully I can figure out all myself.

Matt
User avatar
By deadalvs
#379944
Got it working with the particle instancer on a test set.

Random rotation and scale, I was able to define with particle expressions.

Thanks for all the detailed inputs again, Mihnea !

Matt
User avatar
By deadalvs
#380057
Hey again..

I placed 370'000 instances of 24 vegetation species (in 24 particle systems). Exporting to render a frame seems to take ages .. ( I am waiting now 1 h+ )

Is there a linear relationship between number of instances exported and time ? Is it O(n) or 'worse' ?
My CPU (6 core) runs constantly around 9.5%. Would it be possible to implement multithreading in exports ?

Any input welcome .. Thanks !

Matt


ps. I am able to use a mesh and 'scatter' to mass-distribute those instances that don't need precise coordinates.
By MikaelP
#382823
deadalvs wrote:oh, an other thing :

is there a way to control that there's exactly one instance placed per polygon on the surface ?
Polyscatter plugin lets you place one instance per vertex without hassle.
the render does not start

Also open the Console and read through it to see i[…]

Sketchup 2024 Released

I would like to add my voice to this annual reques[…]