Thank you for the reply!
Off course, context could prove helpful, although I felt it was a bit much, so I focused on a specific test-case before.
I'll outline the target effect:
I would like to achieve a pixelised dithered lighting effect.
The following features would be needed to have the full effect:I will elaborate my thinking process for each step
1 overlay a dithered mask sampled from a dither gradient texture, based upon the light attenuation
2 scale the dither 'pixels' to match the albedo 'pixels' (
Not a relevant step for this post)
3 mixing in the dither mask with the albedo to create the final color (
The relevant step for this post)
4 have the light falloff be discrete, so that the dither mask would match the albedo 'pixels' (
Not a relevant step for this post)
See attached project for my current progress.
I used Unity version 2018.1.0f2
1 Overlay a dithered mask sampled from a dither gradient texture, based upon the light attenuation(solved, see example project)
. If there are other methods to get this done without the attenuation node, that would also be worth considering. The amount of light present on the surface could be calculated, but then i see no way to include shadows. So this option seems kind of a work around if the attenuation node exists specifically for this purpose.
2 Scale the dither 'pixels' to match the albedo 'pixels' (i forsee no real difficulties here. Figuring out how to match the scale based on the albedo pixel size does not seem problematic)
3 Mixing in the dither mask with the albedo to create the final color where:. the black in the mask would darken the albedo, based upon the attenuation value. (higher attenuation = less effect)
. the albedo itself would get darker the further we are from the light. (not sure about how this would look, but I would like to see the effect)
. ambient light could be included, that way, the dark areas are not completely black.
while working on this, I found that my lack of knowledge on the custom lighting feature prevents me from finishing this feature.
Figuring this out is the reason of this post.
4 Have the light falloff be discrete, so that the dither mask would match the albedo 'pixels'Irrelevant for this post, but I thought I'd mention it for completeness. if we naively sample on the attenuation value, we get circular artifacts, where the output mask covers only part of a albedo 'pixelsized' area.
These artifacts are noticeable in the example.
. ideally either the whole 'pixel' should be masked or be clear.
(I see no way of accomplishing this, since naturally attenuation differs per fragment)
If this feature is not feasible, I'd be just as happy not to include it.
I imagine fixing this would be a whole study on it's own. I would like to take it one step at a time, and focus on step 3.
With this context in mind, I here are my current questions:- As stated: my current goal is finding a way to output the correct color value based on the specifications noted in step 3. While exploring different outputs, I felt that, as long as I did not understand the test-case posted before,
there was no use in chasing a solution any further.
- Based on my experimentation, and your previous answer, it would seem that I lack knowledge
of what happens with the color value when outputed through the Custom Lighting node.
(a) Where can I find more documentation on how this pipeline is handled?
The most specific documentation I found regarding this matter is located here:
http://wiki.amplify.pt/index.php?title= ... ting_Model(b) How should the Albedo slot be appreached when used in a Custom Lighting context
(c) How should the Emission slot be appreached when used in a Custom Lighting context
(d) How do I handle multiple lights correctly? I see the output gets computed differently based on the amount of lights that influence the face. (none, one, multiple)
(e) In first post, I replicated color output that seemed inconsistent with the sampled texture position. If I understood why this happened, I feel I would have a better understanding of the Custom Lighting feature.
I realize these are a lot of questions. That is why I stated a more directed question first.
I hope more context sheds some light (no pun intended) on my current understanding of the problems I'm trying to solve.
The most important aspect for me is that I get a more thorough understanding of the Custom Lighting workflow,
but I failed to find more relevant documentation on this point.
Thank you for your time.