layered surface SHOP

   6001   8   3
User Avatar
Member
122 posts
Joined: May 2006
Offline
i'm newbie
tried to use the layered surface shop,
i used 3 layers: base layer and the other two upper layers using images with alpha chanel.
apply to a box sop with a shader node. and attach multiple layer & uv project nodes. i overlap the uv project try to make an overlaping texture.
evrything looks right except the compositing mode.

i was trying to make an overlapping texture (using alpha of each texture).
but the effect i got when rendered was the upper layer always ‘add’ to
lower layer texture(so the texture became brighter ). the ‘over’ mode in this SHOP parameter seems doesn't work. The open GL display in viewer show the right ‘over’, but only when rendered it doesn't look right.

how to set the compositing mode?

thx.
User Avatar
Member
7766 posts
Joined: July 2005
Offline
It seems to work for me here in 8.0.474. See the attached file. I tried changing between 0.5 and 1 in the second layer's Alpha parameter and in both cases, Compositing vs Add gave what looked like the correct results to me.

Attachments:
multi_tex_layer.hip (601.2 KB)

User Avatar
Member
122 posts
Joined: May 2006
Offline
thanx edward,
i just check your hip file. then i found out that it works for the ‘default.pic’ used as texture in that file so the compositing (using ‘over’ mode) looks right when rendered. but when i use my tif/tga file (with alpha channel), the alpha doesn't work.
why is it?

thanx.
User Avatar
Member
2199 posts
Joined: July 2005
Online
could you post a sample image, it should work. Is the alpha 100% white where you want it opaque and 0% where it should be transparent. And is the image 100% black where it should be transparent.

Also you will always get better texturing if you convert to houdini's rat format. Not sure if it is available in Apprentice or not though.
The trick is finding just the right hammer for every screw
User Avatar
Member
122 posts
Joined: May 2006
Offline
thanx for the information.but wow that's quite weird …
the image has the proper alpha channel, the only problem that i don't use that 100%black on the RGB channel where it should be transparent.
coz, in my experience working in other 3d/compositing software , the RGB channel can be ‘whatever’ then i only need to add/adjust alpha channel to mask the image that's why i didn't think that i have to black out the part in rgb channel.

so that's the rule of houdini ? why is it like that??

thanx
User Avatar
Member
10 posts
Joined: July 2005
Offline
it's called premultipycation. Every compositing tool uses it, but some won't tell you.
mathematicaly what a over operation does is: RGB_Over = (RGB_BG * (1-Alpha_FG)) + RGB_FG.
If your foreground happens to be unpremultiplied (means you have nonzero RGB Values with the corresponing aplha values being zero) those RGB Values get added to the composited image.

I think there is no checkbox for premultiplying your texture in the VexLayeredSurfaceShader, so you got to be sure this happend before you put it there.
User Avatar
Member
252 posts
Joined: July 2005
Offline
Most compositors will go funky if you use unpremultiplied images. This has been my experience from myCAPS days at Disney through COPs, Shake and Fusion. Some (like Fusion) have an option in the Loader to specify the image isn't pre-multiplied and does the pre-multiplication for you (it is a check box called “Multiply by Alpha” or something like that).

The only place where I have found this to not be the case is with Real Time graphics like OpenGL renders where things with transparency get premultiplied in the graphics hardware and you want them un-premultiplied. (This is the case with OpenGL Sprites in Houdini).

Weird.

-c-
User Avatar
Member
2199 posts
Joined: July 2005
Online
After Effects gives you the option to say how the image was made, premultiplies or not. But I swear the result looks subtly different (even with the correct setting) to when you comp in Houdini, never worked that one out.
Same with photoshop, you can't remove an alpha to make the image transparent in the same way as if you render a tif (from Houdini) which has an “assiociated” alpha built in and opens in Houdini with the transparency already calculated. It's very annoying. They do supply a remove black matte option but you apply this after the transparency has been created and again it produces slightly “wrong” results.Crazy.
The trick is finding just the right hammer for every screw
User Avatar
Staff
5169 posts
Joined: July 2005
Offline
The only place where I have found this to not be the case is with Real Time graphics like OpenGL renders where things with transparency get premultiplied in the graphics hardware and you want them un-premultiplied. (This is the case with OpenGL Sprites in Houdini).

It depends on how the programmer sets the blending mode in OpenGL. If your image is already premultiplied, or you don't want it to be mutliplied, the blend funciton must be set as
glBlendFunc(GL_ONE, GL_SRC_ALPHA_MINUS_ONE);
Otherwise, it should be to
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA_MINUS_ONE);

But it's generally difficult to give the user control over that in any meaningful way. COPs/MPlay does it for displaying foreground/background comped images in the Display Options (Background, Foreground images are Premultiplied) because it comes up from time to time there.

After Effects gives you the option to say how the image was made, premultiplies or not. But I swear the result looks subtly different (even with the correct setting) to when you comp in Houdini, never worked that one out.

Could be that the alpha is being multiplied twice somehow (which would result in the alpha being squared, identical to applying a gamma of 0.5 to the matte). Try adding a gamma COP with the gamma set to 2 and the scope set to the alpha matte to see if that fixes it.
  • Quick Links