JonathanGranskg Posted December 20, 2013 Share Posted December 20, 2013 (edited) 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 December 20, 2013 by JonathanGranskg Quote Link to comment Share on other sites More sharing options...
JonathanGranskg Posted December 20, 2013 Author Share Posted December 20, 2013 (edited) 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 togetherF = texture(map) * diffuse() + 0.5 * phong(20);// Red diffuse surfaceF = diffuse() * {1.0, , } So it should be like the second one. Edited December 20, 2013 by JonathanGranskg Quote Link to comment Share on other sites More sharing options...
danylyon Posted January 14, 2014 Share Posted January 14, 2014 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. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.