Jump to content

P world in mantra


Recommended Posts

Hi!

I have a question about mantra and world position pass. I have followed aRtye's description from this page: https://www.sidefx.com/forum/topic/34302/ and set up a P_world pass that renders in Mantra. The problem is that I get an edge when grids are overlapping each other (see image below). I have tried getting rid of the edge by lowering the opacity limit in the Mantra node, but that gives a black edge in the C pass. Removing the filter from the alpha channel in the shader gives a slightly better result, but nothing I have tried gets rid of the edge completely. 

Does anyone know a solution to this problem or a better approach to get a world position pass?

Example file (using the Houdini butterfly image file):

p_world.hip

p_world_02.JPG

Link to comment
Share on other sites

Deep rendering probably fixes it. Deep only has problems when you intersect geometry.

EDIT: just use the new CryptoMatte in 16.5, put down a new Mantra node. It works perfectly!

Edited by tar
Link to comment
Share on other sites

I have not looked at your file, but.. are you sure you are using the correct sample filter for your P image plane?

P, Pz etc must not be sampled by opacity, but rather closest surface. So you set the sample filter to closest surface, and then use something like "minmax min" for your pixel filter.

  • Thanks 1
Link to comment
Share on other sites

@protozoan: you are right. 

@marty: CryptoMatte use ObjID or MaterialID to generate different layers, but in this specific case both butterflies are generated at geometry level so it is only one object and both butterflies use same shop material. Ok, you can separate those, to two objects, or two materials, but there is new problem which CryptoMatte can not handle. (Ok, it can, but solution you have to apply for CryptoMatte to work properly is based on regular solution which applied to P pass solves problem too without CryptoMatte.) And problem is hidden in fact that those butterflies are not "shaped" by geometry but by alpha channel in image which is projected to plane(s). So in case of P pass (same apply to N, Pz, Pworld etc) pixels around alpha edges really exist on scene (only their opacity differs).

In general, you can deal with that on two different ways. One and probably most common solution is to use already prepared presets for pixel filtering as protozoan suggests and second to handle those specific things in shader by yourself. Second approach gives you endless possibilities and you are not limited only to filtering.   

This is modified scene which works using closest surface filtering

p_world_modified.hip    

And this is custom shader solution which solve your problem in shader. It simply does manual pixel in-shader compositing, for all semitransparent pixels but for full transparent or full opaque pixels it works like your basic shader. 

p_world_modified2.hip

 

cheers

 

Edited by djiki
Original butterfly texture is premultiplied so I had to change math for compositing in shader
  • Thanks 1
Link to comment
Share on other sites

I must be missing the point of the position pass - why do you want it? In Nuke using position to points node produces many artefacts with all those methods whilst using a deep or cryptomatte allows for a perfect edge.

Link to comment
Share on other sites

Thank you so much guys!

I have now tested all approaches, except CryptoMatte . The closest surface setting in the render node gave good result on close ups with a few grids, but when adding a crowd I got egdes around the alphas of the crowd, see screenshot where I have zoomed in a bit (light weight crowd is what I am wanting to use the grids for). Also picking an area from the P_world pass in Nuke was not very accurate. The shader approach looked great in the test frame, but when adding a crowd the render got very slow. 

Deep seems to be the best option for me now, the rendering is quite quick and the flexibility is great. The only problem is the size of the files, but I think I'll just have to deal with that for now. Thanks for your good advice and your time!!

Capture.thumb.JPG.f116d2438a67136f34750289a73f4fd0.JPG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...