"Vector Curl" on Volume Builder?
-
Hey guys,
This is a quick one: I can't seem to be able to add a "Vector Curl" filter to my Volume Builder. No matter my settings, I always get a "Volume Filter" that is set to "Smooth".
Here is the relevant portion of my code:
# Create Null container nullContainer = c4d.BaseObject(c4d.Onull) nullContainer.SetName('Vectors Direction') doc.InsertObject(nullContainer) # Create volume builder object volumeBuilder = c4d.BaseObject(c4d.Ovolumebuilder) # Volume builder settings volumeBuilder[c4d.ID_BASELIST_NAME] = "Volume Builder 01" volumeBuilder[c4d.ID_VOLUMEBUILDER_VOLUMETYPE] = 2 volumeBuilder[c4d.ID_VOLUMEBUILDER_GRID_SIZE] = 0.5 # Volume filter volumeBuilderFilterCurl = c4d.BaseObject(c4d.Ovolumefilter) # Volume filter settings volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = 1 volumeBuilder.InsertUnder(nullContainer) clonedActiveObject.InsertUnder(volumeBuilder) volumeBuilderFilterCurl.InsertUnder(volumeBuilder)
Any help/insight would be greatly appreciated.
Thank you!
Justin
-
Hi Justin,
Thank you for reaching out to us and providing your question with the explanatory code snippet, highly appreciated!
Regarding your question, there are two points to mention:
Firstly, you are using constant 1 for the c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE parameter, which targets "normalize" type rather than "curl" type (which corresponds to value 0). I suggest using the literal constants instead, e.g. change the line in your code from
volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = 1
to
volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE_CURL
You can find the full parameter list on the page: volumes/description/ovolumefilter.h
Secondly, you forgot to set the volume filter type to vector. Just add the following line after initializing the filter object:
volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VOLUME_TYPE] = c4d.ID_VOLUMEFILTER_VOLUME_TYPE_VECTOR
This parameter is not referenced in python docs (sometimes it can happen), so it is worth double checking in the C++ documentation: ovolumefilter.h File Reference
Cheers,
Ilia -
Hey @i_mazlov, thank you so much for your incredibly helpful and thorough reply. This is exactly what I was looking for.
Thanks again! I really appreciate it!