Jump to content

Z Depth and opacity


re vit
 Share

Recommended Posts

One trick it to assign every material in a scene a falloff map to the diffuse slot. Make this map black to white via distance from camera on the z-axis. Set the distances in here to your near and far points and you should be good to go. This way, the opacity maps remain. I'm not sure how well it'd fair with displacement maps, though - I'm not sure if the falloff would be applied pre- or post-displacement - if the former, it won't work, if the latter then it should, but I haven't tested it.

 

I actually wrote a script a while ago that automatically sets this up for all materials in your scene, but as I'm mostly an MR user, it doesn't support VRayMtl and I don't have it with me atm!

 

But it should work if you do it manually, I think!

Link to comment
Share on other sites

Neither standard nor vray mat work. Here is simple scene.

I use 'tree shop' (scriptspot dot com/3ds-max/tree-shop)

for billboarding. In case you don't have it I converted one plane to mesh.

@Dan:

Could you apply this trick on my file and repost it please? I'm not sure

I understood it well.

@Stef.:

If so no more questions.

Edited by 1rv
Link to comment
Share on other sites

One trick it to assign every material in a scene a falloff map to the diffuse slot. Make this map black to white via distance from camera on the z-axis.

 

That is brilliant!

 

I had come up with a similar trick many years ago with Lightscape by using all white materials and black fog rendered to 16bit. Depthmaps should always be rendered to at least 16 bit! Otherwise, you will end up with visible banding not only in the map, but in the images you use it to modify.

 

What is good about both my old method and this newer one is that you can keep any and all clipping maps and any reflectivity you want to use. If your regular render has areas with strong reflections, you will appreciate the depthmap including that. You can even use multipass layers to separate reflections from the base diffuse (without reflections) channel.

 

Options are good.

Link to comment
Share on other sites

In the OP's case he'll need to remember to keep the opacity maps in place for the billboard objects which makes it a little more laborious than a simple global override material though.

 

You can still use an override for the majority of objects in your scene, just be sure to exclude your opacity mapped objects from it and create new materials for these with the same falloff map in the diffuse slot.

Link to comment
Share on other sites

On a similar subject, does anyone know how to get around the anti-aliasing issue with Z-Depth-based Depth of Field? That is, AA smoothes the edges but adding a tiny gradient from one colour to another colour. In a greyscale pass, this equates to the edge of a white object over a black background appearing grey. This looks much better than a jagged line, but of course when the pixel luminosity is used to define depth, that grey section then becomes a bit of space between the white and black bit, screwing up the depth blur. On the other hand, if you don't use AA (but did on the renders), your DoF doesn't look right because it's all jagged.

 

Any solutions? The best solution I've found is to render in layers - ie, foreground, middleground and background. But this increases rendering somewhat and seems a bit tedius in post - is there a better way?

 

(Or should this have been a thread unto itself?)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...