Jump to content

Occlusion pass for a whole scene


Recommended Posts

Hi,

which is the easiest or the common method to have an ambient occlusion pass for a whole scene, I mean all the geometry? I have both displacements in materials and SOP level assignments. The solutions I can think of all involve some degrees of handwork. How do you guys solve these kind of problems?

cheers

bmt

Link to comment
Share on other sites

I'd think the easiest way is to add a light template object with a vex global illumination shader to the scene, and make an 'occlusion' take which activates it.

Set the 'global tint' value of the shader to 2.

To override the materials, make a python script and save it in your home/houdini/python directory for future reuse:

import mantra

def filterMaterial():
    mantra.setproperty('object:surface', 'plastic')

def filterInstance():
    mantra.setproperty('object:surface', 'plastic')

In the occlusion take, set your mantra rop's command parameter to "mantra -P $HOME/houdini10.0/python/default_material.py", changing the path and filename to point to your script.

This should preserve your displacements, but if you're displacing normals inside a surface shader that would be more tricky...

Is your avatar from Mindgames? I know I've seen that somewhere!

Edited by mrice
Link to comment
Share on other sites

very cool, mrice!

another way would be to add a global illumination light set to ambient occlusion to the scene and export a extra imageplane with Cl as vex variable and Your lighttemplate, that has the global illumination shader attached, in the light mask. the renderengine should be micropolygon

Martin

Link to comment
Share on other sites

Thanks a lot!

I will try both approaches.

yes, Michael, the avatar is from Mindgame. It's from the scene when god (or whatever it is) tells Nishi that he is dead. I love the whole movie, but that hissy is particularly funny. (ok, it actually resembles me, when I need help badly.)

cheers

bmt

Link to comment
Share on other sites

Also, probably the most simple one is to place an occlusionVOP separately into the surface shader and connect it to an export parameter named occlusion or whatever, and add just an image plane to the mantra node.

Since it is not connected to anything, you can copy-paste it into other surface shaders, and you will have an occlusion pass, regardless what is the displacement on all the shaders.

Link to comment
Share on other sites

Hi,

the solution what Martin suggested is really nice, and easy to setup, the only problem with it that it needs a separate render, what in practice nearly doubles the render time (it will be faster than the original render, since it doesn't use the lights). In this regard Daniel's solution is better since it calculates the occlusion during the main render, but it's harder to setup and needs maintenance.

the ideal solution would be a custom light, which would calculate the occlusion and export a custom vex variable. the Cl of this light would be set to zero, to not contribute to the lighting of the scene.

unfortunately one can not export arbitrary variables from a light shader, at least i wasn't able to. A value connected to Cl get exported as Cl, but not if using a parameter node as in a shader. Why is that? IMO it would be very useful.

bmt

Link to comment
Share on other sites

unfortunately one can not export arbitrary variables from a light shader, at least i wasn't able to. A value connected to Cl get exported as Cl, but not if using a parameter node as in a shader. Why is that? IMO it would be very useful.

You can do that, but you'll need to import the variable in an illuminance loop in your surface shaders to render it. So it's not really the "easiest" way because you'll have to build that into all of your surface shaders. Cl works because its a global variable available to the surface shader.

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...