(solved) hope to know formula of Diffuse color, Diffuse strength, and Ambient Color

kitakoredazkitakoredaz Posts: 3,526
edited December 2013 in Daz Studio Discussion

I believed I can understand each property of daz default(surface) shader
but when I test them with combination, now I feel throw in fogs ^^;
it should be foolish question, but I really hope to know then understand these basic clear,,

A When I set diffuse strength to zero 0% , I believe about the surface, diffuse color make no effect.
there seems no meaning how I change diffuse color. (diffuse strength multiple the value of diffuse color R,G,B, value.
so that 0,0,0= black. I believed so.

B to check Ambient color, I set Ambient Color as weak blue eg (212 255 253),
then I set Diffuse Strength 0 %. diffuse clolor black (0 0 0)

then lender the image.pic1

it almost black, Ambient color seems not work at all.

C I believed there will be no difference if I change only diffuse color to white (225 225 225)
as I keep diffuse strength zero %

but,, actually the surface color change to blue,,,

then I want to know clear fomula.. about these value.

(when I apply my expection, then miss edit ^^;)

=============
after testing them,, my expection is,,

(Diffuse color multiple DIffuse strength) + (Diffuse color Grey scale mutlple Ambient colormultiple Ambient Strength ) =RGB of surface,,


is it right?

Post edited by kitakoredaz on

Comments

  • Takeo.KenseiTakeo.Kensei Posts: 1,303
    edited December 1969

    If I'm not mistaken it should be something like (simplified)

    Color = Ambient Color * ( Ambient strength + Diffuse color * Diffuse Strength ) + Specular color * Specular Strength

  • kitakoredazkitakoredaz Posts: 3,526
    edited December 2013

    mm,,,,,I check more Again ^^; thaks Takeo,,

    I think it may be valiable which shader we use,,
    so that now, I simply talk about DAZ default shader ^^;

    then,, before I test them,, I thought
    (DIffuse color * Diffuse strength) +( Ambient color*Ambient strength) + (specular color*specular strength ) ^^;

    but when I check with daz shader ,, my old expection is pefectly differeent, so now I wan to know true formula ^^;

    Post edited by kitakoredaz on
  • Takeo.KenseiTakeo.Kensei Posts: 1,303
    edited December 2013

    The formula is for the Default DS shader as you asked

    [Edit] :I thought like you before Richard Haseltine gave me an other information that I checked then

    http://www.daz3d.com/forums/discussion/26277/#389287

    Post edited by Takeo.Kensei on
  • kitakoredazkitakoredaz Posts: 3,526
    edited December 1969

    Ah,, when I read the topic,,I could not understand where is problem ^^;
    Now I need to read again it ,,, thanks

  • Richard HaseltineRichard Haseltine Posts: 102,252
    edited December 1969

    If I'm not mistaken it should be something like (simplified)

    Color = Ambient Color * ( Ambient strength + Diffuse color * Diffuse Strength ) + Specular color * Specular Strength

    I think you have diffuse and ambient switched - your formula would give black with a black ambient colour, regardless of diffuse colour.

  • kitakoredazkitakoredaz Posts: 3,526
    edited December 2013

    wuu,,, anyway please tell me the correct formula as final answer,, ^^;
    I simply hope to memorize it, and check them untill I can understand why it work,,

    then my formula was actually wrong because I have not understand, how RGB*RGB
    so that I think I need to change grey scale ^^;

    I sometimes felt strange,, ,many guys often say (R1,G1,B1)*(R2,G2,B2)

    when think about matrix multiple, I could not believe it ,,now I understand
    (R1*R2/255 G1*G2/255 B1*B2/255) Ok,, %-P

    then,,
    (Diffuse color * DIffuse strength) + (Diffuse color * Ambient color * Ambient Strength )
    +(Specular color * Specular strength) =(surface RGB)?

    ==============================

    and,, next question is,, when I add diffuse texture (or diffuse map, texture map) with diffuse color(R G B)
    how count diffuse color about each pixel?

    one pixel diffuse texture (R1 G1 B1) , and I set diffuse color (R2, G2,B2)
    add or multiple ??

    I read again and again daz new userguide about surface, shader,to study basic again,,
    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/userguide/chapters/textures_surfaces_and_materials/start
    (it was actually good documents than I imagine ^^;) but, hope to clear discribe more detail,
    about these things.

    without understand how formula each value of shader, I need to tweak each parameter and render at random
    to get the effect without any forecast .

    Post edited by kitakoredaz on
  • Takeo.KenseiTakeo.Kensei Posts: 1,303
    edited December 2013

    If I'm not mistaken it should be something like (simplified)

    Color = Ambient Color * ( Ambient strength + Diffuse color * Diffuse Strength ) + Specular color * Specular Strength

    I think you have diffuse and ambient switched - your formula would give black with a black ambient colour, regardless of diffuse colour.

    Right I got it inverted

    So it should be

    Color = Diffuse color * ( Ambient color * Ambient strength + Diffuse Strength ) + Specular color * Specular Strength

    For each color and strenght you multiply the map pixel color/value with the strenght/color multiplier

    ex : Ambient color = Ambient Color Map * Ambient Color multiplier
    Ambient Strength = Ambient strength Map Value * Ambient strength multiplier

    Post edited by Takeo.Kensei on
  • kitakoredazkitakoredaz Posts: 3,526
    edited December 1969

    thank you Takeo, and Richard,, (I forget to say Richard sorry ,, ) ^^

    I believe your formula is same meaning which I wrote above.

    As for me,, it seems difficult to imagine
    add Strength scalar value (eg 20% or 0.2 )etc with (R,G,B) value.
    I do not know, how formula RGB about such case,, , so that,
    not gather them in () as usuall formula.

  • JonnyRayJonnyRay Posts: 1,744
    edited December 2013

    The color calculation is actually a bit more complicated than this. The function for the standard "glossy plastic" shader would look something like this...

    Ci = ( (Dcolor * Dtexture) * ( ( Astrength * (Acolor * Atexture) ) + Diffuse(N, (1,1,1), Dstrength) ) ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    To work it from the inside parts out...

    Acolor1 = (Acolor * Atexture) - multiply the Ambient color setting by the Ambient texture map (if any)

    Ci = ( (Dcolor * Dtexture) * ( ( Astrength * Acolor1 ) + Diffuse(N, (1,1,1), Dstrength) ) ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    Acontrib = (Astrength * Acolor1) - multiply the Ambient strength by the Ambient color to the get the contribution that the Ambient channel is providing

    Ci = ( (Dcolor * Dtexture) * ( Acontrib + Diffuse(N, (1,1,1), Dstrength) ) ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    Dwhite = Diffuse(N, (1,1,1), Dstrength) - Call the built-in Diffuse function to calculate a diffuse value at the current location based on a pure white lite and
    the provided Diffuse Strength value. This gets used to "wash out" the ambient setting (see the next step). If there is no ambient setting, this will
    also provide the shader with what is needed to calculate the strength of the Diffuse component in the surface later in the function.

    Ci = ( (Dcolor * Dtexture) * ( Acontrib + Dwhite ) ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    DAcontrib = Acontrib + Dwhite - This basically "washes out" the ambient contribution by calculating a Diffuse lighting contribution based on the
    strength value and a pure white light. This is why when you have anything above a zero in the Diffuse Strength setting, the ambient component seems to
    be lessened.

    Ci = ( (Dcolor * Dtexture) * ( DAcontrib ) ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    Dcolor1 = Dcolor * Dtexture - multiple the value in Diffuse Color times the Diffuse Texture Map (if any exists)

    Ci = ( Dcolor1 * DAcontrib ) + Specular(N, -I, Scolor, Sstrength, Sroughness)

    Dcontrib = Dcolor1 * DAcontrib - multiply the resulting Diffuse color by the washed out ambient contribution. Note that the way that DAcontrib was
    calculated is how the Diffuse Strength is calculated into this function; so without an ambient setting DAcontrib is going to be equal to the Diffuse
    Strength setting.

    Ci = Dcontrib + Specular(N, -I, Scolor, Sstrength, Sroughness)

    Scontrib = Specular(N, -I, Scolor, Sstrength, Sroughness) - call the built-in function to calculate the Specular contribution based on the color, strength,
    and glossiness settings. Academic note, "roughness" is actually 1 - glossiness.

    Ci = Dcontrib + Scontrib

    So that's how it works. :) I hope my math wasn't too hard to follow.

    Post edited by Chohole on
Sign In or Register to comment.