Creating a fake refraction/reflection shader in VOP's

   9220   5   3
User Avatar
Member
319 posts
Joined:
Offline
Hey Houdini Dudes,

I am trying to render something which at current involves a combination of raytracing and motion blur. Needless to say this combination is no fun in terms of rendering time/computation.

I am raytracing as my object is translucent and liquid based, and I want my object to reflect and refract its environment.

Because the object I am rendering is quite small on screen I decided that I could get away with using an environment map lookup instead of true raytracing against my backplate and 3D environment. I have started to put together a vopnet which makes use of the frensel and environment vop's. I think I am on the right track but I am not 100% sure about how to wire the opacity correctly. I was advised that I could take the output of Kt of the frensel vop (the amount of transmitted/refracted light - I took this to mean the amount of light which ‘passes through’ my object) and output that to Of. I'm not convinced that this is giving me the correct results however. Being quite a VOP's novice I thought I would turn to the ever reliable SideFX forum on this issue for further guidance.

Please see hip file attached.

Thanks in advance for any tips.

Attachments:
reflect_refract_vop.hip (173.1 KB)

User Avatar
Member
319 posts
Joined:
Offline
Did I say something wrong? :cry:
User Avatar
Member
454 posts
Joined: July 2005
Offline
Have you looked at normalizing N and negated(I) from globals, and feeding them into opacity via some kind of fitrange function? That usually gives you the kind of opacity rolloff between front facing and perpendicular faces that I think you are looking for. (Alphapara/Alphaperp)

Another way of putting it (roughly):

1./ Normalize and negate I
2./ Normalize N
3./ feed them both into a dot product vop.
4./ put that into a fitrange or similar to tweak rolloff between 1 and 0.

Cheers
User Avatar
Member
319 posts
Joined:
Offline
Thanks for the tips.

I tried your approach and got something like what I want. I managed to get the falloff I wanted and tweaked it with a shift range VOP. However the falloff only presented itself as I wanted when I plugged my opacity values out to cf, when I outputted to of I got opaque. Using front face (after talking to some friends about the issue) seemed to get rid of this problem as I think the opacity of the backfacing polys inverted due to their inverted dot product value, and so the opacity was always stacking up to 1.

Not sure if this is correct but my shader is doing what I want so I'm happy!
User Avatar
Member
454 posts
Joined: July 2005
Offline
Yep - I forgot to mention the front facing bit - Sorry!
(Dot products return a value from -1 to +1):
http://freespace.virgin.net/hugo.elias/routines/r_dot.htm [freespace.virgin.net]

Glad you got it working…

Cheers
User Avatar
Member
648 posts
Joined: July 2005
Offline
Dean_19
Did I say something wrong?

“dudes”.
  • Quick Links