How to render only visible parts of object

Hi there! I’m trying to find a way to get renders of visible parts of object entities in a scene. For example, i have two balls in an image, and i would like to get a render of what is visible from both.
Example image of scene:


Photoshoped out front ball:

The background and the front ball has to be transparent for the usage i’m trying to create.
I know this is possible and easy to do in photoshop/paint.net afterwards, but the plan is to automate this in ruby and do it with numerous objects to make a object builder of sorts. Is there a clever way to do this in sketchup?
I have managed a similar result by simply hiding all but the desired entity and rendering the image once per entity in the scene, but there is then a problem with overlap between objects which are both in front and behind each other.
So far i’ve experimented with SU Podium and V-Ray with not to much luck.

Seems to be very similar to what is asked and solved in Blender in this post:


But i find no such discussion for Sketchup

Did you tried masking with the MultiMatte Materials element and Material ID Number in V-ray?

I’ve played around with it now, and i am not able to get the desired effect.
Using material ID it is possible to render after only numbered entities, but the unnumered entites are then just rendered as black objects. Am i missing something or digging in a dead end?

It is necessary to put an ID number for each material. You can number up to 100 materials.

Is there then a way to make the front ball transparent? It seems to just be able to set the color to sRGB but no alpha or similar? I want it to basically look like there is a chunk missing from the back red ball.

You can get this after render, but with the help of an image editor.

It will be probably possible directly after it is implemented in Vray for SketchUp - rendering Selected Object Only

You mean i can do this easily in photoshop/paint.net or similar then? I am aware, but sadly this is not a realistic workflow for the scale of objects i’m planning on rendering.

The video example you bring up does seem to do exactly what i need if the black front makes transparent cuts in the rendered object, but i understand that this is not yet available for the Sketchup plugin of VRay?

Thank you for your help so far! :slight_smile:

Still hope there is a way, possibly with some other render software, i’m experimenting with the Thea renderer, but it reaaaally likes to crash sketchup for some reason, so it’s going a bit slow.

Also, what software did you use to create the GIF in your first reply? It’s a very neat and efficient way to show workflow.

You’re welcome!

Licecap - https://www.cockos.com/licecap/

1 Like

Heyyy! I think i solved it!
Found this forum post from 2013 asking the same thing with a solution.

https://forums.cgarchitect.com/topic/69447-vray-rendering-selected-object-only/

Basically one just adds a “Wrapper” material from V-Ray Asset Editor, sets a base material (any will do, but can’t be none), set alpha to “Black Alpha (-1)”, and enables “Matte”. Then you put this material on all objects except for the one you want to render.

This can be easily enough automated in Ruby after the material is created.

This does not manage ‘hidden’ portions of individual objects, but with FredoPortrait you can isolate selected objects and render them in isolation.

Also, if anyone has the same headache as me and are struggling to find sources to automate V-Ray rendering, i found this random youtube video with a solution for rendering with V-Ray from a ruby script.
The ruby script is in the video description

Essentially boils down to:
live_scene = VRay::LiveScene.active # Make a scene object (Or something like that, i’m learning too)
live_scene.render # Render the current scene

Be aware though that as far as i understand this is not an official V-Ray API, just a class call that happens to work, but could change at any time.

Hope this is helpfull :slight_smile: