A fundamental question regarding ambient colour

picsoleropicsolero Posts: 0
edited December 1969 in Daz Studio Discussion

I came across an effect challenging my understanding of ambient colour. In my understanding of the Phong Reflection Model (see: http://en.wikipedia.org/wiki/Phong_reflection_model ) ambient colour is the colour of those parts of an object which are not exposed to light. And ambient colour blends smoothly into diffuse colour with decreasing light intensity.

In order to illustrate my issue let's have a look at a simple scene which contains just a default camera, a plane, a cylinder and a single distant light illuminating the cylinder from the right side of the camera. See attached picture Ambient-all_default.png. In the next step I applied ambient colours to the plane (RGB= 255 0 0) and the cylinder (RGB= 0 0 255) leaving diffuse at its default plain white. This renders to Ambient-d-white-a-colours.png.

So far the resulting renders are fully consistent with my understanding. But the trouble comes when I alter the diffuse colours for instance to (RGB= 0 255 0) for the plane and (RGB=255 0 0) for the cylinder. In preview mode the cylinder is still looking as expected. It shows a smooth gradient from diffuse colour where it is exposed to the light to ambient colour in the shadow. See Ambient-d-colours-a-colours-cyl-screen.jpg

However when I render this the shadows turn black. See Ambient-d-colours-a-colours.jpg

Can anybody please explain to me whether my understanding is wrong or if this is a bug. Most of all, why is preview, which is consistent with my understanding, different from the render output, which seems to be wrong as far as I understand the Wikipedia article referenced above. Did I get it wrong?


  • AscaniaAscania Posts: 345
    edited December 1969

    To get that effect you need to activate indirect illumination. Look into the UberEnvironment shader

  • KhoryKhory Posts: 3,847
    edited December 1969

    In studio there are two kinds of ambient. One is surface and the other is light. Ambient light in the real world is the all the light that is reflected back up from surfaces. The surface setting ambient can in theory be used to mimic that light as a setting on the surfaces rather than adding lighting that is ambient. Sort of a "cheat" to save adding real lighting. If ambient is set very high and light then surfaces seem to glow and it can be tricky getting all the surfaces to have the right level of ambient so that the scene to look like it is coherently lit.

    In your second image the shadow is red because the ambient is high enough to glow in the shadow. The same is not true in the green version. The red is able to "overwhelm" the shadow because it is noticeably lighter than the green. For the same effect you would need a light enough green that it could be "seen" through the shadow.

    If your trying to add ambient light there are other ways you can do it. The very old school way would be loads of lights from a wide variety of angles that would mimic the light bouncing off of all the surfaces around the scene. Another option is using the uber lights included with studio. If you don't want to deal with added render times there is even an ambient setting that does not do occlusion etc.

  • picsoleropicsolero Posts: 0
    edited November 2012

    @Ascania: Adding an Uber Environment Light and activating the Indirect Lighting option doesn't change the results- or did I misunderstand you?

    @Khory: I know about the many-lights approach like the good old Light Dome Pro and also about the Uber Lights - that is not my issue. And i also know about the Base Light Brick in Shader Mixer to set kinda global ambient light colour..

    Regarding your explanation i can say the ambient strength was all the same for each picture. I only changed the colours. You may have noticed that I didn't use any mixed colours but only "clean" red, blue and green respectively. So in terms of brightness they should be even.
    Most of all I do not understand how the different results in OpenGL preview and final render can be explained by your argument. But most likely this is my fault.

    It rather appears to me that Open GL preview handles the three colour channels in an additive way, correctly, just as the theory requires. Whereas the render engine appears to "multiply" the channels - so we get the blue shadow on the cylinder only if its diffuse includes a blue component - as in white. This can be checked by using (RGB= 255 0 127) in the diffuse channel. The blue shadow returns.

    I still wonder if this is a bug or a feature.

    Post edited by picsolero on
  • KhoryKhory Posts: 3,847
    edited December 1969

    The open GL render will not include the ambient I don't think. Could be wrong.

    I am guessing that by unmixed colors you mean no tinting or shading (adding white or black) to a base color since green is by nature a mixed color. Computer color is by nature additive rather than subtractive because the colors are generated through light rather than selected by adding pigments that reflect less light or the light differently (as in paint mixing). While your green is the green given by lists as a base green it is actually a bit more random than that. That green is a shade of green rather than the base middle green created by mixing the two true primary colors. If your going to do a true test you need colors that are not shaded or tinted and best bet is to use the true primary, or in the case of red and green secondary colors created by mixing the primaries.

    96 x 96 - 4K
  • picsoleropicsolero Posts: 0
    edited December 1969

    Sorry for not being precise enough in what I have meant with the term "clean" colours.

    The colours I used in this little setup to demonstrate my issue were:
    red : RGB=(255 0 0)
    green: RGB=(0 255 0)
    blue: RGB=(0 0 255)

    Please have a look at the studio screenshot in my initial posting for an example.

    Your statement regarding basic and mixed colours is correct within the framework of the so called CMYK colour model which is commonly used in printing. In this model cyan, magenta and yellow are "basic", hence the name. The K comes from blacK, which is used in printers as a fourth ink type. In this model red, green and blue are indeed mixed colours.

    However DAZ Studio like most other CG applications is based on the so called RGB colour model. In this model it is just the other way round. Here red, green and blue are considered basic. And so cyan, magenta and blue are the mixed colours.

    Let's hope that I don't annoy you with my replies. I appreciate your readiness to help. Any thoughts that might help are most welcome.

    440 x 352 - 10K
  • KhoryKhory Posts: 3,847
    edited December 1969

    If you look at your render though the color rendered is 0,87,0. It should also be expected that it would be lighter and more faded color wise since that is how ambient behaves.

  • ReDaveReDave Posts: 815
    edited December 1969

    To answer the original question it is working as DAZ intends it. It is true in most programs ambient just adds itself to diffuse, but in DS it multiplies ambient and diffuse channel by channel. If it's a problem you can use e.g. Shader Mixer in which you'd zero ambient on the DAZ Material brick, add a Value brick and a Math->Binary, set to Add. Plug the output of the DAZ Material brick into the Binary brick and the Value as second operand, then connect the result to the Surface brick. Make sure you're adding colours, BTW, not floats.

  • picsoleropicsolero Posts: 0
    edited December 1969

    Many thanks, ReDave!

    I think that resolves my issue!

Sign In or Register to comment.