Forum: Poser - OFFICIAL


Subject: Nylon Material?

Latexluv opened this issue on Jun 04, 2010 · 182 posts


Sentinelle posted Sun, 20 June 2010 at 2:17 PM

Quote -
So - for alpha to be 90, it means that the polygon we're looking at (or micro-polygon - doesn't matter) has to be exactly parallel to the viewing vector. Which means the viewing vector cannot intersect the polygon. Which means the shader will never be called in this case, because by definition the perspective view of such a polygon has zero width, effectively making it invisible. Poser doesn't render invisible things.

However, in practice, due to round-off error, I allow for the possibility that the angle could get so close to 90 that cos(alpha) becomes effectively 0. And if it is 0, then we have a problem, because we can't divide by 0 - the value is undefined.

So in my shader, (not what I showed earlier) I don't actually use 1/cos(alpha). Instead, I add a slight bias, and use 1 / (.00001 + cos(alpha)). This means the denominator never goes to 0, no matter what.

It could go to 0 if cos(alpha) becomes negative, but that would mean the surface is pointing away from the camera - we'd be looking at the back of the polygon.

The truth, though, is that Poser doesn't use cos(alpha), but instead uses the absolute value of the cos(alpha), which means it is never negative, even when we are looking at a back-facing polygon.

BB, thanks for explaining how Poser internally computes and utilizes cos(alpha).  Will the updated shader be posted at your website site?  I downloaded your BBNylon.mt5.txt from this thread and started rendering with it.  It looks great on Hongyu's outfits.  Thanks again BB.