Results 1 to 3 of 3
  1. #1

    Can OSL use amount of light as a factor?

    Normally, Cycles cannot use the amount of light hitting a surface as an input within a material (whereas Blender Internal can.) With OSL, is this possible? I'd like to mix between two different textures based on the amount of light hitting a surface.
    Non-Photorealistic Rendering and basic character tutorials:

  2. #2
    Member Secrop's Avatar
    Join Date
    Dec 2011
    The recurring question.....

    The whole purpose of Cycles is exactly this: find the amount of light hitting any point being sampled.
    I don't know if you get the irony in this... but that value will only be trully known after you render your scene with lots of samples.

    Materials (shaders) are just representations of how the surface treats light rays, and they don't know anything about those rays except, where they are comming from, and what type of ray they are. The light amount that a ray can carry it's only known much later, after the shader has already been called.
    So, no. You cannot use OSL to know that value.

    You can hardcode light positions and orientations into your shader (no need for OSL here), but it will be very complicated to get the correct amount of light that hits the object. And your shader will be useless on any other scene; this is the main point for Cycles' shaders, so that they produce an expected result no matter what are the lighting conditions of your scene (in other words, reusability).
    It's also possible to force the shader (with OSL) to throw rays in search for light sources, while the shader is being called... but this is not a good approach, and it's better to bake illumination instead.

  3. #3
    Just do it in compositing, where light level can be deduced from image rendered

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts