Imagebrush resolution to render a MeshGeometry3D in WPF -


i visualizing spatial data using meshgeometry3d in wpf. noticed passing imagebrush constructor of diffusematerial makes 3d visualization , manipulation fast , efficient (than using visualbrush). solution in following code block this.datameshmodel geometrymodel3d includes mesh. problem have give high resolutions (1000) bitmap image source make grid nice , distinguishable. choosing high dpi seems odd , raises memory exceptions. suggestion? data model looks this 1000 dpi , this 4000 dpi. thanks!

    private void assigntexture(geometry gridgeom, double texturedpi, double gridthickness)     {         // rendering grid on drawingvisual         drawingvisual dv = new drawingvisual();         using (var dvc = dv.renderopen())         {             dvc.drawrectangle(brushes.tomato, null, gridgeom.bounds);             dvc.drawgeometry(null, new pen(brushes.black, gridthickness), gridgeom);         }         if (dv.drawing.canfreeze)         {             dv.drawing.freeze();         }         //rendering drawingvisual image         rect bounds = dv.contentbounds;         rendertargetbitmap renderedbitmap = new rendertargetbitmap(             (int)(bounds.width * this.texturedpi / 96),             (int)(bounds.height * this.texturedpi / 96),             this.texturedpi,             this.texturedpi,             pixelformats.pbgra32);         renderedbitmap.render(dv);         // adding rendered image create imagebrush         imagebrush imbrush = new imagebrush(renderedbitmap);         //creating material         diffusematerial datameshmaterial = new diffusematerial(imbrush);         this.datameshmodel.material = this.datameshmaterial;     } 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -