[Bf-cycles] Shading tangents patch (for the ward anisotropic closure)
mike.farnsworth at gmail.com
Thu Mar 22 08:12:26 CET 2012
Actually, it totally respects discontinuous UVs as assigned by the
artist. That is precisely why you got the discontinuities in your
image; if you go look at the smart UV projection results on the
Suzanne mesh, it creates a pile of islands that are discontinuous.
Your result is exactly what I would expect from it, actually. =)
As for modern rendering not allowing discontinuous tangents, actually,
it's pretty common. It only takes a quick thought experiment to see
why you pretty much can't get around them. Imagine any model (a
person, a monkey head, a box, a sphere), and then imagine you have a
2D sheet with arrows pointing in a consistent, smooth direction (the
tangents). Now, try to wrap that sheet around any of those meshes,
and not end up with seams, holes, or singularities. You are allowed
to stretch and squash it as you wrap it as you please.
You'll never get anything completely continuous, no matter how hard
you try. Smart people have written PhD theses regarding how to
minimize parameterization issues like these, and so far there's no
So, we have a few choices for tangents:
1 - Automatically generated, but there *will* be at least one source
and sink, and the tangents will be discontinuous at those
singularities. There are some papers on letting these be placed by
the artist, though (e.g. one on the butt, one on the crown of the
head, etc). I haven't got a prayer of a chance of having the time to
create UI for that. Plus, that is better implemented in the UV layout
tools anyway, and then this patch can take advantage of it without any
extra effort because they're just UVs at that point.
2 - Artist generated. This is the current patch; we use the
artist-generated UVs as they are, and attempt no fudging of borders,
gaps, or singularities in the UVs. We could try to force-smooth all
of the tangents, but there is the potential for cancellation at
borders and you end up with indeterminate tangents.
3 - Artist generated, hack smoothed. This is the same as option 2,
but you force smooth the UVs before calculating tangents. You can
pick a hueristic, like lower-numbered face IDs win when there are UV
discontinuities, and then allow the tangents to fall out of that.
However, you get odd swinging tangents through the single-polygon-wide
transitions, and it honestly looks weird.
I picked option 2 because it was easiest to implement, is the most
artist directable, and is also very predictable. The artists can lay
out the UVs how they like to control directionality of the tangents,
plus control where the seams go.
On Wed, Mar 21, 2012 at 11:54 PM, Michael Fox <mfoxdogg at gmail.com> wrote:
> Thank you so much for working on this, there is some issues though
> firstly, it should not be darker then regular gloss
> secondly, it dosn't respect UV discontinuities, granted this is how BI's
> tangents are made, but in modern rendering its not allowed, that's what
> mikktspace lib is for, to get help on how to use it, get a hold of sparky in
> #blendercoders he knows more about tangents then we will ever know :)
> Great work so far, keep it up :)
> Bf-cycles mailing list
> Bf-cycles at blender.org
More information about the Bf-cycles