Environments, refl/refract and alphas

   10153   7   1
User Avatar
Member
16 posts
Joined: Feb. 2009
Offline
So I am tackling Mantra now, and I am running into a few issues involving environments.
I've been using mental ray for years, and there are some very nice, easy-to-use shaders for what I am trying to do here…let's see what Mantra can do
I am hoping there is a way to set an environment map for refl/refr gloabally rather than for each material.
Setting it in each material gives me something like this:

If I render out in passes and I can finesse it in post, then fine, but setting the same envionment map in each material seems inefficient. Also there is an issue with using an image sequence for the bg/refract…more on that below.

I tried setting an Environment light with a map which gives this:

The result for reflections is quite nice, but I get no refractions. Also, there is no respect for the alpha channel in the glass material.

The nicest result strightaway seems to be using an Environment Box which is giving me this:

The problem with this is two-fold…
1: In using an Environment box, I get no alpha for comping in the background plate in post.
2: this quick test was using an HDR->rat file. This would seem to be impossible to do with a sequence of images as a background plate for refractions.

Lastly, using the Background image parameter in the camera itself, I still get no action in the glass' alpha…no background, just black.

This testing is for a shot I am begining to work on where I will be camera tracking and comping in the background plate.

So, the questions about all this are:
1. Can I use an Environment map globally for reflection?
2. Do I need to use a *.rat or can I use a shperical hdr?
3. Can I use an image sequence in the background to get proper refraction in the glass material with an alpha for the background (ie.: no image plane)?

Thanks
Michael
User Avatar
Member
8551 posts
Joined: July 2007
Online
i am usually using big sphere around the scene with constant shader, either with rat or hdri map, it can be sequence of course

the sphere is set as phantom so it is visible only for secondary rays
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
696 posts
Joined: March 2006
Offline
There is an alpha parameter on the environment box material. You can manually set the alpha to 0 so that you are left with the ability to comp
Stephen Tucker
VFXTD
User Avatar
Member
16 posts
Joined: Feb. 2009
Offline
ok. Cool. This is getting me closer to what I want and it is all making better sense. (This transition from Max-> Houdini has been interesting(and fun))
So here is the current set-up and problem, with the scene screen-shot posted above:
Glass and liquid with default glass and liquid shaders.
Environment light with a *.rat (made from a cross hdr) in the Area Map slot - this gives me the global reflections I am after.

Now I want to take an image sequence and place it in the background to get my refractions through the glass.
If I use an Environment Box, I can't seem to get a camera match.
I am using a 1.778 aspect ratio image as the background, and I am rendering off to the same.
Is there a method to do so?
User Avatar
Member
16 posts
Joined: Feb. 2009
Offline
So here is what I have done:
Creating a plane, aligned it to the camera, pushed it back and parented it to the camera.
I added a UV Texture SOP and set it to Prespective From Camera, and I applied a Constant shader with my background footage.
Works well enough.

However, having to go through setting this up seems less than ideal, so I tried creating an environment box, setting a UV Texture SOP the same way, but the texture is not projecting properly at all, both with trying an EnvBox shader as well as with the Constant shader.
Any thoughts?
I can post another couple of renders if it will help.
User Avatar
Member
8551 posts
Joined: July 2007
Online
luckymutt

Creating a plane, aligned it to the camera, pushed it back and parented it to the camera.
I added a UV Texture SOP and set it to Prespective From Camera, and I applied a Constant shader with my background footage.
Works well enough.

However, having to go through setting this up seems less than ideal

you can allways make an digital asset from this setup
and use it every time you need it

Some time ago i've built similar asset which was creating grid with exact dimensions just by specifying Camera, Distance and Texture Map. There was some math involved to get the right dimensions according to FOV, aspect, distance … but nothing too difficult.
Your approach with camera projection seems quite interesting and simplier.
It may have some downsides however.
1. the projected texture can be distorted if you are using UVtexture SOP to create camera uvs.
But you can extract per pixel camera coordinates directly in the shader and use them instead for your texture to solve this
2. if you create large sphere around the scene and project your image just from the camera view. It will look right from the camera, but i am not sure what image information will be on the rest surface of the sphere and thus what will be visible in the reflections/refractions. So it may require some customisation of the shader to for example set the opacity to 0 for all the surface off the camera.

but back to your question:

the enviroBox will not work with the custom UV mapping you are doing in SOPs because it is using environment VOP for the color (i can be wrong though)
constant material should work
just make sure your bg geometry e.g. large sphere sphere is not primitive type, because UVtexture SOP is creating information on points and since primitives are only 1 point UVs will not be correct
and if you are using polygonal sphere make sure you have enough subdivisions to reduce distortion
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
16 posts
Joined: Feb. 2009
Offline
Cool. Thanks for the reply.
I think I will make a digital asset for this. I'm kinda surprised there isn't something out of the box, but at least now I can get further into how other aspects of Houdini works

Lastly, do I need to use convert images for reflection to a *.rat file?
or can I use spherical or light probe HDRs?
I didn't see much info on the *rat format itself in the docs.
User Avatar
Member
8551 posts
Joined: July 2007
Online
i do not know much about .rat files
but according to this http://odforce.net/wiki/index.php/Rat [odforce.net]

each texture is converted to rat before rendering
so with converting it yourself you gain some speed increment in render startup and more efficient memory management since only needed parts of the image will be loaded from disk

so this all means that you can use hdr images and it should produce the same render as rat file converted from them.

if you decide for .rat
you can convert the whole sequence to .rat in COPs or MPlay
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links