Never allow a selected object to be obscured from view by any other object


#1

I’m trying to work out an issue where I have an object I always want to see, and it makes sense for depth of field and other reasons for it to be at a certain distance from the camera, but there are objects flying out from a central object behind it that sometimes pass through or around it to cover it from view.

I basically just don’t ever want it obscured, and would like to find the lightest weight way to achieve this.

I suppose it could be matted somehow such that other objects are subject to the matte. I see how to do that with compositing and separate matte passes, and there’s probably some way to combine that into a single render which is what I want, but I’m thinking maybe I’m missing some simpler command that just never allows it to be obscured from view.

Or, since in this particular case, this object never moves, and is always fixed position relative to camera, perhaps there is some way to just affix it to the camera such that it is not subject to object depth in the way others are. For example, picture a camera with a display about the camera battery life that is never affected by objects in the camera’s view.

Open to any solution, and I should probably learn them all, since I’m sure some version of this will pop up again for me.


#2

Make it really small and put it right in front of the camera, or at least in front of all other objects in the frame.


#3

I didn’t try this, just some ideas:

  • There’s the ‘foreground object’, that shows a texture in front of everything else in the scene. Maybe that’s already enough, as you said your object wouldn’t move. So just place it as a texture.

  • If you need something with more dimension, you could try setup the object with a separate ‘object’ camera. Feed this camera view into a camera shader and put that as a texture in the foreground object that affects the ‘scene camera’. Use an object buffer to create an alpha around your object, so the scene shows through. That way you have a 3D-Object in front of everything else.


#4

Ok, I got curious myself and tried building that. It actually works :slight_smile:
Scene file attached!

Foreground-Object.c4d (229.2 KB)


#5

By the way, I think you can use the same technique to achieve your other question “blurring of particular objects”. Set up a Cam for those, generate a texture, blur it in the shader, compose via foreground or background object.


#6

Fascinating. But on my machine, it doesn’t work in the viewport with R21 (only R23), and both systems crash hard when I try to render. Does it render for you?


#7

Can’t try that at the moment because I have big project rendering… will try that afterwards and report back!


#8

Hmmm, @Cairyn, you are right. I tried rendering with Standard renderer, both S22 and R23 freeze and then crash. I’ll send the file to Maxon’s support, since the setup isn’t that extraordinary and should work out of the box…


#9

Wow, great support from Maxon. I was allowed to share the info:


Inside the camera shader of the material these marked options (at least the foreground) should be disabled, as the rendering is running in a loop and can’t proceed correctly:


The version itself does not matter in this case. Every version would run into an infinite loop due to the setup of this scene, as long as these options are enabled.


@kanicki – that works now! :slight_smile:


#10

Took me a little while playing with it, but I think I’ve got it.

I can already think of several other uses for this in multiple other projects.

Funny, I came back today not expecting an answer, but hoping to ask if a similar solution was possible as I was thinking about some kind of projection using object camera. I wasn’t aware of the foreground object plane, so that seems to work together nicely.

For anyone trying to follow this, here is the same project, but with all the boxes unchecked as advised to fix the render issue, and image alpha settings to yield solid foreground.

I think this should work. Fingers crossed for dropping it into the bigger project.
thx

Does this cause any sort of significant system hit I should know about or anything like that where some render settings might need to be tweaked.?

foregroundobject.c4d (214.5 KB)


#11

That’s the first thing I tried… but there’s a lot of objects flying toward the camera, and I kept getting individual frames where they’d break through.


#12

@kanicki Nice to hear! I didn’t really test that setup, so I can’t share any caveats. Thanks for the updated scene, btw, and good luck with your project!