Fully transparent BSDF?

   1996   6   0
User Avatar
Member
32 posts
Joined: Nov. 2017
Offline
I'm trying to write a particular shader “from the ground up” as a learning exercise. I'm an old-school graphics programmer but just learning VEX and VOPs. Using Houdini 16.5.

My question is this: the BSDF is an opaque type. There's a few VOPs/VEX functions to create one, “diffuse” and a few others. I'm looking for the “noop” BSDF, that just always returns the incident ray – i.e. fully transparent, no refraction or opacity or anything. I'd like it to be really fast.

The reason I'm asking is I want to write a shader which is emissive-only. I know how to export Ce, but I'm stuck on creating the “noop” F. Right now I'm using pbrglass with ior set to 1 which works, but when I look at the VEX code I can see it's doing a lot more work than I need (i.e. it's calling get_bsdf(“phong”)).

Any advice appreciated!
User Avatar
Member
7762 posts
Joined: Sept. 2011
Online
the no op bsdf is
bsdf()

check out shaderlayer.h for an example of a noop bsdf

Edit:
To elaborate, a bsdf in mantra does not determine opacity or emissivity. To do that you need to make a complete surface shader. The Of export sets opacity, an the Ce export sets emission.
Edited by jsmack - Nov. 22, 2017 19:47:55
User Avatar
Member
32 posts
Joined: Nov. 2017
Offline
jsmack
the no op bsdf is
bsdf()

check out shaderlayer.h for an example of a noop bsdf

True – I found that. But that bsdf reflects all incoming energy randomly in a hemisphere around the normal, as far as I can tell; i.e. it's perfectly diffuse with zero transmission. I'm looking for a (fast) bsdf that takes all incoming energy and continues it (“refracts” it) through the object in the same direction, i.e. the ideal transparent object. I understand I can set Of to 0 but that's not what the glass shader does, for instance. (Again, as far as I can tell – I could very well be wrong.) I would expect (hope?) such a bsdf to be even faster than the bsdf() one you mention above, since it doesn't need to randomize anything.
User Avatar
Member
8548 posts
Joined: July 2007
Online
garyo
… I understand I can set Of to 0 but that's not what the glass shader does…
why would you want to do what glass shader does? Setting Of to 0 is much more efficient than using refractive bsdf
so empty bsdf() with Of to 0 and whatever emission you want should be very efficient as no light or geometry sampling will be invoked from such shader
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
32 posts
Joined: Nov. 2017
Offline
tamte
Setting Of to 0 is much more efficient than using refractive bsdf
so empty bsdf() with Of to 0 and whatever emission you want should be very efficient as no light or geometry sampling will be invoked from such shader

Ah, I see! Thanks very much for the help. If Of>0, then the bsdf will get sampled, but not if it's exactly zero. That's helpful.
User Avatar
Member
178 posts
Joined: Jan. 2013
Offline
Also, I haven't tested it thoroughly (but have used it…), doesn't multiplying a bsdf by zero set its probability of sampling to zero, hence no sampling occurs?
User Avatar
Member
8548 posts
Joined: July 2007
Online
garyo
Ah, I see! Thanks very much for the help. If Of>0, then the bsdf will get sampled, but not if it's exactly zero. That's helpful.

empty bsdf() should already not cause any sampling
Of to 0 is just to get it fully transparent without using any raytracing if all you want to do is just send the ray through
Edited by tamte - Nov. 28, 2017 05:28:05
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links