Jump to content

Assigning BSDFs in VEX Shading


JonathanGranskg

Recommended Posts

Hey,

 

Quick question, how do you assign a bsdf to a shader when writing one? I know there's an F output, but I still feel a bit confused about it. Does anyone have any basic example? I couldn't find anything by googling.

 

Let's say I want to assign a diffuse BSDF to a shader that's supposed to be some color.

 

Do I output it like this?

 

Cf = color;

F = bsdf diffuse();

 

Or should I multiply the bsdf by the color to see the color?

 

F = bsdf diffuse() * color;

 

Cheers,

Jonathan

Edited by JonathanGranskg
Link to comment
Share on other sites

Never mind. Found this in the help docs right after posting, not exactly where I expected to find it.

 

// Multiply the diffuse (hemispherical) BSDF by the texture color,
// multiply a phong BSDF by 0.5, and then add the two BSDFs together

F = texture(map) * diffuse() + 0.5 * phong(20);
// Red diffuse surface
F = diffuse() * {1.0, , }

 

So it should be like the second one.

Edited by JonathanGranskg
Link to comment
Share on other sites

  • 4 weeks later...

And then there's albedo().

Never fully understood it, but I think it returns the overall amount a BSDF reflects. Which you can use to normalize / make a BSDF energy conserving.

 

So if You do

F = phong(Exponent);

albedo = albedo(F);

F *= 1/albedo;

 

Now, no mather what Exponent you're using, the shader will be energy conserving.

  • Like 2
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...