My final goal is to export an image (png, jpg) of selected flat geometries within a rectangular frame. As I can understand the single possible way to utilise ViewCaptureToFile/ViewCaptureToClipboard commands, but:
The commands capture the whole viewport but I need shrink the image only to the chosen rectangle (rid of background).
How to get true color data (a texture or a solid color) on the image without any material and light effect?
you can set the properties of the viewport in the viewport options-
so whatever that pixel dimension is you can set it to reflect that.
Iâd then position your geometry appropriately, then make a named view so you can work on it, but return it to itâs proper orientation.
then work in rendered mode, but shut shadows off. layer your geometry as needed, without shadows you can work in the z direction to create your overlaps.
then capture that viewport using the viewport resolution drop down
Printing to an image file will give you the most control over defining what you want to output, but it can be quiet a bit more work than ViewCaptureToFile
@pascal , @theoutside thank you for your advice! It works perfectly to obtain shrinked View Capture output to exact geometry, but I have got corrupted colours eventually compared to the original plugged texture
This is the original texture:
and this is the output of the ViewCaptureToFile command (with enabled self-illuminated for the object material and disabled Reseives and Cast shadows):
Seems they look pretty similar but they arenât, if to check their colours the original texture has pure Red, Blue and White colours but the output loses accuracy (all colours have impurity of other colours channel)
capture from the shade mode also destroy original RGB color values (set Light method to âNo lightingâ)
@stevebaer even the Print command gives wrong color output (use it this way: Print > Chose display color > Open in Preveiw > Save .phg file)
Nope, doesât help, note that this problem happens for shading mode as well.
I want to get solely color data without any effect. You can reproduce my problem easily:
Not here, i get 0,0,255 which is what i entered. I only get correct color display if i change my gamma as described above, self illumination enabled of course. Actually, iâve been testing color match in the past with a way larger range of colors, but this is on windows not mac.
Is your ambient color set to black 0,0,0 in rendered display mode ?
Sorry for the delay, it just updated my Mac which took some time. I Can confirm colors do not display properly on Mac. Iâve used this image for my test:
The picture is displayed in Rendered display mode and loaded into Rhino using the _Picture command which uses self illumination by default. The only setting i changed in Rhino (on Windows and Mac) is the Gamma as outlined above. It is set to 1.0 and âUse linear workflowâ is disabled.
Under windows, i get a 100% color match. Under Mac, colors are way off. Note that i neither use Print or ViewCaptureToFile here, i just make a screenshot of the whole display (Print key on Windows, and Command+Shift+4+Space on Mac). Then the image has been put into Photoshop to compare colors with the original using the color pipette.
To exclude color changes by discourse, iâm attaching the reference picture and the screenshots, all saved in png file format as zip file.
@pascal and @stevebaer, iâve tried to investigate what causes the deviation but have not found a reason, at least itâs not caused by ambient light, skylight, shadows etc. Why does it look different on Mac while it seems to match 100% on windows ?
Hi Clement, I am way out of my known territory here as far as any explanation goes⌠the best I can do is to confirm it is different/incorrect on Mac and log a bugtrack item.
@clement - I did this, on my mac:
made a new custom material, with self illumination and color rgb 0,0,255
Set a plan view of a plane with this material to rendered and took a screen shot, sent the screen shot to Windows where I have more image-related software, and checked the color - it was variously 0,0,244 and 0,0,245. The same file captured on Windows the same way has consistent 0,0,255, so I guess that is confirmationâŚ
@clement - if I open a file of a blue swatch created (screen cap of Rhinoâs windopw) on mac, in Gimp on Windows, I am warned about a built-in color profile - if I choose to keep it, the blue shows the 0,0,244 but if I choose to discard it, the blue shows 0,0255âŚ
If I ViewCaptureToFile and open the result on Windows there is no warnng and the color is 0,0,255.
Thatâs interesting. Is the mac using a color profile by default maybe ? I have an M1 using Bigsur but never bothered with these things, at least on macâŚ
@pascal , @clement
Yes, the default macOS colour profile âApple RGBâ causes color distortion if you take a screenshot. But if you switch to âAdobe RGB 1988â a screenshot will take true colours without any color correction.
So, if switch to âAdobe RGB 1988â Colour profile and take a screencap of Rhinoâs window on mac with pure blue (R,G = 0, B =255) swatch I get the same (R,G = 0, B =255) color value of the screencap.
The settings I have used for the file: Abient RGB color = 0 (for Rendered display mode), Gamma =1, âUse linear workflowâ disabled, âSelf illuminationâ for material enabled
In conclusion, apparently the color correction happens during ViewCaptureTo or Print commands
AhâŚthatâs the way to do it I was looking for a similar solution, so thanks for sharing this youtube video.
Would be nice to see if this manual step-workflow to export image can be automated/scripted in python to be used in GH for a whole bunch of image exports.
Having the CaptureViewport output image to perfectly math the boundaries of the selected object. And set output image pixel size (a.k.a. the dimensions of the viewport properties) to match aspect ratio of the selected geometry. Also I was unaware youâd save Z-depth surface info Rhino, so this has been an insightful topic to read.
My current approach is turning a Srf to Mesh. Then calculate a black/white heightmap with MeshColor. âHorster cameraControl toolsâ to set Top view to match the boundary of selected object and the âCapture Viewâ by Ladybugâ. But this leaves white space around the exported image, so Iâll still need to crop the images in Photoshop afterwards.
Anyway, maybe in the near future this will be an option in GH or own of this appâs.
Hello @clement Iâm also trying to work on this. This method works well on setting size and window, but instead losses transparency. Do you know any other way that could export image with both correct window area and alpha tunnel?