MoI discussion forum
MoI discussion forum

Full Version: Save image from MOI

Show messages:  1-7  8-27  28-38

From: Michael Gibson
24 May 2009   [#28] In reply to [#27]
Hi Patrick,

> That's in fact quite a convenient basis for making non-photorealistic
> renders:
> The only downside is that you cannot have the hidden lines
> separated as they disappear with the faces.

Yeah at the moment to make "hidden lines" you also have to have faces showing. There is not any way to have hidden lines but also not have faces displayed with shading at the same time.

But I've now added an option in for the next v2 beta that will allow for that.

The new option will basically make it possible to get a screenshot where the shaded drawing of the faces is eliminated, but the effect of faces on generating hidden lines is retained.

However, this still has the same limitation as the previous "just hide all faces" type wireframe that silhouettes are not dealt with, so it is not a completely proper hidden line wireframe display except for things that happen to already have an edge where a silhouette is at. For example things like spheres will not look proper with this kind of wireframe display, because it only shows surface edgse and spheres only have one edge in them.

I do want to add more proper silhouette type stuff in the future but that will be a lot more work than just adding in an option.

But anyway, the new option will allow for doing screenshots like the following which may be of use:



- Michael

Image Attachments:
SemiHiddenLine.png 


From: pitrak
26 May 2009   [#29] In reply to [#28]
Michael, on pushpullbar we would say CRACQUER!

Great, thanks a lot for implementing this. I'm already looking forward to the next beta!

Thanks a lot,
patrick
From: Frenchy Pilou (PILOU)
26 May 2009   [#30] In reply to [#29]
"Craqueur" is the good Belgian / French word but it's a neologism ;)
Meaning is something like "to merit clapping for the amazing tricky work"
From: Ambimind
2 Jul 2011   [#31]
Have just realised the potential of rendering with MOI while reading this thread. While experimenting with the script I thought that it would be useful if we could also:
1 - Hide grid only in the rendering
2 - Hide hidden lines only in the rendering
3 - Change the background color only in the rendering(I'm thinking to black or green to use as an alpha channel)
4 - Enable 'constant' shading only in the rendering(that is, without shadowing) - this has the side effect of allowing accurate bitmap to vector conversion.
5 - Increase meshing resolution only in rendering
Thanks,

Ambimind
From: Michael Gibson
2 Jul 2011   [#32] In reply to [#31]
Hi Ambimind, yup I think all that should be possible - note how the script already increases the line width just for the rendering and then puts it back to normal after the snapshot is taken - that's the part of the script that says moi.view.lineWidth = 4; and moi.view.lineWidth = 1;


The grid is made up of 2 parts - the regular grid lines and the darker xy axis lines.

To hide the grid would use this script:

moi.grid.display = false; moi.grid.showXYAxes = false;

and to restore it, say = true instead of = false. These would go sandwiched around the call that does the snapshot just like setting the line width currently.


Hidden line display is controlled in script by:

moi.view.showHiddenLines = true;


Setting the background color is controlled by the moi.view.viewportBackgroundColor property, which takes a 24-bit number made up of 3 bytes packed together, the 3 bytes contain the red, green, and blue values. So something like this should work to set it to red = 25, green = 51, blue = 255:

moi.view.viewportBackgroundColor = (25 << 16) | (51 << 8) | 255;


Constant shading can be done by setting high value for light intensities of the custom light levels under Lighting options, see here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3135.3

To set the lighting style in script, you can use:

moi.view.lightingStyle = 'CustomLevels';

and to restore to default:

moi.view.lightingStyle = 'Default';

You can use the following values for lightingStyle: 'Default', 'MoreFill', 'LessFill', 'KeyOnly', 'CustomLevels', 'Hemispheric', and 'Headlight' - each of these corresponds to an entry in the dropdown that you see in the lighting options dialog.

Then for custom levels to set the levels to a high value, use:

moi.view.customKeyLightLevel = 100.0;
moi.view.customFillLightLevel = 100.0;


You may run into some problems increasing meshing resolution, because that can consume quite a large amount of memory setting that to a tighter value. If you do want to try it, it's settable from script by:

moi.view.meshAngle = 10.0;


So anyway these are the various script calls that you can use to adjust the settings you are asking about - to assemble the script you build it up as one long line of text and put one setting to the left side of the snapshot and the restoring part to the right side of the snapshot.


Let me know if any of these doesn't work as expected.

- Michael
From: Ambimind
2 Jul 2011   [#33] In reply to [#32]
Fantastic, thank you!

For anyone else interested, here is the script that produces the type of rendering visible in the following image:

script:var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 3; moi.grid.display = false; moi.view.meshAngle = 5.0; moi.grid.showXYAxes = false; moi.view.showHiddenLines = false; moi.view.lightingStyle = 'CustomLevels'; moi.view.customKeyLightLevel = 100.0; moi.view.customFillLightLevel = 100.0; v.renderToClipboard(2048, 2048 ); moi.view.lineWidth = 1; moi.grid.display = true; moi.view.meshAngle = 10.0; moi.view.lightingStyle = 'Default'; moi.grid.showXYAxes = true; moi.view.showHiddenLines = true; }


BTW, I found that the default grey background works perfectly when using "Magic Wand" with a 1px tolerance - so as to mask the background(image below is .png so as to show this):


Image Attachments:
Boat.png 


From: BurrMan
3 Jul 2011   [#34] In reply to [#33]
Very nice Ambimind, Me likey!! Thanks for sharing it.
From: rosto
26 Jun 2022   [#35] In reply to [#20]
This is a wonderful thing - changing the line thickness!
Is there a solution to change the line tips to rounded like in Illustrator?
What would not appear gaps at the corners.

Image Attachments:
linetips.png 


From: Michael Gibson
26 Jun 2022   [#36] In reply to [#35]
Hi rosto,

re:
> Is there a solution to change the line tips to rounded like in Illustrator?

Not with this particular method since it's using the realtime viewport display engine which is heavily oriented for speed.

But you should get rounded line tips if you generate a drawing by exporting to PDF, AI, or SVG formats instead of using this screen display capture method.

- Michael
From: Rudl
26 Jun 2022   [#37]
This is a screenshot of a pyramid with a lot of stones. Can I avoid the interferences with a pdf and how are the settings.

Image Attachments:
1102.jpg 


From: Michael Gibson
26 Jun 2022   [#38] In reply to [#37]
Hi Rudl, I'm not sure if PDF export will have less of a Moiré pattern but it would be worth a try. Give it a try with default settings.

You may need to adjust the image in an image processing program to reduce that kind of pattern, search for something like "Moire pattern removal" to get some information on that.

- Michael

Show messages:  1-7  8-27  28-38