[Bf-cycles] UV Pass and Self Overlap

Dylan McDiarmid dylanmcd at gmail.com
Thu Jul 27 09:25:29 CEST 2017

I'm doing some work that involves mapping textures post-render, and I'm trying to figure out how to get anti-aliasing information out of the UV pass. >From the UV pass EXR, it looks like for edges that overlap the background, we get a nice B value that indicates opacity. So, to find the actual UV position we would do U = R / B, V = G / B, and then do an alpha blend with what we want as the background using the B value.

However, when an object overlaps itself, the B value stays at 1, and instead we get the actual alpha blend of the top R,G with the bottom R,G. So when we're doing our mapping, this puts the UV at a completely wrong place.

To properly represent the antialiasing at places that self-overlap, we need 5 values, bottom U, bottom V, top U, top V, top opacity. I don't know HDR formats very well, are these values already being captured somewhere in some kind of metadata field? If not, is there currently a way to do a separate pass to capture this information?

I've done a bit of poking around to the source, but I'm afraid I've been hindered by a lack of domain knowledge. It seems that the pass information is being read from

kernel_passes.h : kernel_write_data_passes -> geom_primitive.h : primitive_uv -> geom_attribute.h : find_attribute -> kernel_compat_cpu.h: kernel_tex_fetch -> KernelGlobals->__attributes_map.fetch(index)

but I'm having trouble figuring out where and when __attributes_map gets filled (and with what, and why :).

As a newcomer to graphics programming, it's a real pleasure to find such a great renderer that I can actual read the source to. So thanks to everyone involved.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20170727/b3a24ed2/attachment.htm 

More information about the Bf-cycles mailing list