PhotWavelengths property 101

  • _Theo
    29th Apr 2018 Member 0 Permalink

    The Photwavelengths property has only been around for like a year or so. Found out how to use it

    You see, phot's colors work in binary, 1 turns one of the colors on, 0 is off. it has 30 colors able to be mixed using just on and off, for example, Blue would be 1, Red would be 2^30 (again, binary powers) and white would be 2^31-1, there's also black phot which quickly dissapears, all 0's. What phot wavelengths does is turn this binary number into Hexadecimal, the same as the color hexes except this one is much larger than them, don't be fooled. For example, here's a list of colors for example

    F8F8F8FF = Lavender

    00000001 = True blue

    80000000 = White

    00000000 = Phot void (black phot dissapears)

    Hope you find this useful, since I did because, damn, elements look way better like this. 

    Edited once by TuDoR2007. Last: 30th Apr 2018
  • lamyipfu
    29th Apr 2018 Member 0 Permalink

    Congrats,
    You are now at the door of PHOT mechanics, a big topic in TPT.
    You can set PHOT's color using FILT's ctype, PHOT passing through a FILT will receive the same wavelength as the ctype of FILT, which ctype can be set using PROP in Tools in case you don't know.
    It is the same for ARAY, shooting through FILT will create a ray of FILT's ctype and it is more reliable than PHOT.
    Further manipulation of FILT will allow the creation of complicated electronics and that's how people make computers in TPT.

    Btw, wavelength is only 2^30 bits, the 31th and 32th bits are not for wavelength, so white is 2^30 - 1.

  • _Theo
    30th Apr 2018 Member 0 Permalink

    Ooh made a mistake there.

     

    Also apparently qrtz scattering is a good filt randomizer, nice!

    Edited once by TuDoR2007. Last: 30th Apr 2018
  • LBPHacker
    30th Apr 2018 Developer 2 Permalink

    PHOT/BRAY/FILT colours are a lot less mystical than this thread makes them out to be. Let me get a few facts straight.

     

    These elements, much like every element, have a ctype property. 30 bits of this property represent wavelenghts from the visible spectrum of light present in the particle (kind of). The sum of the top 12 (more significant) bits is the intensity of a red component, the sum of the middle 12 is the same of a green component, and finally the sum of the bottom 12 is the same of a blue component.

     

    This image from the wiki shows these bit regions quite clearly (which do overlap, hence the yellow and cyan regions). Click on the image to get to the page where I got it from.

     

     

    So for example the BRAY with ctype = 0xBADC0DE would have some sort of mallow-ish colour (RGB E0A0C0 if I'm not mistaken) because the top 12 bits sum to 7 (red), the middle 12 to 5 (green) and the bottom 12 to 6 (blue). You can see an indication of wavelenghts present in the particle very similar to the image above in the image below, above the BRAY (ugly decimal ctype) text.

     

     

    The way the actual RGB colours are calculated is... well, it's just kind of implemented somehow and everyone seems to accept it. An integer factor is calculated by dividing 624 by the sum of all three regions plus one, and then all three sums are multiplied by this factor and are used as the final RGB components (see Element_FILT::graphics). I guess this somehow normalises colours, accenting wavelenghts when there are only a few of them and blending them together nicely when there are many.

     

    There is not much else to know about wavelenghts. Elements have a fun properly called PhotonReflectWavelengths which can be used to make an element absorb certain wavelenghts from photons. For example PLUT has this set to a green-ish wavelength set (bits are mostly 1 in the green region, these are the wavelengths that are not absorbed) and as a result it turns yellow photons into green ones and kills red photons.

     

     

    Then there's is of course FILT, which has the ability to do bitwise operations on these wavelength sets, and in fact this is what gives rise to FILT computing. Black (no wavelentgths present) PHOT/BRAY disappearing helps a lot in this field, as this property can be used to make decisions based on ctypes at runtime. For example FILT has a mode that does a binary XOR on the wavelength of itself and the BRAY passing through it. If the BRAY happens to have the same ctype as the FILT, the result of the operation will be 0 and the BRAY won't exit the FILT. This way XOR-ing FILT acts as a very basic equality checker.

     

    Fun fact: FILT-based electronics are very often a mix of red, magenta, blue, and every sort of colour in between those. This is because when we don't want BRAY to disappear in the middle of a calculation, we sacrifice one of the wavelengths to act as a sort of keep-alive wavelength that binary operations never affect. This wavelength usually happens to be the 2^29 (MSB) one, which is in the red region. Less significant bits may still be either 1 or 0, so these sometimes turn the otherwise red overall colour into magenta or even blue, cyan or green, depending on how many of them are 1.

    Edited 2 times by LBPHacker. Last: 30th Apr 2018