Jump to content

Transparancy driven by Camera Distance prman


SimonTheGuy

Recommended Posts

Hey everyone, I've been having some issues figuring out how to solve an issue in Houdini. Right now I'm making an NPR painterly animation using a custom RSL shader and a VOPSOP that blurs the edges of the geometry based on facing ratio of the camera. Right now I'm trying to figure out how to blend between multiple shaders depending on camera distance. I have a pretty good idea on how to make a layered renderman shader, but I don't think it's possible to drive the transparency of multiple layers with camera distance in the shader itself. If it is, it's way beyond my already limited skill.

I know how to do this in Maya using the hypershade with a distance node, a couple of locators, some constraints, a setRange node to normalize, and a ramp feeding into the transparency value of a layer in my layered shader. I've seen a few posts floating around on the internet using point clouds to track camera location in houdini, but I know there's an easier way. I sort of did the same thing with my one VOPSOP but I'm not sure how to approach the layered shader issue. There's an RSL Surface builder, but I don't know where to begin with that, and I'm not sure how to link camera distance - I'm not sure how to layer my shaders either. So right now I'm trying to figure out how to have my camera distance drive a ramp value that would be fed into transparency of a layer in a layered shader. If anyone could point me in the right direction I'd really appreciate it. Thanks a lot for your time.

Link to comment
Share on other sites

Hey everyone, I've been having some issues figuring out how to solve an issue in Houdini. Right now I'm making an NPR painterly animation using a custom RSL shader and a VOPSOP that blurs the edges of the geometry based on facing ratio of the camera. Right now I'm trying to figure out how to blend between multiple shaders depending on camera distance. I have a pretty good idea on how to make a layered renderman shader, but I don't think it's possible to drive the transparency of multiple layers with camera distance in the shader itself. If it is, it's way beyond my already limited skill.

I know how to do this in Maya using the hypershade with a distance node, a couple of locators, some constraints, a setRange node to normalize, and a ramp feeding into the transparency value of a layer in my layered shader. I've seen a few posts floating around on the internet using point clouds to track camera location in houdini, but I know there's an easier way. I sort of did the same thing with my one VOPSOP but I'm not sure how to approach the layered shader issue. There's an RSL Surface builder, but I don't know where to begin with that, and I'm not sure how to link camera distance - I'm not sure how to layer my shaders either. So right now I'm trying to figure out how to have my camera distance drive a ramp value that would be fed into transparency of a layer in a layered shader. If anyone could point me in the right direction I'd really appreciate it. Thanks a lot for your time.

Hi, I've whipped something quickly in a vop shader, you might have to adapt it to your shader though. Basically in my shader I calculate the distance between a point in space (which I later replaced by the camera's world position using expressions). I then get the distance and run through a Fit VOP to resample the distance value. Lastly I run that through a ramp parameter to get some extra control of how the value changes over distance. You then just have to feed that into the mask for your textures or shaders and voila! (I think...)

Cheers

transparency_from_distance.hip

Link to comment
Share on other sites

Hey rafaelfs, thanks a lot for taking the time to put that together. I've been helping some students most of the day/prepping for class so I haven't had time to dive into it, but I wanted to give you the heads up that I'll be taking a look at it soon.

-S the G

Update -

I've been playing around with what you gave me, and I ran into the issue of the surface_object node not being available in the rsl_vopmaterial. I'm rendering my character pass with renderman (I have a custom rman shader that I have no idea how to replicate in mantra). So now I'm trying to figure out how to at least drive the ramp by camera distance and the object using expressions. Once I can get the ramp to work I'm not sure how to link the ramp position in any way to my shaders. I guess my main question is if there is a way to create a layered rsl shader, and if so, how to change the transparency of one or more of the layers with the ramp. If anyone has any thoughts on the matter I would be ecstatic. Also, thanks again for your help Rafael. It's very possible what you put together works, and I just don't know how to use it.

Edited by SimonTheGuy
Link to comment
Share on other sites

I've been playing around with what you gave me, and I ran into the issue of the surface_object node not being available in the rsl_vopmaterial. I'm rendering my character pass with renderman (I have a custom rman shader that I have no idea how to replicate in mantra). So now I'm trying to figure out how to at least drive the ramp by camera distance and the object using expressions. Once I can get the ramp to work I'm not sure how to link the ramp position in any way to my shaders. I guess my main question is if there is a way to create a layered rsl shader, and if so, how to change the transparency of one or more of the layers with the ramp. If anyone has any thoughts on the matter I would be ecstatic. Also, thanks again for your help Rafael. It's very possible what you put together works, and I just don't know how to use it.

I know, you probably don't need the surface model there, I just used cause I'm using mantra... but you can delete it completely. In fact, all you need are the nodes right before the Float to Vector VOP. That will give you a value from 0 to 1 based on the distance of your camera to the object. You just have to adjust the maximum and distance cause the value will be clamped past that.

Cheers

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