Difference between revisions of "Element:FILT"

From The Powder Toy
Jump to: navigation, search
(Update infobox)
(Insert copy of Tutorial:FILT, needs tidying up and duplication of existing page content removing)
Line 48: Line 48:
 
Filters will color {{ Material | mat=BIZR }} and {{ Material | mat=BRAY }} (not {{ Material | mat=PSCN }} type) passing through it. However, most of FILT's uses are in photons.  
 
Filters will color {{ Material | mat=BIZR }} and {{ Material | mat=BRAY }} (not {{ Material | mat=PSCN }} type) passing through it. However, most of FILT's uses are in photons.  
  
'''NOTICE:''' Descriptions for tmp modes will be added in 89.0, as well as modes 4-9.
 
 
Depending of the tmp value of FILT, here are the reactions:
 
Depending of the tmp value of FILT, here are the reactions:
  
Line 62: Line 61:
 
* 9 (old QRTZ scattering): Mimicks legacy version of QRTZ. Photons will be reflected with a new, random color.
 
* 9 (old QRTZ scattering): Mimicks legacy version of QRTZ. Photons will be reflected with a new, random color.
 
* everything else (unknown mode): Acts like mode 6. But don't set it to this, otherwise your save might break if new modes are added in the future. Use mode 6 instead.  
 
* everything else (unknown mode): Acts like mode 6. But don't set it to this, otherwise your save might break if new modes are added in the future. Use mode 6 instead.  
 +
 +
FILT is one of those seemingly boring, but in reality extremely complex and interesting elements. Here are some uses of FILT:
 +
 +
=== Heat Conductor ===
 +
 +
Probably the simplest way to use FILT, for a beginner at least, is to transfer heat. FILT has a very high thermal conductivity and is indestructible to everything but BOMB and DEST, making it ideal for transferring heat away from reactors to cooling fluids. It is also useful for debugging, as it changes colour from blue at 0ºC to red at 1000ºC. (more detail on this in later sections). Note that if ambient heat is enabled, FILT's temperature will not be affected by the 'air temperature' around it, only items touching it.
 +
 +
=== ARAY Conduit ===
 +
 +
The basis of most modern electronics in TPT is FILT/ARAY conduits. If you SPRK a pixel of ARAY from a basic conductor (a conductor that is not PSCN, INST or INWR), it will create a beam of BRAY with a life of 30 that will SPRK any basic conductors or PSCN in the way. This is useful for transferring current over long distances quickly and more compressed-ly than INST, however it is clunky and slow as one must wait 30 frames before the ARAY can be SPRK'd again compared to 4 for INST.
 +
 +
If a pixel of FILT is pressed up against ARAY, and another pixel of conductor is on the end, it will conduct instantly. This is currently the most reliable, fastest method of conducting electricity.
 +
 +
Note that both white and brown BRAY can pass through it, and can enter, exit and re-enter the FILT without stopping the beam. White BRAY will pick up the display colour of the FILT, but cannot be used for wavelength transfer.
 +
 +
=== Filter for Photons ===
 +
 +
[[File:Waves.gif|frame]]
 +
BIZR/G/S and PHOT particles store their wavelengths in the ctype field. Wavelengths are stored in binary, using 30 out of 32 available bits. A set bit indicates that a specific wavelength is present, a zero bit means it is absent.
 +
 +
The visible color depends only on amount of bits in 5 bit groups: red, yellow, green, cyan, and blue. They are 9, 3, 6, 3, and 9 bits long respectively. The position of bits within a group is preserved, but does not affect particle's color. More specifically color only depends on ''proportions'' of those amounts. 
 +
To get white color, set the ctype to 0x3FFFFFFF, which will enable all the wavelengths.
 +
A photon dies if its ctype is 0, which means that no wavelengths are present.
 +
 +
FILT uses the ctype field to store wavelengths too, however if ctype is 0, wavelengths are calculated from its temperature: it slowly changes from blue when cold, to red when hot. More specifically, a group of 5 bits is set, and starting from 0°C, every 40°C the group is red-shifted by 1, and after 25 shifts, at 1000°C, the group is shifted to the most red wavelengths.
 +
 +
FILT has a couple of operation modes determined by its tmp property:
 +
[[File:FiltTmp.gif|frame]]
 +
 +
<ol start="0">
 +
<li>"set" mode: FILT's spectrum is copied into PHOT particles that pass through it</li>
 +
<li>"and" mode: A bitwise '''and''' is performed on PHOT's and FILT's spectrums and the result is stored in the PHOT particle, any wavelengths not present in FILT will be removed from PHOT.</li>
 +
<li>"or" mode: Performs a bitwise '''or''': all wavelengths present in FILT are "enabled" in PHOT, if not already.</li>
 +
<li>"sub" mode: Performs a bitwise '''and-not''': all wavelengths present in FILT are subtracted from PHOT.</li>
 +
<li>"red shift" mode: In this specific case, the value in FILT's tmp interpreted as a spectrum. It is just a number that specifies by how many wavelengths is PHOT's spectrum shifted, in red direction.</li>
 +
<li>"blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.</li>
 +
<li>"nop" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum</li>
 +
<li>"xor" mode: Performs a bitwise '''xor''': all wavelengths present in FILT are "flipped" in PHOT's spectrum, that is, if some color was on, it turns off, and vice versa.</li>
 +
<li>"not" mode: Performs a bitwise '''not''': all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.</li>
 +
<li>"QRTZ scattering" mode: Randomizes photons' velocity and randomly changes their color, just like QRTZ.</li>
 +
</ol>
 +
 +
Any other tmp value makes FILT do nothing, like the "nop" mode.
 +
 +
DTEC can be used to modify FILT's ctype: when PHOT hits DTEC, it copies photon's spectrum into a line of directly adjacent FILT blocks, if any.
  
 
== Examples ==
 
== Examples ==

Revision as of 10:16, 7 October 2014

FILT.png Filter
Properties
Section Solids
Spawn temperature 22°C
Heat Conductivity 100%
Relative weight 100
Gravity 0
Acid dissolve rate 0.1%
Flammability 0
State Solid
Misc properties
Source code


Creation

Only with brush, cannot be created with reactions.

Usage

Filter's color is changed based on it's temperature. It will scale from dark blue to dark red, from temperature scale of 200C to 840C. Filter has high temperature conductivity and therefore it's color can be changed during simulation.

Filters will color BIZR and BRAY (not PSCN type) passing through it. However, most of FILT's uses are in photons.

Depending of the tmp value of FILT, here are the reactions:

  • 0 (set colour): Will color photons passing through.
  • 1 (AND): Will filter a color out of photons. This means that completely red photons will be destroyed, but purple photons turn into blue ones.
  • 2 (OR): Adds the filter's color to the color of passing photons.
  • 3 (subtract colour): Removes the filter's color from the color of passing photons.
  • 4 (red shift): Does a binary left shift with the color depending on the temperature, making the color more red.
  • 5 (blue shift): Does a binary right shift with the color depending on the temperature, making the color more blue.
  • 6 (no effect): Allows photons to pass through without affecting them.
  • 7 (XOR): Performs a XOR with the color of the photons passing through. For example, if the photons are blue and they pass through a red filter with XOR mode, they become purple: and if the photons are purple, they'll turn blue.
  • 8 (NOT): Inverses the color of the photons passing through. Filter's color has no effect.
  • 9 (old QRTZ scattering): Mimicks legacy version of QRTZ. Photons will be reflected with a new, random color.
  • everything else (unknown mode): Acts like mode 6. But don't set it to this, otherwise your save might break if new modes are added in the future. Use mode 6 instead.

FILT is one of those seemingly boring, but in reality extremely complex and interesting elements. Here are some uses of FILT:

Heat Conductor

Probably the simplest way to use FILT, for a beginner at least, is to transfer heat. FILT has a very high thermal conductivity and is indestructible to everything but BOMB and DEST, making it ideal for transferring heat away from reactors to cooling fluids. It is also useful for debugging, as it changes colour from blue at 0ºC to red at 1000ºC. (more detail on this in later sections). Note that if ambient heat is enabled, FILT's temperature will not be affected by the 'air temperature' around it, only items touching it.

ARAY Conduit

The basis of most modern electronics in TPT is FILT/ARAY conduits. If you SPRK a pixel of ARAY from a basic conductor (a conductor that is not PSCN, INST or INWR), it will create a beam of BRAY with a life of 30 that will SPRK any basic conductors or PSCN in the way. This is useful for transferring current over long distances quickly and more compressed-ly than INST, however it is clunky and slow as one must wait 30 frames before the ARAY can be SPRK'd again compared to 4 for INST.

If a pixel of FILT is pressed up against ARAY, and another pixel of conductor is on the end, it will conduct instantly. This is currently the most reliable, fastest method of conducting electricity.

Note that both white and brown BRAY can pass through it, and can enter, exit and re-enter the FILT without stopping the beam. White BRAY will pick up the display colour of the FILT, but cannot be used for wavelength transfer.

Filter for Photons

Waves.gif

BIZR/G/S and PHOT particles store their wavelengths in the ctype field. Wavelengths are stored in binary, using 30 out of 32 available bits. A set bit indicates that a specific wavelength is present, a zero bit means it is absent.

The visible color depends only on amount of bits in 5 bit groups: red, yellow, green, cyan, and blue. They are 9, 3, 6, 3, and 9 bits long respectively. The position of bits within a group is preserved, but does not affect particle's color. More specifically color only depends on proportions of those amounts. To get white color, set the ctype to 0x3FFFFFFF, which will enable all the wavelengths. A photon dies if its ctype is 0, which means that no wavelengths are present.

FILT uses the ctype field to store wavelengths too, however if ctype is 0, wavelengths are calculated from its temperature: it slowly changes from blue when cold, to red when hot. More specifically, a group of 5 bits is set, and starting from 0°C, every 40°C the group is red-shifted by 1, and after 25 shifts, at 1000°C, the group is shifted to the most red wavelengths.

FILT has a couple of operation modes determined by its tmp property:

FiltTmp.gif
  1. "set" mode: FILT's spectrum is copied into PHOT particles that pass through it
  2. "and" mode: A bitwise and is performed on PHOT's and FILT's spectrums and the result is stored in the PHOT particle, any wavelengths not present in FILT will be removed from PHOT.
  3. "or" mode: Performs a bitwise or: all wavelengths present in FILT are "enabled" in PHOT, if not already.
  4. "sub" mode: Performs a bitwise and-not: all wavelengths present in FILT are subtracted from PHOT.
  5. "red shift" mode: In this specific case, the value in FILT's tmp interpreted as a spectrum. It is just a number that specifies by how many wavelengths is PHOT's spectrum shifted, in red direction.
  6. "blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.
  7. "nop" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum
  8. "xor" mode: Performs a bitwise xor: all wavelengths present in FILT are "flipped" in PHOT's spectrum, that is, if some color was on, it turns off, and vice versa.
  9. "not" mode: Performs a bitwise not: all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.
  10. "QRTZ scattering" mode: Randomizes photons' velocity and randomly changes their color, just like QRTZ.

Any other tmp value makes FILT do nothing, like the "nop" mode.

DTEC can be used to modify FILT's ctype: when PHOT hits DTEC, it copies photon's spectrum into a line of directly adjacent FILT blocks, if any.

Examples

A thermometer done with using FILT.
A spectrum analyzer, which can detect the color of incoming photons.