3 ms·
This is a great look into Feistel networks! One thing: > Doing this with a pseudo random generator, as noted in the blog post, is slow, but is also visually v
by fpgaminer 9y ago
This is a great look into Feistel networks!
One thing:
> Doing this with a pseudo random generator, as noted in the blog post, is slow, but is also visually very unpleasant, since the more red pixels you have on the screen already, the less likely is that you hit a new yet-not-red pixel, so the final pixels take forever to turn red
I'm not sure if the author of this article was confused by the original article, or if the wording is just weird here, but...
The original article presents Wolfenstein's algorithm which _is_ fast and efficient, and which fills the screen lineraly. It visits each pixel on the screen, in random order, exactly once. And it does it using just a conditional and an XOR.
The technique scales to any resolution (we have maximum-length LFSR for any number of bits you'd need).
So there were no problems to be solved here. Wolfenstein already solved them.
Feistel networks are interesting, but ... they don't solve this problem any better than Wolfenstein's LFSR technique. Both can scale to any resolution in exactly the same way. But Feistel networks are terribly inefficient for this task. It's hard to beat a conditional + XOR per pixel.
- antirez 9y ago> I'm not sure if the author of this article was confused by the original article, or if the wording is just weird here, but... Hello, yes probably I was not clear, I was trying to say why both the original article referred code, and my approach, was no just setPixel(rand(),rand()). About my approach, what it solves is that you can do that for any resolution without finding a max length LFSR of the appropriate size. See the section of the original article where ports are mentioned.
- fpgaminer 9y ago> About my approach, what it solves is that you can do that for any resolution without finding a max length LFSR of the appropriate size. https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Some_polynomials_for_maximal_LFSRs https://en.wikipedia.org/wiki/Linear-feedback_shift_register... We have LFSRs for ... well more than anyone could ever need. EDIT: To be clear, I still think your article is really cool and useful for bringing up the topic of Feistel networks!
- wyldfire 9y agoBut I guess the point is that each of those LFSRs have a different polynomial and this is a general solution. The context is related to these notes [1]: > Note : Because the effect works by plotting pixels individually, it was hard to replicate when developers tried to port the game to hardware accelerated GPU. None of the ports managed to replicate the fizzlefade except Wolf4SDL, which found a LFSR taps configuration to reach resolution higher than 320x200. > Note : The tap configuration on 17 bits generates 131,072 values before cycling. Since 320x200=64000, it could have been implemented with a 16 bits Maximum-length register with taps on 16,15,13 and 4 (in "Galois" notation.). My assumption is that LFSR literature was hard to come across in 1991/1992 and finding the correct tap for a 16 bit maximum length register was not worth the effort. [1] http://fabiensanglard.net/fizzlefade/index.php http://fabiensanglard.net/fizzlefade/index.php