Display surface material when exporting png image using CaptureToBitmap

I am exporting images but for some reason the surface materials are not being displayed. the current version shows only surface isocurves.
the image oututput looks like this:-
image
i would like it to look something like this:-
image

it seems like i am missing some setting but i am not sure what that is , any help will be appreciated!! :slight_smile:

The code is below:-

public static void ExportPNG(string filefolder, string filename, Mesh mesh)
        {
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
            BoundingBox meshBox = mesh.GetBoundingBox(true);

            Point3d pt1 = meshBox.GetCorners()[0];
            Point3d pt2 = meshBox.GetCorners()[2];

            string filepath = filefolder + "\\" + filename + ".png";
            RhinoView view = RhinoDoc.ActiveDoc.Views.ActiveView;
            Size size = new Size(3000, 3000);
            
            ViewCaptureSettings settings = new ViewCaptureSettings(view, size, 300);
            
            settings.SetWindowRect(pt1, pt2);
            settings.OutputColor = ViewCaptureSettings.ColorMode.PrintColor;

            try
            {
                Bitmap image = Rhino.Display.ViewCapture.CaptureToBitmap(settings);
                image.Save(filepath);

                Rhino.RhinoApp.WriteLine("Image exported to path" + filepath);
            }
            catch
            {
                Rhino.RhinoApp.WriteLine("Image export failed");
            }
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }

@dale please, can you help?

Hi @Arjun_Sharma1, try adding below to your ViewCaptureSettings:

settings.RasterMode = true;

_
c.

:raised_hands: :raised_hands: :raised_hands: :raised_hands: Works really well. @clement Thanks for your support. really appreciate it