colour codes

BeaBea Posts: 745
edited December 1969 in Daz Studio Discussion

Can anyone explain to me what colour coding is used in the duf files?

I can understand what the colour is when I select it in DS but when I save it and then go into the duf file to amend it I don't understand the colour coding as it doesn't use the same table

For example what colour is
0.945098, 1, 0.9803922

Comments

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Bea said:
    For example what colour is
    0.945098, 1, 0.9803922

    241, 255, 250

    Multiply the decimal value by 255, it will get you close enough for government work...

  • BeaBea Posts: 745
    edited December 1969

    Thanks, so to create those colours I just divide the 241 255 250 by 255?

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Bea said:
    Thanks, so to create those colours I just divide the 241 255 250 by 255?

    That's about the size of it.

    0 = 0,0,0 = Black
    1 = 1,1,1 = White

    0.00001 through 0.99999 (for all practical purposes 3 decimal places is enough, but the computer can/does accept more) is everything else.

  • BeaBea Posts: 745
    edited December 1969

    I just wondered why we would use such a system in the .duf files. Is there a table of whatever they are anywhere and what are they :) ?

  • macleanmaclean Posts: 2,438
    edited April 2015

    Bea said:
    I just wondered why we would use such a system in the .duf files. Is there a table of whatever they are anywhere and what are they :) ?

    I noticed that in DS 4.8 after applying an Uber shader, the color values change to this system - as opposed to the usual RGB values. So maybe it has something to do with that*.

    Why anyone would want to use that system is beyond me, since it's not exactly intuitive. Almost every program - Photoshop, etc - uses the standard RGB system. I hope DS isn't going to change.

    * Note - I've never used Uber anything before 4.8, so this may be old news to most people.

    mac

    Post edited by maclean on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Most of the 3Delight shaders use it internally...Luxrender uses it, internally...probably most renderers use it...internally.

    It gives an infinite range between black and white...which is useful for calculating the color value, but not so much for display or interacting with humans, who are used to there being 256 values in that range.

  • Richard HaseltineRichard Haseltine Posts: 97,254
    edited December 1969

    It may also allow for future expansions to use 16 bit values (no, that isn't a hint - just the idea that perhaps they wanted to keep their options open).

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    It may also allow for future expansions to use 16 bit values (no, that isn't a hint - just the idea that perhaps they wanted to keep their options open).

    Which is why a native Studio color picker is needed...I don't want to do the manual color settings as decimals.

  • BejaymacBejaymac Posts: 1,851
    edited December 1969

    The 0 to 255 RGB is the system we use for most of our displays, but for internal calculations it can be a bit restricting with it's 16.7 million possible colors, the 0.000000 to 1.000000 range works better for that as it has several billion possible colors.

    If we ever go 16 bit color then that's when the "fun" begins as it will have a possible 281,462,092,005,375 colors.

  • DestinysGardenDestinysGarden Posts: 2,550
    edited April 2015

    If you click on the bar with the color value, it will open the "usual" color picker, and you can input your 0 - 255 numbers in the approriate place. It will convert it to the decimal that you see in the surfaces tab when you click OK.
    Edit: which I completely understand is not the most user friendly system, and is useless if one is trying to hand edit DUF files. I'm just passing on information I discovered in the course of my work.

    Second Edit: note to Mac, no, it is new in 4.8. 4.7 displays Uber shader's values in the 0-255 range.

    Post edited by DestinysGarden on
  • martinez.zora77@gmail.com[email protected] Posts: 1,346
    edited December 1969

    mjc1016 said:
    It may also allow for future expansions to use 16 bit values (no, that isn't a hint - just the idea that perhaps they wanted to keep their options open).

    Which is why a native Studio color picker is needed...I don't want to do the manual color settings as decimals.

    When I ask about it, the answer given (to other people and posted by him in the forum) was no, no.

    Even doing setting by surface tab is a pain because you need set 3 numbers.

    Decimal version is RGB/255, but you need to know where it must be replaced in the duf preset file.

  • martinez.zora77@gmail.com[email protected] Posts: 1,346
    edited December 1969

    In duf file there are two "list" of color values declaration.

    First is by default color, values declarated when shader was created. These are under "material_library" line.

    "material_library" : [
    {
    "id" : "InnerSphere",
    "extra" : [
    {
    "type" : "studio/material/daz_shader",
    "definition" : "support/ShaderBuilder/Surface/a0000toonshad6Def.dsa"
    },
    {
    "type" : "studio_material_channels",
    "channels" : [
    {
    "channel" : {
    "id" : "colBasA",
    "type" : "color",
    "name" : "colBasA",
    "label" : "Color Base A",
    "value" : [ 0.9921569, 0.8784314, 0.8352941 ],

    "min" : 0,
    "max" : 1,
    "clamped" : true
    },
    "group" : "/Color Base"
    },


    Second are values that actually you see when preset is aplied. It begin with line "scene" .This is the value that must be change:

    "scene" : {
    "materials" : [
    {
    "url" : "#InnerSphere",
    "extra" : [
    {
    "type" : "studio/material/daz_shader"
    }
    ]
    }
    ],
    "animations" : [
    {
    "url" : "name://@selection#materials:?extra/studio_material_channels/channels/colBasA/value",
    "keys" : [ [ 0, [ 1, 1, 0 ] ] ]
    },
    {
    "url" : "name://@selection#materials:?extra/studio_material_channels/channels/colBasB/value",
    "keys" : [ [ 0, [ 1, 0.5019608, 0.2509804 ] ] ]
    },

    I change colBasA parameter [1,1,0] (yellow) to [ 0.3, 0.5, 0.8 ] (light blue)

    "url" : "name://@selection#materials:?extra/studio_material_channels/channels/colBasA/value",
    "keys" : [ [ 0, [ 0.3, 0.5, 0.8 ] ] ]

    First image is original preset, second is changed preset.

    For obtain decimal values from RGB values use excel and cpy/paste.

    excel.png
    912 x 211 - 19K
    blue_pick.png
    256 x 256 - 75K
    yellow_pick.png
    256 x 256 - 72K
  • BeaBea Posts: 745
    edited December 1969

    I hav to confess that I like to work with a text editor when I am amending .duf files - especially as you have to tody them up anyway and I am flummoxed by this change in procedure for colour coding

  • macleanmaclean Posts: 2,438
    edited April 2015

    I didn't realise this thread was still going.

    Question.

    What's the system used by Poser? Here's a snippet from a Poser MAT file. (Diffuse Color RGB 200/100/0)

     material image
      {
      KdColor 0.784314 0.392157 0 1 
      KaColor 0 0 0 1 
      KsColor 0 0 0 1 

    I ask because Poser color values have baffled me for years. I thought it might be the same system, so I did a test, but it's not. Does anyone know if Poser values have any relation to an existing system, or is it just some weird thing they invented?

    mac

    Post edited by maclean on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    maclean said:
    I didn't realise this thread was still going.

    Question.

    What's the system used by Poser? Here's a snippet from a Poser MAT file. (Diffuse Color RGB 200/100/0)

     material image
      {
      KdColor 0.784314 0.392157 0 1 
      KaColor 0 0 0 1 
      KsColor 0 0 0 1 

    I ask because Poser color values have baffled me for years. I thought it might be the same system, so I did a test, but it's not. Does anyone know if Poser values have any relation to an existing system, or is it just some weird thing they invented?

    mac

    It looks like it's RGBa. The last digit is the Alpha channel.

    http://en.wikipedia.org/wiki/RGBA_color_space

    0.784314 = 200 (or close enough to not matter)
    0.392157 = 100
    0 = 0
    and the alpha set to fully opaque

  • prixatprixat Posts: 1,585
    edited April 2015

    :-) Its just a standard maths. operation, called normalisation. Changing any set of numbers to a common scale i.e. between 0 and 1.

    Whatever scale the interface offers, for example 50% or 127 or #7f, after normalisation the renderer gets the same value (in this case, 0.5) from each input.

    When a renderer applies gamma correction it takes luminance values and normalises them.
    Then the normalised value is raised to the power gamma.

    Post edited by prixat on
  • Canary3dCanary3d Posts: 2,005

    Sorry to revive an old thread but I found this while wrestling with this problem myself, and to make it a little easier to copy paste values around between duf files, I made a palette prop to use for saving multiple colors to a Material preset where I can then snip the decimal settings and copy them into my "real" material presets.  Maybe someone else will find it useful so I set it up as a freebie: https://www.daz3d.com/forums/discussion/237261/canary-s-color-palette-color-values-conversion-helper

  • BeaBea Posts: 745

    Thanks :)

Sign In or Register to comment.