MPxGPUDeformer input mesh normals

MPxGPUDeformer input mesh normals

Oleksandr_hrazhdan
Explorer Explorer
255 Views
7 Replies
Message 1 of 8

MPxGPUDeformer input mesh normals

Oleksandr_hrazhdan
Explorer
Explorer

Hi. Is there a way to get an MAutoCLMem buffer with the input mesh normals, or should I compute them on my own in a separate kernel? Obviously there is no member function such as  MPxGPUDeformer::sNormalsName()

0 Likes
256 Views
7 Replies
Replies (7)
Message 2 of 8

schwarm5
Explorer
Explorer

Also interested in this. In particular, seems that my mesh is going from soft edges to hard edges when I add my custom deformer, and would like to know if there's a way to pass through normals in MPxGPUDeformer. I see this method on `MGPUDeformerRegistrationInfo`, but it doesnt seem to solve my normal issue:

    virtual const MObject passThroughInputMeshAttribute();
0 Likes
Message 3 of 8

dongapkopal
Community Visitor
Community Visitor

I had this same issue recently. A mesh I was trying to export from Blender wouldn't load in any other program when I exported as an FBX. I was able to track down the faulty piece of geometry by deleting different pieces of the mesh and reexporting it until it didn't error out. I was able to fix the issue by separating off the faulty mesh into a separate object in blender then rejoining it to the main mesh. I don't know why that worked but I figured I would share https://100001.onl/ .

0 Likes
Message 4 of 8

schwarm5
Explorer
Explorer

@dongapkopal thanks but that's... not the same issue at hand here. We're talking about writing GPU deformers as part of custom plugins.

0 Likes
Message 5 of 8

Oleksandr_hrazhdan
Explorer
Explorer

at the moment I'm computing my per-point normals in a separate kernel. I use input points and also additional buffer with point neighbors. I'm not sure how much my result is different from what I can get from MFnMesh::getVertexNormals().

0 Likes
Message 6 of 8

schwarm5
Explorer
Explorer

How are you setting the recomputed normals back to the mesh after the separate kernel? Are you reading them back to the CPU first? That's what I'd like to avoid, but I don't see anyway to specify a deformer output buffer as a normal buffer.

0 Likes
Message 7 of 8

Oleksandr_hrazhdan
Explorer
Explorer

I use my computed normals for the mesh deformation. I don't need to pull them back to the host side. But if you need something back on the host side, you would use clEnqueueReadBuffer.

0 Likes
Message 8 of 8

schwarm5
Explorer
Explorer

I see. The opposite, actually- I want to keep the normals on the device. I don't need normals for mesh deformation, but I do want to specify the normals of the mesh *after* deformation, for shading purposes. I can't see any way to do that without reading them back to the host first, since there's no deformer output buffer for normals, as far as I can tell.

0 Likes