I've been thinking about path tracing a lot lately, and I came up with a bad idea. Why it's bad is interesting though, as it demonstrates partly why physically-based rendering is so hard (complexity). I think it also validates path tracing as a good approach.
So, my idea was to take each emitter mesh, and propagate a single wavefront out through the scene. The mesh would be simplified as it propagated (retopologising, perhaps using Delauney triangulation). Once the wavefront was at a low enough intensity, it would not be reflected. The camera would then either receive all wavefronts on an image plane (which could potentially be stored as a hologram) or just raytrace the lit scene (seemed similar to radiosity).
Such a scheme would be able to store polarisation and phase in the wavefront, and thus calculate interference effects at surfaces (if previous wavefronts that hit the surface were recorded), and diffraction around barriers would be possible as well.
The problem with this approach is complexity. An area light at the top of a Cornell box is square. The left side sends light to the right, and the right side sends light to the left. A single mesh is not able to capture that much information -- my approach above was too simplistic.
The next step, then, is to make each part of the mesh emit spherical waves. We could then propagate them using the Huygens-Kirchoff principle if we cared about diffraction effects. This gets very complicated, as we almost need to store the state of light throughout the volume of interest, at a resolution good enough to observe interference effects (otherwise there's not much point using secondary waves at all). If we do not use secondary waves during propagation, but merely propagate the spherical waves outward, then this is a very complicated way of doing photon mapping.
So I conclude that this method, while interesting, is not practical, except for very specific scenes which may require such modelling.
Diffraction and interference are probably still better done storing and propagating phase with rays and image pixels - e.g. having 8 images, each storing the accumulated intensity for photons with a certain phase, and combining them to show interference effects at the end of rendering. Actually that sounds kind of cool, I'll have to try that one day. Diffraction could be done by using fuzzy intersection code and bending rays a random amount toward an edge when they went past an edge.
Edit: Someone's already thought of this, and called it Beam tracing.
Sunday, February 14, 2010
Coanda effect helicopters
The person who takes these things, puts a camera on them and sells them for use following the action in sports television will make a fortune.
The idea is patented in the US; electric versions may not last long; it would be easy to have several and recharge them while others are flying.
I suspect the main challenge (after licensing) is in the control software. You'd either need very experienced pilots, or a good control system. A system that had the camera mounted with a gyro for stability like those old bomber turrets in a swivel ball would make things a lot easier for the pilot.
In case the above link is broken, I am referring to helicopters with dome-shaped bodies and a small blade on top that pushes air around the body; they fly as a result of the Coanda effect (the same one that most aeroplane wings use: faster air = lower pressure), as discussed on Slashdot.
The idea is patented in the US; electric versions may not last long; it would be easy to have several and recharge them while others are flying.
I suspect the main challenge (after licensing) is in the control software. You'd either need very experienced pilots, or a good control system. A system that had the camera mounted with a gyro for stability like those old bomber turrets in a swivel ball would make things a lot easier for the pilot.
In case the above link is broken, I am referring to helicopters with dome-shaped bodies and a small blade on top that pushes air around the body; they fly as a result of the Coanda effect (the same one that most aeroplane wings use: faster air = lower pressure), as discussed on Slashdot.
Tuesday, February 09, 2010
solid state QC fabrication daydreaming
Well. One way would be to get bricks, 10nm^3 with sheer edges, and a single dopant at the centre. Constructing your QC would then simply be a matter of positioning bricks, perhaps by immersing them in liquid and pouring them over something.
The best strategy for regular arrays involves natural alignment through chemistry of some sort, for example if donors could be made to repel each other over some range, that would be very useful.
An alternative is some sort of nano-periodic structure that can be filled in in some kind of regular fashion and then etched away.
Perhaps a long biological molecule could be periodic on the scale required, and laid flat and straight on a substrate? The unwanted bits could then be removed, and crystal grown around the remainder..
The best strategy for regular arrays involves natural alignment through chemistry of some sort, for example if donors could be made to repel each other over some range, that would be very useful.
An alternative is some sort of nano-periodic structure that can be filled in in some kind of regular fashion and then etched away.
Perhaps a long biological molecule could be periodic on the scale required, and laid flat and straight on a substrate? The unwanted bits could then be removed, and crystal grown around the remainder..
Saturday, February 06, 2010
So yeah

I just finished this game,
and it was awesome,
and there's no SVG logo on the web.
So here it is.
Actually, the more surprising thing is that Double Fine doesn't sell a green turtleneck with this logo on it. I suppose they do have Kochamara...
Friday, January 29, 2010
2up page formatting with pages scaled better
So I print a lot of stuff (I can't afford an A4 sized ebook reader) 2 pages per side. The large margins have always annoyed me. Here's the solution.
Two 2 pages per sheet ps document (convert pdf to ps with ps2pdf), with page borders reduced by 1cm:
psnup -2 infile.ps outfile-2up.ps -Pletter -pa4 -b-1cm
-P input paper size
-p output paper size
-b border (margin) change
Changing different borders by different amounts is more complicated but can be done with pstops, and is left as an exercise for the reader.
Two 2 pages per sheet ps document (convert pdf to ps with ps2pdf), with page borders reduced by 1cm:
psnup -2 infile.ps outfile-2up.ps -Pletter -pa4 -b-1cm
-P input paper size
-p output paper size
-b border (margin) change
Changing different borders by different amounts is more complicated but can be done with pstops, and is left as an exercise for the reader.
Sunday, January 17, 2010
Because I forgot how to type unicode characters
The last post is the only one worth reading:
Applications that use newer GTK+ libraries (which includes all applications written for Gnome) require a "U" before the Unicode digits. Either of the following sequences should work:
Ctrl-Shift-U, hex codes, Spacebar
Hold down Ctrl-Shift, U, hex codes, release Ctrl-Shift
Applications that use newer GTK+ libraries (which includes all applications written for Gnome) require a "U" before the Unicode digits. Either of the following sequences should work:
Ctrl-Shift-U, hex codes, Spacebar
Hold down Ctrl-Shift, U, hex codes, release Ctrl-Shift
Sunday, December 27, 2009
Sunday, December 20, 2009
Ubuntu, OpenCL and NVIDIA
To be able to compile OpenCL programs on Ubuntu with an nvidia card:
Find a driver with OpenCL support: 195.17 works (but later ones do not). Download it by searching nvidia's site, or try here.
This step is very important: Disable Ubuntu's hardware drivers if you have enabled them. System -> Administration -> Hardware Drivers.
sudo apt-get install build-essential
Now ctrl+alt+F1 to switch to a terminal; sudo stop gdm to kill Xorg; cd ~/Downloads; chmod 700 cudadriver*; sudo ./cudadriver*. Accept all the default options, including installing 32bit libs if you're on a 64bit system and resetting your xorg.conf. I had to copy /usr/lib32/libglut* to /usr/lib. sudo apt-get --reinstall install freeglut3 freeglut3-dev. sudo start gdm. You're all set.
Find a driver with OpenCL support: 195.17 works (but later ones do not). Download it by searching nvidia's site, or try here.
This step is very important: Disable Ubuntu's hardware drivers if you have enabled them. System -> Administration -> Hardware Drivers.
sudo apt-get install build-essential
Now ctrl+alt+F1 to switch to a terminal; sudo stop gdm to kill Xorg; cd ~/Downloads; chmod 700 cudadriver*; sudo ./cudadriver*. Accept all the default options, including installing 32bit libs if you're on a 64bit system and resetting your xorg.conf. I had to copy /usr/lib32/libglut* to /usr/lib. sudo apt-get --reinstall install freeglut3 freeglut3-dev. sudo start gdm. You're all set.
Wednesday, December 02, 2009
Things to do
Lyx needs GUI support for document macros.
I say this because I've seen several times now the need for a user defined paragraph style, such as "Example" or "Exercise" or "Answer". This could potentially be solved by having a style editor? This might turn out to be a considerable amount of work.
Also, however, it needs simple replacement macros. An example I use a lot is \termdef{index item} which makes the index item text bold and adds an index entry. This kind of speed is not available to Lyx users. I suppose this is more of a variation on the noun/emphasis theme - user defined versions of these with custom Tex macros would be sufficient for this usage.
I say this because I've seen several times now the need for a user defined paragraph style, such as "Example" or "Exercise" or "Answer". This could potentially be solved by having a style editor? This might turn out to be a considerable amount of work.
Also, however, it needs simple replacement macros. An example I use a lot is \termdef{index item} which makes the index item text bold and adds an index entry. This kind of speed is not available to Lyx users. I suppose this is more of a variation on the noun/emphasis theme - user defined versions of these with custom Tex macros would be sufficient for this usage.
The Next Great Copyright Battle
2010 - Ebook readers become common.
2011 - Book sharing websites become popular.
2011 - Copyright infringement of books skyrockets. Seriously, you haven't seen anything yet.
2012 - Ebook makers build in or software update to automatic copyright protection for non-DRMed books, with phone-home functionality. "Make an example" lawsuits by publishers' associations begin.
2012 - Ebook readers without the ability to phone home enjoy a surge in sales. Crackers teach how to destroy aerials or crack firmware of popular models. Ebook readers stop working unless they can check in with their maker regularly.
2013 - ??? Who will win? Free Culture or Big Business?
Unlike musicians, book authors cannot make a lot of money out of performances. They (and their publishers) currently depend heavily on book sales to earn money.
One way to severely reduce piracy would be to make the books very cheap, like 1/100th of a day's wages. This would make the few minutes spent finding books for free uneconomical. If this was the case, DRM would almost be unnecessary. This doesn't work for smaller-market books like textbooks.
Perhaps a collaborative effort will produce good cc textbooks by then anyway, here's hoping! Actually it looks like there are quite a lot of good texts already, they just need to get noticed!
An alternative model for textbook authors is that used by Sean Carroll. Lecture notes are posted online, and satisfy course requirements; students who want a more complete treatment can buy the expanded textbook. I think this is a good model, but it doesn't work for fiction.
2011 - Book sharing websites become popular.
2011 - Copyright infringement of books skyrockets. Seriously, you haven't seen anything yet.
2012 - Ebook makers build in or software update to automatic copyright protection for non-DRMed books, with phone-home functionality. "Make an example" lawsuits by publishers' associations begin.
2012 - Ebook readers without the ability to phone home enjoy a surge in sales. Crackers teach how to destroy aerials or crack firmware of popular models. Ebook readers stop working unless they can check in with their maker regularly.
2013 - ??? Who will win? Free Culture or Big Business?
Unlike musicians, book authors cannot make a lot of money out of performances. They (and their publishers) currently depend heavily on book sales to earn money.
One way to severely reduce piracy would be to make the books very cheap, like 1/100th of a day's wages. This would make the few minutes spent finding books for free uneconomical. If this was the case, DRM would almost be unnecessary. This doesn't work for smaller-market books like textbooks.
Perhaps a collaborative effort will produce good cc textbooks by then anyway, here's hoping! Actually it looks like there are quite a lot of good texts already, they just need to get noticed!
An alternative model for textbook authors is that used by Sean Carroll. Lecture notes are posted online, and satisfy course requirements; students who want a more complete treatment can buy the expanded textbook. I think this is a good model, but it doesn't work for fiction.
Thursday, November 26, 2009
Thritical Cinking
So. I haven't been able to avoid a few Glen Beck stories in the online media recently. It made me think.
Memes and attitudes are often forced on us, by parents, friends or the things we read. Once we get into a certain point of view, we like and remember things that agree with that point of view - the memes* become self-reinforcing. (Humans like identifying patterns. I'd even go so far as to say it's the main component of intelligence.)
So our point of view often depends on which part of society we come from. Who, then, makes up points of view in the first place? Leaders. Leaders are often strongly biased one way or another by existing points of view and can make (very) bad judgements, or judgements that are good for them in the short term but ultimately very bad for {[many] other people|those around them|themselves|society}. **
All this leads to ideas that are more trouble than they're worth becoming widespread.
The best defence is critical thinking. Analyse ideas yourself, carefully. Check them as much as you can. There doesn't seem to be enough of that going around these days. Internet culture (tl;dr) doesn't encourage it.
Censorship is the antithesis of encouraging critical thinking, and is *very bad*.
* I apologize for using this word repeatedly, but I couldn't think of a better way of putting it.
** The reason for the bad decisions is often extending a previously recognised pattern into a domain where it doesn't apply.
Saturday, November 21, 2009
Picnic Food
So,
I want more picnics. I'm writing things down now so next time I don't have to think up a list of food.
strawberries/other berries/nuts + chocolate dip / yoghurt / hot nutella
dry biscuits / bread + soft cheese / hard cheese / dips
sliced ham / twiggy sticks / cabana sausage
watermelon / sliced apple / sweet oranges
small double-layer sandwiches - mayonnaise egg tuna ham gherkins beetroot
hot chicken / potato salad / sausage rolls
I want more picnics. I'm writing things down now so next time I don't have to think up a list of food.
strawberries/other berries/nuts + chocolate dip / yoghurt / hot nutella
dry biscuits / bread + soft cheese / hard cheese / dips
sliced ham / twiggy sticks / cabana sausage
watermelon / sliced apple / sweet oranges
small double-layer sandwiches - mayonnaise egg tuna ham gherkins beetroot
hot chicken / potato salad / sausage rolls
Friday, November 13, 2009
Thursday, November 12, 2009
Geant4 and SRIM
So I've spent a while trying to get Geant4 to do ion implantations similar to SRIM. Turns out Example TestEm7 models a particle (can be an ion -- see the included C12 macro) impacting a block of material, and even includes some extra physics to make the "low-energy" ion calculation more accurate (screened nuclear stopping, custom-defined physics list standardNR, by Mendenhall and Weller). It calculates the predicted range of such ions.
Using Geant4.9.3.b01 and the standardNR physics list, my quick accuracy test gave an ion range for P-31 at 10keV (very low energy in Geant4 terms) into NIST-parameterized Si of 15nm versus SRIM-2008's 17nm (monolayer mode). Both give rms values of about 5-6nm.
To get energies and positions of transmitted particles requires some editing of the C++ code.
Why am I doing this? SRIM only does layers of material, I'm trying to model a more complicated geometry.
Using Geant4.9.3.b01 and the standardNR physics list, my quick accuracy test gave an ion range for P-31 at 10keV (very low energy in Geant4 terms) into NIST-parameterized Si of 15nm versus SRIM-2008's 17nm (monolayer mode). Both give rms values of about 5-6nm.
To get energies and positions of transmitted particles requires some editing of the C++ code.
Why am I doing this? SRIM only does layers of material, I'm trying to model a more complicated geometry.
Thursday, October 01, 2009
X Sharing Screens
Found this in my archive, I dunno where from..
When I pop up with my laptop to discuss with a colleague, after a while I might do on their computer:xhost +mylaptopnameand on my laptop I do:x2x thecomputername:0 -westThen suddenly my mouse can go over the two computers, my keyboard works on both as well, and I can even copy-paste between the two computers. It looks like the two computers got united. In a flash, newbies get a new idea of what means unix and X ;-
but I thought it was worth reposting.
Actually those commands don't quite work. On your laptop, run
sudo apt-get install x2x xhost +desktop-ip
And on the desktop,
ssh laptop-ip -XC x2x -west -to :0.0Your desktop now controls both screens.
Sunday, September 13, 2009
Friday, September 04, 2009
Techdirt
This is a bit of an e-vote for TechDirt. I don't agree with everything those guys say, but lately they've had several in-depth articles and they research their stuff well and are honest when they're wrong.
However, I was a bit annoyed at them dissing CSIRO's wifi patent. I mean, fine, the patent system is heavily abused, but the suggestion that CSIRO should have become a wifi device manufacturer instead of licensing out the technology is a bit ridiculous. And they did license it -- the companies involved just tried to weasel out of paying up once they'd learned everything they needed.
However, I was a bit annoyed at them dissing CSIRO's wifi patent. I mean, fine, the patent system is heavily abused, but the suggestion that CSIRO should have become a wifi device manufacturer instead of licensing out the technology is a bit ridiculous. And they did license it -- the companies involved just tried to weasel out of paying up once they'd learned everything they needed.
Edit: revoked. No longer a fan.
Monday, August 31, 2009
Last Piece Puzzle
So I was away on holiday and I found a puzzle called the Last Piece Puzzle. Basically trying to arrange tetris-like pieces to fill a square with no gaps.
I wrote a program to solve it, which was going to take about thirty years to try every combination. The second attempt found all possible solutions in about 2 minutes.
The difference between the two algorithms is what gets me - it's so subtle. The first algorithm picked a piece and then tried every position on the board for that piece, then once it found a position, it moved on to the next piece. The problem here is that there were often holes left behind that no piece would fit into, so it spent a lot of time trying to solve a board that obviously couldn't be solved.
The second algorithm was only slightly different - instead of trying the pieces in order, try to fill the squares in order. This way there were almost no holes (or the holes were found without too much extra effort) and the algorithm turned out to be hugely faster.
There was a contest to solve it in lisp - the fastest solution there was 0.3 seconds. My second attempt copied the winning algorithm there.
My solution is also floating around.
In total, there are five possible solutions:
Tuesday, July 28, 2009
Atom printing
Just went to the sweetest talk about 0.2A (1A lateral) resolution atomic tomography. Basically kick atoms off a (needle) surface with an electrical pulse or laser and then accelerate them into a position sensing detector. The time-of-flight gives you the mass-to-charge ratio so you can tell element and isotope. As the electric field spreads out almost radially away from the needle you get a lot of magnification and can tell the originating position quite accurately.
Of course, this imaging method destroys the sample.. but wouldn't it be cool if you could do it in reverse to place individual atoms into an object? It would be difficult to say the least, but the result would be awesome. Not only that, but it could be a quite automatic process.
You could have different print heads for different elements. Perhaps even the same thing in reverse, a laser that kicks atoms off the "print head" and then the freed ion travels along the electric field line and hits the "needle". Of course, you would have to ensure that the ion got kicked off with a small velocity or you would have quite bad lateral resolution. This low velocity thing would probably result in the ion just reattaching to the material. So this is probably hard to do, because the whole point of using a needle is presumably so as to get strong electric fields (and thus high acceleration) when the ion is first ionised. Perhaps this is why this technique won't work.
But what if you had two needles? Boot the atoms off one, and attach them to the other. Ensure that only certain atoms land by having a (macro scale) aperture between them and detect when atoms land.
Of course, this imaging method destroys the sample.. but wouldn't it be cool if you could do it in reverse to place individual atoms into an object? It would be difficult to say the least, but the result would be awesome. Not only that, but it could be a quite automatic process.
You could have different print heads for different elements. Perhaps even the same thing in reverse, a laser that kicks atoms off the "print head" and then the freed ion travels along the electric field line and hits the "needle". Of course, you would have to ensure that the ion got kicked off with a small velocity or you would have quite bad lateral resolution. This low velocity thing would probably result in the ion just reattaching to the material. So this is probably hard to do, because the whole point of using a needle is presumably so as to get strong electric fields (and thus high acceleration) when the ion is first ionised. Perhaps this is why this technique won't work.
But what if you had two needles? Boot the atoms off one, and attach them to the other. Ensure that only certain atoms land by having a (macro scale) aperture between them and detect when atoms land.
Monday, June 22, 2009
Jaunty
Things to fix for Ubuntu Jaunty install on an M1330 (so far):
Set Source in synaptic to whatever ISP I'm currently using (avoid quota usage)
System->Administration->Hardware Drivers, enable latest
Install packages:
texmaker texlive-math-extra
blender inkscape
idle
compiz-fusion-plugins-extra compizconfig-settings-manager
Audio (crackles instead of proper sound):
change /etc/modprobe.d/alsa.conf
add line
options snd-hda-intel model=3stack
as my laptop has three audio ports
(ref: https://help.ubuntu.com/community/SoundTroubleshooting )
CD/DVD (disks don't mount properly):
add line to /etc/fstab:
/dev/sr0 /media/cdrom0 iso9660,udf user,noauto,exec,utf8 0 0
and make sure the other lines match the order of is09660,udf.
(ref: http://osdir.com/ml/ubuntu-users/2009-05/msg00352.html)
HDD power management (hd spins up/down constantly):
add
/dev/sda {
apm = 255
}
to /etc/hdparm.conf
and change /etc/acpi/resume.d/*hdparm* and /etc/acpi/start.d/*hdparm* :
change all three-digit numbers (128, 254) to 255.
(ref http://www.gatzet.com/fixing-ubuntu-harddisk-power-management-bug.html)
Closing the lid of the laptop should make it sleep:
System->Preferences->Power Management
On AC Power, When Laptop Lid is Closed, Suspend.
Firefox extensions:
flashblock chatzilla
Configure Inkscape to use SVG properly.
Set Source in synaptic to whatever ISP I'm currently using (avoid quota usage)
System->Administration->Hardware Drivers, enable latest
Install packages:
texmaker texlive-math-extra
blender inkscape
idle
compiz-fusion-plugins-extra compizconfig-settings-manager
Audio (crackles instead of proper sound):
change /etc/modprobe.d/alsa.conf
add line
options snd-hda-intel model=3stack
as my laptop has three audio ports
(ref: https://help.ubuntu.com/community/SoundTroubleshooting )
CD/DVD (disks don't mount properly):
add line to /etc/fstab:
/dev/sr0 /media/cdrom0 iso9660,udf user,noauto,exec,utf8 0 0
and make sure the other lines match the order of is09660,udf.
(ref: http://osdir.com/ml/ubuntu-users/2009-05/msg00352.html)
HDD power management (hd spins up/down constantly):
add
/dev/sda {
apm = 255
}
to /etc/hdparm.conf
and change /etc/acpi/resume.d/*hdparm* and /etc/acpi/start.d/*hdparm* :
change all three-digit numbers (128, 254) to 255.
(ref http://www.gatzet.com/fixing-ubuntu-harddisk-power-management-bug.html)
Closing the lid of the laptop should make it sleep:
System->Preferences->Power Management
On AC Power, When Laptop Lid is Closed, Suspend.
Firefox extensions:
flashblock chatzilla
Configure Inkscape to use SVG properly.
