How do color codes work for Lights and Cubemitters?

Hi
Im new to modding and whilst I have figured out all the basics i have been trying to make a small mod with a variety of colored lights,
unfortunately i’m not sure how the colour values work and any explaination would be appreciated.

i have made one light through trial and error trying random numbers but it would be alot easier if i knew what the game was actually doing to get that colour.

thanks :smiley:

this is the one ive done so far :

1 Like

I’m not sure if SH uses this method but i think it’s the classic computer color code

The color code such as 0000ff# are representitive of RGB code
the first two numbers determine the strength or R (red) the third and forth are G (green) and the last are B (blue)
So 0000ff# would be a blue-screen like blue
ff0000# would be a strong red
And 00ff00# would be strong green

The scale goes in this order
0123456789abcdef
0 being the lightest and f being the strongest

One easy way to put the colors you want in is the copy the code from programs like Photoshot that let you view the color code while picking colors, just copy and paste it and it should be good to go

I’m not sure if SH uses the same method it’s been a while since i last took a look in it’s code
But @malley should be able to answer since i think he works on particle effects as well

1 Like

Yup, @Hyrule_Symbol is right! Its called HexColor and you can find tools online to help you color pick whatever color you like. First hex color picker I found with a google search (not affiliated with us at all ; )) - https://www.hexcolortool.com/ This one doesn’t look like it will let you use an eyedropper tool - at least I didn’t see one - but there are other tools that for sure will : ).

2 Likes

Sorry, that is off topic, but is it possible to set such an attribute as transparency? For example, in the properties of the brush when building a building, specify that the block will be transparent.

it makes sense but its not written like 0000ff#, how do i write it like [0.3,0.1,0.2,]

below is a picture of an example json for a reddish pink light

Screenshot from 2017-09-14 07-15-16

in the color section at the bottom you have values for the light color

how do i write a hexidecimal code in that format? its split by 2 or 3 commas depending if its an animated light or a cubemitter and its just confusing me.

I’m not too sure how it works in that place, but it should follow the same format, just only with numbers? So you can actually use two didget numbers like 15 instead of F

Am i correct @malley ? I’m not too sure about this myself, i haven’t touched it much

Ah sorry, Hyrule and I were confused on what you are trying to do. We use HexColors for our mesh colors, but we use RGB data for our lights and particles. To find RGBA colors you want, just need a color picker that gives you that value instead : ). The https://www.hexcolortool.com/ actually has the RGBA colors you want as well, just to the right of the hex color field (it says rgba ; P). The next one to the right is Hue/Saturation/Lightness/Alpha, but we don’t currently use that for anything (all three methods actually provide the same information, its just a different way of saying it).

I don’t think so? The transparency i believe is different, it’s a material not a color i believe, but i have no knowledge on how it works though

Why does intensity in your example have two settings, @malley?
Something I wanted to ask for a long time.
Also, what kind of interpolation is “random between curves”? Is this somehow related to Bezier curves?

I’m sorry, I stupidly forgot to say that the Alpha (the “A” of RGBA) is what controls transparency.

This is correct - if you are working on a mesh asset, but they are asking about VFX. In the case of a mesh, you need to use a transparent material that would look something like this:

  "render_info": {
     "color_map": "stonehearth:color_map:water",
     "material_maps": [
        "/stonehearth/data/materials/material_maps/water_material_map.json"
     ]

The “color_map” says which colors of the voxel asset this should be applied to, and the material map says which material to apply : ). For more context and information, check out the “roadside_shrine” asset.

I… don’t know what you’re asking me. Intensity of what?

Sadly no, Bezier Curves (for those of you that don’t know) are nice smooth curves that are interpolated between points by using things called tangents and look something like this.

In this example, the black line is the what a bezier curve would look like. We only have linear interpolation - so our “curves” look like the red lines and we have pretty harsh transitions. I’ve asked about Bezier curves, but the current response is ‘that’s a lot of work’ - and I generally drop it when that’s the response ; ).

So “random between curves” is when you provide two “Curves” (which are only a bunch of strait lines as stated above) which travel along points that you define, then the computer randomly picks between those two points and creates a new curve out of those randomly selected points. Here is a visualization - which I’m sorry has bezier curves and is probably confusing, just ignore that the lines curve if you can : ).

There is one curve at the top and one curve at the bottom - but almost more importantly, there is one point at the left, and one at the right. So the computer randomly picks a point on the left (between the top and bottom points) and does the same on the right, then connects them and that’s the resulting curve. Hopefully that all makes sense : ).

2 Likes

Thanks! That’s actually very insightful - I was wondering how this works for a long time, cuz editing light tracks is something I miss from SHED. That’s the long-desired bit of explanation.

I mean, you have “intensity”:“over_lifetime”, and then “over_lifetime__”. How does that work?

Oh, you mean from @Nano_Blue’s example? They’re actually the same thing - they are both the intensity over lifetime.
“Constant” means: over my lifetime my intensity doesn’t change.
“Random_between_curves” means: over my lifetime, randomly determine a curve between these two curves and change my intensity based on this randomly determined curve.

So the catch is, the second “over_lifetime” actually has extra “_” at the end - which makes it invalid and the code skips it and only goes with the “constant” one above it. Those tricky underscores ; D.

1 Like

Thank you so much!

its just what it needed :smiley:

heres a sneak peek of some of the lights now :wink:

6 Likes

theres white ones red ones and green ones so far ( but i need to make the green more ghostly) and im planning to make more colours with stone and metal lighting items too…

just one thing in terms of content,

should i just have one wood cost to make each lamp or should i add materials you have to collect to get the different colors of light as well as the wood cost?

Awesome! Thanks for sharing : ).

I’d say the cost for 1 colord lamp should be “1 regular lamp + 1 matriel for a specific color”.
Good work so far!

1 Like

try this…color picker