Difference between revisions of "Tutorial:FILT"

From The Powder Toy
Jump to: navigation, search
(Filter for Photons)
(replace /too/ layman explanations with valid and source-sourced facts, also add images)
Line 15: Line 15:
 
== Filter for Photons ==
 
== Filter for Photons ==
  
Here is where it gets really complicated.
+
[[File:Waves.gif|frame]]
As I said before, FILT's colour changes with it's temperature. Anyone can see that by heating up filt, you impart increasing (closer to red) wavelengths of the EM spectrum to photons. But in fact, the way that FILT affects photons is decided by a combination of its temp/ctype and tmp.
+
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 temp of a pixel of FILT affects the wavelength it imparts in increments of about 40ºC, but this is actually not the best way to set temperature. The wavelength is actually a combination of binary digits 30 long, stored in PHOT's ctype, giving a total of 2^31-1 = 2147483647 unique wavelengths. To make any sense of this, we need to look at how binary works:
+
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.
  
NOTE: if FILT's ctype is 0 (default), temp sets its wavelength characteristics and no spectrum appears in the GUI when you mouseover FILT. If the ctype is any number between 1 and 2147483647 inclusive, temp WILL NOT affect its characteristics, and the FILT's spectrum is shown in the GUI.
+
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.
  
NOTE 2: putting a pixel of DTEC next to a group of FILT will set the spectrum of any connected FILT to that of any passing PHOTons.
+
FILT has a couple of operation modes determined by its tmp property:
 +
[[File:FiltTmp.gif|frame]]
  
A binary string is made up of 1's and 0's. Each one converts to ...2^3,2^2,2^1,2^0 (...8,4,2,1). So, 1001 in decimal is 9 (2^3+2^0) and 101010 is 42 (2^5+2^3+2^1)
+
<ol start="0">
However, in a PHOT wavelength, each one means "wavelength present" and each 0 means "wavelength not present", and PHOT uses a string 30 bits long. So, a ctype of 1 (binary 000000000000000000000000000001) means "1 wavelength at the shortest wavelength"and a ctype of 2^29=536870912 (binary 010000000000000000000000000000) means "1 wavelength at the longest wavelength." To force white light, one would set the ctype to 2147483647 (binary 11111111111111111111111111111111). This means that setting FILT's ctype any power of two will give a single-wavelength photon.
+
<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>"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>
  
Now that FILT's colour is set, one can go through the tmp modes: (NOTE: the wiki page is somewhat out of date)
+
Any other tmp value makes FILT do nothing, like the "nop" mode.
  
'''tmp=0'''- "set colour" mode. FILT sets the spectrum of any PHOT passing through it to that of itself.
+
DTEC can be used to modify FILT's ctype: when PHOT hits DTEC, it copies photon's spectrum into adjacent FILT blocks, if any.
 
 
'''tmp=1'''- "AND" mode. Absorbs any photons with wavelengths that the FILT is not set to. Can act as an and gate when used with DTEC. [[https://powdertoy.co.uk/Browse/View.html?ID=1408215|Example]]
 
 
 
'''tmp=2'''- "OR" mode. Adds the wavelength(s) it is set to to PHOT.
 
 
 
'''tmp=3'''- "subtract" mode. FILT removes the wavelength(s) it is set to from any PHOT passing through it.
 
 
 
'''tmp=4'''- "red shift" mode. Shifts every wavelength towards the red end of the spectrum. Only works with simple spectra (set by temp), with hotter FILT impacting the PHOT more.
 
 
 
'''tmp=5'''- "blue shift" mode. Shifts every wavelength towards the blue end of the spectrum. Only works with simple spectra (set by temp), with hotter FILT impacting the PHOT more.
 
 
 
'''tmp=6'''- "no effect". Does nothing to incoming photons. Useful for if you're trying to intersect PHOT and ARAY beams.
 
 
 
'''tmp=7'''- "XOR" mode. Allows PHOT with similar colours through, but removes wavelengths FILT is set to from differently-coloured PHOTons.
 
 
 
'''tmp=8'''- "NOT" mode. Inverts the spectrum of incoming PHOT, regardless of FILT's spectrum. That is to say, it adds in every wavelength the PHOT does NOT have, and removes all that it does have.
 
 
 
'''tmp=9'''- "old QRTZ scattering" mode. This gives the photons that pass through a random -/+ X/Y velocity and changes their color randomly (usually to a hue of purple or yellow).
 
 
 
Setting the tmp of FILT to anything but 0-9 will make it do nothing.
 
 
 
 
 
 
 
Hope this guide has been helpful!
 
--[[User:minecraft-physics|minecraft-physics]] 10:06, 22 December 2013 (UTC)
 

Revision as of 13:07, 28 February 2014

FILT is one of those seemingly boring, but in reality extremely complex and interesting elements. The wiki description of FILT is way out of date, and completely ignores many aspects of its behaviour, particularly when used as a component in electronics or as a thermal conductor. So, 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. "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.
  5. "blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.
  6. "nop" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum
  7. "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.
  8. "not" mode: Performs a bitwise not: all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.
  9. "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 adjacent FILT blocks, if any.