Modding Help Changing the glow effect

Discussion in 'Starbound Modding' started by greenRAM, Dec 31, 2014.

  1. greenRAM

    greenRAM Giant Laser Beams

    The original glow effect for the corefragment seems to be controlled by: "radiantLight" : [0.45, 0.17, 0]

    What do these parameters control? Probably there's a good explination for this somewhere that I've missed. I'll try playing around with it a bit until I get a reply.

    edit: It's [RED, GREEN, BLUE], the three primary colors. Mystery solved!
    edit edit: Difficult to get the colors I'm expecting as they all glow too brightly.
     
    Last edited: Dec 31, 2014
  2. AstralGhost

    AstralGhost Pangalactic Porcupine

    Best Answer
    As you already found out, it's Red Green Blue, or in other words: RGB. This is pretty standard for computers/software these days. (Technically, Green is not a primary color. That would be yellow.)

    They are in decimal format (from 0 to 1), so you can basically think of them like intensity levels of each color. These colors will combine naturally into white, which is coded as (1, 1, 1).
    Likewise, black could be created from (0,0,0), though obviously black isn't a light source and is instead the absence of light... So, this wouldn't do anything.
    The trick to understanding this is simply to understand how different colors of light function and combine. It's the same process as combining regular colors, like paints, except that they get brighter instead of darker when you combine them since you're adding more light.
    I'm not sure if this helps you get the colors you desire. So if that doesn't help you find what you want I have another suggestion.

    Find the color you want on any RGB color-wheel in any image-editing program. You should see values from 0 to 255 next to an "R" a "G" and a "B", indicating Red Greeen and Blue.
    Once you find the color you want, divide the values by 256. (There are 256 numbers possible. 0 through 255)

    For example, on a color wheel white is 255, 255, 255. Dividing these by 256 (well... actually 255 this time) results in (1, 1, 1) which is white light.
    As another example, (128,0,128) creates a purple color in RGB values. Dividing by 256 leaves you with: (0.5, 0, 0.5) which should be the same purple color of light since it divides out evenly.

    These values will never give you perfect colors because the way it is actually handled and rounding issues, but it should get you close enough.

    Here's a chart with lots of pretty colors and their 0-255 codes to get you started: http://www.rapidtables.com/web/color/RGB_Color.htm
     
    Last edited: Dec 31, 2014
    The | Suit and greenRAM like this.
  3. SleepySquidd

    SleepySquidd Tragically Magic Hands

    Sounds like my motto: "Break it until you find out how it works"
     
    greenRAM likes this.
  4. AstralGhost

    AstralGhost Pangalactic Porcupine

    Best Answer
    As you already found out, it's Red Green Blue, or in other words: RGB. This is pretty standard for computers/software these days. (Technically, Green is not a primary color. That would be yellow.)

    They are in decimal format (from 0 to 1), so you can basically think of them like intensity levels of each color. These colors will combine naturally into white, which is coded as (1, 1, 1).
    Likewise, black could be created from (0,0,0), though obviously black isn't a light source and is instead the absence of light... So, this wouldn't do anything.
    The trick to understanding this is simply to understand how different colors of light function and combine. It's the same process as combining regular colors, like paints, except that they get brighter instead of darker when you combine them since you're adding more light.
    I'm not sure if this helps you get the colors you desire. So if that doesn't help you find what you want I have another suggestion.

    Find the color you want on any RGB color-wheel in any image-editing program. You should see values from 0 to 255 next to an "R" a "G" and a "B", indicating Red Greeen and Blue.
    Once you find the color you want, divide the values by 256. (There are 256 numbers possible. 0 through 255)

    For example, on a color wheel white is 255, 255, 255. Dividing these by 256 (well... actually 255 this time) results in (1, 1, 1) which is white light.
    As another example, (128,0,128) creates a purple color in RGB values. Dividing by 256 leaves you with: (0.5, 0, 0.5) which should be the same purple color of light since it divides out evenly.

    These values will never give you perfect colors because the way it is actually handled and rounding issues, but it should get you close enough.

    Here's a chart with lots of pretty colors and their 0-255 codes to get you started: http://www.rapidtables.com/web/color/RGB_Color.htm
     
    Last edited: Dec 31, 2014
    The | Suit and greenRAM like this.
  5. greenRAM

    greenRAM Giant Laser Beams

    Made the mod I was attempting: http://community.playstarbound.com/index.php?resources/glowing-ore.2423/

    Some of the issues that have come up so far:
    -The glow effect has to have a zero as one of its three values. If all three values are over zero then it changes to white light.
    -The system seems very picky about the decimal versions of the color after dividing by 256. I left them all as their original numbers and it seems to be working. I'd like to figure out what the rules of what's acceptable with these decimals. Also, it would be nice to figure out if there is a noticeable difference between having the original number rather than the decimal versions.

    So far I haven't found a way to change the brightness and other effects of the glow effect without altering the game's overall lighting settings. I'll do a little digging to see if changing the brightness and the effect the glow has on the environment individually is even possible, or if it's worth any possible negative effects like extra lag. Or, maybe this is as far as I can take this one.

    Thanks for all the help so far. It's great to be a part of such an active community.
     
  6. TeamFluff

    TeamFluff Void-Bound Voyager

    Those values seem awfully bright. It's the same thing I did the first time until I normalized the values down to approximately the same brightness as the core fragments. Here's the values I'm using for glowing ore:
    aegisalt: [0.31,0.32,0.17]
    coal: [0.24,0.26,0.33]
    copper: [0.40,0.23,0.14]
    diamond: [0.21,0.31,0.31]
    gold: [0.37,0.3,0.08]
    iron: [0.27,0.29,0.27]
    platinum: [0.28,0.28,0.27]
    plutonium: [0.36,0.02,0.32]
    rubium: [0.46,0,0.13]
    silver: [0.27,0.27,0.29]
    solarium: [0.41,0.25,0]
    titanium: [0.29,0.25,0.3]
    uranium: [0.02,0.48,0.02]
    violium: [0.28,0.11,0.38]

    This works with the standard lighting settings. I can describe how I arrived at this values in more detail if you'd like.
     
  7. lillgrinn

    lillgrinn Phantasmal Quasar

    Yes, describe this, please. RGB model is triplet of Red Green Blue integer numbers.
    If I use a value greater than 1, it is too bright.
    How to choose the right value less than 1?
     
  8. TeamFluff

    TeamFluff Void-Bound Voyager

    Mapping directly from RGB, all you have to do with divide each integer component by 256 (like AstralGhost described).

    To get these values in particular, I had to do a bit more math. First, I found a color in each png for the glow color. Then I converted that color to decimal by dividing by 256. This color was still too bright, so I reduced the magnitude of the color to something more reasonable. I liked the brightness of the core fragments, so I used that as my target.

    This image describes the general math I did to reduce the magnitude. The core subscripts are for the core fragments, the initial subscripts are for the initial RGB components in the glow color, and the final subscripts are for the final RGB components at the end.
    [​IMG]
     
  9. lillgrinn

    lillgrinn Phantasmal Quasar

    Thank you so much. It is useful to me for the future.
     
  10. The | Suit

    The | Suit Agent S. Forum Moderator

    I don't understand why you needed to calculate the ginitals of the ores.
    I get people glow when their ginitial value is higher - but... this is a perversion of math!
     
  11. TeamFluff

    TeamFluff Void-Bound Voyager

    I did not consider that you probably don't have to convert to decimal first to do this. I did because I wanted to see the result, which was that it was way too bright. It should work just fine without it; I felt more comfortable working with a bunch of numbers that were of the same magnitude.
     
  12. AstralGhost

    AstralGhost Pangalactic Porcupine

    Just an FYI:
    If your colors are too bright, follow my earlier directions (divide by 256) and then just divide the numbers some more by another value to decrease brightness. You'll pretty much maintain mostly the same color, but you'll decrease brightness. This is just a little quirk in how lighting renders in games.

    For example, white (1, 1, 1) light is pretty bright.
    Well, if you divide this by 2 you're half-ing the brightness and still have white light (0.5, 0.5, 0.5).
    You could also divide by 3 (0.33, 0.33, 0.33) or 4 (0.25, 0.25, 0.25) to decrease the brightness even more. All of them will appear white (technically gray, but light doesn't render the 'blackness'!) but each division makes them more dim. Just find values that suit the brightness you want. No need to do any complex math. :)

    Another example is instead of bright blue (0, 0, 1) you could use something like (0, 0, 0.25) which is also blue but 4 times dimmer.

    Likewise, you could just find dark values in a regular color wheel and divide those by 256, instead.

    The reason it works like this is because the game's rendering engine is basically telling the graphics card to render a certain color at a certain opacity level over the pixels displayed in its radius. So the darker a color is the less color (and therefore more opacity of that color) that is being rendered on any specific pixel location.... Eh, if that makes any sense. :)
     
    greenRAM likes this.
  13. hakari

    hakari Subatomic Cosmonaut

    Technically there is no such thing as primary colors. But the closest to such a concept would be RGB, corresponding to the cone receptors in our eyes. There is no yellow receptor.
     
  14. The | Suit

    The | Suit Agent S. Forum Moderator

    Actually there is - you just are not aware of the definition.
    A primary color is a color which cannot be obtained by mixing other colors.

    The receptors of the eye are neither here nor there in concerns of primary color, as it deals with wavelengths and not mixing color pigments.
     

Share This Page