Announcement

Collapse
No announcement yet.

SDK: eval() shadowedLightColor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDK: eval() shadowedLightColor

    Hi,

    I have a problem with the (shadowed)lightColor.. I turned off the "Cast Shadows" option in the Object-Propertys for my Object and assigned my shader to it.

    I just want a completly flat shading only containing drop-shadows of the other objects... basicaly it's working, but at the side of my objects, that's not facing towards the light - it's black..

    It is because the normal of the Fragment is not facing towards the light, so the lightColor for this fragment becomes black.. I tried to change the diffuseNormal that's returned in getDiffuseNormal() - that's working.. but only for 1 Light.. as soon as there are more lights, it's not working anymore :/

    Is there any way to get this to work?

    Aya~

  • #2
    Yes, but this is a bit tricky.

    You can do this by making your shader double-sided (e.g. return a valid BRDF for both sides when BSDFSampler::getBRDF() is called). The side facing the viewer should have some transparency, the other side should have zero transparency. In that situation, your BRDF will be evaluated for both sides of the surface, giving you the result that you need (similar to the VRay2SidedMtl material).

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Originally posted by vlado View Post
      You can do this by making your shader double-sided (e.g. return a valid BRDF for both sides when BSDFSampler::getBRDF() is called). The side facing the viewer should have some transparency, the other side should have zero transparency. In that situation, your BRDF will be evaluated for both sides of the surface, giving you the result that you need (similar to the VRay2SidedMtl material).
      Mhh.. are you sure this would work?
      Because I'd need to make the one side transparent if it is facing the light .. not the viewer.

      Look at this Image:


      The light comes from the upper left corner. In the Eval()-function I just return "someGreenColor * shadowedLightColor" and get this result (The half-torus has "Cast Shadows" turned off).

      If I flip the returned normal in the getDiffuseNormal() function, I get this image:


      What I want is a constant green object.. BUT, it should still receive drop-shadows of other objects..

      So, what I would need is to tweak the returned normal in getDiffuseNormal() for each light..


      I don't see how to do this with a doubleSided material.. because even if I always return a valid BRDF Shader in the getBRDF() function, rc.rayresult.realBack is always false (sure, because if I look trough the camera there are no backfacing polygons).

      Or did I missunderstand something?

      Aya~

      Comment


      • #4
        I guess it would be best if I made an example of this...

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          Originally posted by vlado View Post
          I guess it would be best if I made an example of this..
          This would be great, yes!

          Thanks a lot~

          Comment


          • #6
            Hey,

            still didn't got it to work
            How long do you need for the example?

            Best regards.
            Aya

            Comment

            Working...
            X