demdike
Good day everybody, 

I'm having trouble meshing nParticle-Simulations via openVDB with MotionVectors.
The meshing works fine and I followed this youtube-video, How to use BE_VDBAttributeFromVDB, to the letter:



If I check Display Colors on the resulting mesh, everything looks correct, but once I render this mesh in Redshift, there is no motion blur.

I'd also like to export this mesh as an alembic cache - when I import the mesh, the motion vector colors are missing - even though Write Color Sets is checked.

On the other hand, if I convert the particles using maya's Modify/Convert/nParticle to Polygons, the resulting mesh has the correct motion-Vector-Colors and blurs correctly when renderings with Redshift. It also renders correctly when exported as an alembic cache, the Color Set is present and the alembic file renders with motion blur.


I'm on Maya 2018.1
Quote 0 0
pshipkov
Can you provide an example scene ?
That will be the fastest way to me or somebody else around here to help you.
Thanks.
Quote 0 0
demdike
Shoot, should have thought of that...my bad.
I'll post an example first thing tomorrow, but unfortunately I had already left the office when I read your quick reply.
I'll upload a "live" scene and an alembic file, exported from that scene, as well.
Thank you very much, till tomorrow.
Quote 0 0
demdike
Alright, 

I'm back at the office and did some further digging. When setting up the example scene I noticed that as soon as the particles are cached, the display is the same in the viewport, but when exporting as an alembic file, the ColorSet is lost. Here is a quick render that compares the three different Meshes:

alembic_Files_Comparison_Render_Redshift_annotated.jpg 
The MotionBlur differs, maybe clamping the arrayToPointColor would fix this - nevertheless, it works as long as the particles are not cached.

Once I use a cache I also get this warning:

pointAttributeToArray1: Cannot find a current uvSet
arrayToPointColor1: inRgbaPP array length does not match the point count

I apologize in advance if this is a really dumb mistake on my part, but I'd be glad if someone could point me in the right direction.


I attached two example scene and three alembic Files.

addMotionVectors_to_Mesh_v001.mb - a simple dummy-Scene very similar to the one mentioned in the video above by TheBesha1
alembic_Files_comparison_v001.mb - the renderscene as seen above in the Jpeg


Quote 0 0
demdike
One more thing:

An alembic file created from cached nParticles via Modify/convert nParticles to Polygons does also contain the desired ColorSet and renders with correct motion blur.
Quote 0 0
demdike
Well...I got it working. Sort of.

I used attributeTransfer with a boundingObject to transfer the velocity from my cached nParticles to the alembic-cached polymesh that I created via openVDB from these very cached nParticles. The newly created polymesh can then be exported as another alembic file, after this step the desired colorSet is present and everything can be rendered with motionBlur. Not overly elegant and horribly slow, but it did the trick. 

I bet ten minutes after I post this, someone presents me with a clean and fast solution;)
Quote 0 0
demdike
I'm still curious though:

What changes once the nParticles are cached? And what hinders openVDB to write out the colorSet1 from the cached nParticles? I can still see colorSet1 in the viewport, but it's not written to the alembic file. 
Quote 0 0
pshipkov
Can you do me a favor and provide the Maya files in .ma format ?
Thanks.
Quote 0 0
pshipkov
Ok, i don't have RedShift here, but tried with Arnold and VRay. Both work just fine.
The outputMesh_VDB_from_nParticles.abc renders properly with the stored in the ABC file per-point velocities. The vector values appear to be 10 times bigger than what they should be, but that's easy to tweak.

The outputMesh_VDB_from_cached_nParticles.abc file does not contain velocity data.
My guess is that you cached the nParticles without the velocity data. Check if the nParticle's caching option is set to ALL.
My advise is to give the "nParticles cache manager" tool in SOuP a go. It is very helpful when doing more precise work with particles and caches.

Mesh_via_convert_nParticles_to_Polygons.abc renders properly with per-point motion blur.

Once i get .ma scenes from you i will give them a try.
Quote 0 0
demdike
I'm very sorry but, you guessed it, I cannot provide the actual file due to legal issues, plus they're rather large.

I still cannot export an alembic file with velocity data from the scene I posted on Saturday, I'll attach it here as an ma-file. 

I know that I stored the velocity data in the nParticles cache file, since I used them later on, on Saturday, to transfer the per point velocities to the alembic geometry with a bounding object, as described above.

I'll give the "nParticles cache manager" a try, sounds promising. 

I love soup and the wealth of possibilities it offers, but since I'm stuck somewhere between artist and TD, it's a struggle at times😉
Quote 0 0
pshipkov
Ah, i see what is going on.
Maya is just being a little bit retarded in this case. 😉

Everything you need to do is insert a proper vertexColorSet before the arrayToPointColors node.
Run the few lines below and they will do just that.


polyColorSet -create -clamped 0 -rpt RGBA -colorSet "velocityPV" outputMesh_VDB_from_nParticles;
polyColorPerVertex -a 0 outputMesh_VDB_from_nParticles;
delete createColorSet1;
connectAttr -f arrayToPointColor1.outGeometry outputMesh_VDB_from_nParticles.inMesh;
connectAttr -f BE_VDBConvertVDB1.meshOutput[0] polyColorPerVertex1.inputPolymesh;
connectAttr polyColorPerVertex1.output arrayToPointColor1.inGeometry;
Quote 0 0
demdike
A clean, fast and elegant solution🙂

Mr Shipkov, I tip my hat to you. I'll treasure that code and keep that advice in mind next time it comes to meshing with openVDB.

Thank you so much for your help and patience, best regards.
Quote 0 0
pshipkov
Words of a gentleman.
Thank you sir.
🙂
Quote 0 0