View unanswered posts | View active topics It is currently Mon Dec 09, 2019 4:01 pm



Reply to topic  [ 3 posts ] 
Modding: Tag for colour affinities 
Author Message

Joined: Thu Jan 14, 2016 2:21 pm
Posts: 94
Reply with quote
Currently block colours are associated with the faction colours by some closeness metric, which I'd love to know the details of sometime if possible so I can inform RWDK users which colours a block's different colours will be affected by.

It would be even better if there was a way to manually associate a colour with a faction colour id (0/1/2? hm, that seems bad... don't want 0 to be default... 1/2/3? then it doesn't match the faction...) or even no faction colour at all (-1?) so situations like the one I have with my Infraspatia faction's shields can be avoided (see below for details). This would allow much better control of how a faction's blocks are represented in the game. If the tag is undefined the associated colour would be calculated as it is now, similarly to P cost overrides etc.

Since each colour field would have one of these, it might even be cleaner to allow the colour field type to optionally take a group of some kind e.g.
Code:
fillColor=0xc4e61

could optionally be defined as something like
Code:
fillColor={color=0xc4e61, factionColor=1}

to define which of the faction colours it is affected by.

[Reveal] Spoiler: InfraSpatia problem details
Because one faction colour is dark and the other bright (dark red and bright cyan respectively), I am required to make the shields a bright cyan colour. If they are made a darker cyan, they are associated with the dark red and do not recolour correctly. This means they are very opaque, which obscures vision greatly.


On a related note, it would be great to get the details of how the defined shield colour affects in-game colour, because it's not additive and it's not just a direct colour because it doesn't match the results I get from doing that in my preview renders.

_________________
My mods
Starring:
  • The Triumvirate - Triangles with shotguns and ablative armour
  • InfraSpatia - Disjointed aliens with spinal guns
  • Systems Coalition Remnant - Turbo-rectangles with stacking guns
  • Roiders - Cities and drills
Make your own with the Reassembly Web Development Kit!


Tue Apr 19, 2016 9:21 pm
Profile
Site Admin
User avatar

Joined: Thu Jan 16, 2014 2:45 pm
Posts: 561
Location: Los Angeles
Reply with quote
The faction colors get applied to block colors as follows:

convert all colors to hsv space (hue is an angle, saturation and value are between 0 and 1)
the "base" color is the original faction color that is closest to the block color
the "new base" color is the player-selected faction color with the same index as the base color

delta = block_color - base_color
delta.hue *= base_color.saturation
delta.saturation *= new_base_color.saturation
block_color = new_base_color + delta

shield and weapon effects additionally have their value clamped to 0.3

Code:
// Colors are in HSV (x is hue, y is saturation, z is value)
float distanceHsv(float3 a, float3 b)
{
    return length(float3(min(a.y, b.y) * ((1 - dotAngles(a.x, b.x)) / 2.f),
                          a.y - b.y,
                          a.z - b.z));
}


You might be able to solve the shield problem by adding a third primary color for the shields? The base color is computed based on the original faction color and the block color so you have control over it as the modder (to the extent that it has to be the closest color).

Shield colors are rendered and blended with projectiles, lasers, etc. as premultiplied alpha, so the rgb channels are just added and alpha (which is not affected by recoloring) controls how much color is blocked behind the shield. The shield itself is just a circular gradient with black in the center. There is also the bloom filter on top.


Wed May 25, 2016 11:57 am
Profile

Joined: Thu Jan 14, 2016 2:21 pm
Posts: 94
Reply with quote
Unfortunately the side already has three colours - the third is white for the weapons.

You can see why the shields are so annoying here:
[Reveal] Spoiler: Big images
Image
Image

_________________
My mods
Starring:
  • The Triumvirate - Triangles with shotguns and ablative armour
  • InfraSpatia - Disjointed aliens with spinal guns
  • Systems Coalition Remnant - Turbo-rectangles with stacking guns
  • Roiders - Cities and drills
Make your own with the Reassembly Web Development Kit!


Thu May 26, 2016 6:50 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software