Thanks for looking into this issue @jeff.
Yes, I only provided a minimal example for the sake of reproducibility on your end and am aware of how inefficient this code snippet is.
Just to be sure, I checked the SC_POSTDRAWOBJECTS channel but it still doesn’t show any shadows. This is tested in R7 & R8. For the sake of completeness, this is how I call these methods:
internal class NativeMethods
{
[DllImport("RhinoWrapper.dll")]
public static extern void DrawColoredMesh(uint docSN);
[DllImport("RhinoWrapper.dll")]
public static extern void RemoveColoredMesh();
}
and on the native part, I have this definition:
#define PINVOKE extern "C" __declspec(dllexport)
In the meantime, I’ve experimented with custom mesh providers and got it working. It’s a bit of a mess for a few reasons, though:
- R8 deprecated
CustomRenderMeshProvider2and only supportsRenderMeshProviderwhich in turn is not fully supported in R7, so I need to maintain 2 separate classes for two Rhino versions with all the conditional compilation etc. - Neither class works in wireframe, so I still need to run the mesh via a
Conduitto support this display mode on top of the mesh providers. RhinoCommondoesn’t expose theDrawShadedMeshes(note the plural) which in my case results in potentially thousands of draw calls, which could be avoided on the native side:
void DrawShadedMeshes(const ON_Mesh* const* meshes, int count, const CDisplayPipelineMaterial* material, CRhinoCacheHandle* const * caches);
So yeah, I’d really appreciate it, if there was a way of using the native display pipeline from a managed plugin and still participate in the shadow pass.