Live data from Hacker News

Writing a winning 4K intro in Rust

codeslow.com

81–90 of 94 posts

Re: Writing a winning 4K intro in Rust

#81
post #35

Earlier quoted context omitted.

"On the one hand, I found a program that does exactly what we need. On the other hand, not-quite-dressed anime characters..." I've had this exact conversation with coworkers before.

Which program?

"For research purposes.. of course..."

Re: Writing a winning 4K intro in Rust

#82

Does someone know what the problem is with the intrinsics? Or is there a problem? The author states that this breaks his debug build for some reason.

I think the author called _mm_load_ps() on a pointer that isn’t 16-bit aligned. Either change that to _mm_loadu_ps() (which also works on unaligned pointers but incurs a performance penalty), or make sure your object is aligned when doing the heap allocation (there’s a STL function called aligned_alloc() in C++, probably there’s something similar in Rust)

Why would that only fail on debug builds and not release builds, though? That seems really strange to me

Re: Writing a winning 4K intro in Rust

#83
post #82

Earlier quoted context omitted.

I think the author called _mm_load_ps() on a pointer that isn’t 16-bit aligned. Either change that to _mm_loadu_ps() (which also works on unaligned pointers but incurs a performance penalty), or make sure your object is aligned when doing the heap allocation (there’s a STL function called aligned_alloc() in C++, probably there’s something similar in Rust)

Why would that only fail on debug builds and not release builds, though? That seems really strange to me

Debug and release builds probably call slightly different sets of methods, so they might end up with slightly different heaps. That might be enough to cause a difference in offset between the builds.

Re: Writing a winning 4K intro in Rust

#84
post #5

Kinda surprised about iterators not getting optimized so well. Even in higher-level languages, this is a commonly utilized optimization opportunity - e.g. the C# compiler will replace a foreach-loop over an array with an identical (but faster) for-loop.

This isn't a case of a missed optimization. The alternative loop they've used has different semantics: assumes 0 iterations never happen. It's equivalent of changing `while(){}` to `do {} while()`. It's not something an optimizer could safely do when the number of iterations isn't known.

Re: Writing a winning 4K intro in Rust

#85
post #33

I love the demo scene, but the culture is kind of strange. Like I've been fooling around with the C64, and all the tools (emulators, debuggers, and etc) are hosted on source forge, or sometimes this random ftp. The author of the debugger I'm using proudly proclaims that he only works on it when he's fucked up on drugs after parties. The documentation of some tools has lewd ascii art, and etc etc. I appreciate the ant…

I think that's truly fantastic.

Re: Writing a winning 4K intro in Rust

#86

Earlier quoted context omitted.

Well, of course. A “professional” does not (cannot) behave professionally 100% of the time, the idea is that when doing work that interacts with others, that’s when you’re more professional.

I never have that requirement for any community I want to take part in to be honest. If I don't like it, I am going to look elsewhere. What I consider unprofessional for example is banning people from your service because a mob demands it. Paypal is an example of a service for financial transactions that banned users fallen out of good faith. Here professional distance would actually make sense. Imagine IT services g…

That's down to you having a different set of bad experiences than others. There's room for both of those things to be wrong, I think over time you get a broader and hopefully more nuanced sense for what kind of behavior is unprofessional and not beneficial to the social order of a project.

Re: Writing a winning 4K intro in Rust

#87

That intro was very cool! Does anyone have pointers for a fullstack web dev who is interested in the demoscene (or computer generated art in general)? I've actually played around a bit with rust [1] (I understand it probably isn't ideal for demoscence), but I haven't really done any graphics programming before. I get the feeling it is a pretty deep rabbit hole. [1] https://github.com/dwaltrip/advent-of-code-2019-rust

If you're a web dev, then may be the obvious option to get started! There's a fairly large creative coding community. The Coding Train on youtube has a ton of content [0]. If you really want to start from the beginning then I would also recommend Coding Math on YouTube [1], which is sort of graphics from first principles using JS/canvas. That even starts with teaching trigonometry, vectors, etc. So if your math is ru…

Thanks! I’ll check it out.

Re: Writing a winning 4K intro in Rust

#88

That intro was very cool! Does anyone have pointers for a fullstack web dev who is interested in the demoscene (or computer generated art in general)? I've actually played around a bit with rust [1] (I understand it probably isn't ideal for demoscence), but I haven't really done any graphics programming before. I get the feeling it is a pretty deep rabbit hole. [1] https://github.com/dwaltrip/advent-of-code-2019-rust

In this intro and in almost every modern 4kB intro, the graphics are made in a shader. To play with shaders, I'd recommend you to look at https://www.shadertoy.com/ . Check also Inigo Quilez's website ( https://www.iquilezles.org/ ), it has a lot of fascinating content.

Thanks for the links! Very helpful

Re: Writing a winning 4K intro in Rust

#89
post #41

That intro was very cool! Does anyone have pointers for a fullstack web dev who is interested in the demoscene (or computer generated art in general)? I've actually played around a bit with rust [1] (I understand it probably isn't ideal for demoscence), but I haven't really done any graphics programming before. I get the feeling it is a pretty deep rabbit hole. [1] https://github.com/dwaltrip/advent-of-code-2019-rust

Javascript demos is one option https://www.dwitter.net/

That site looks pretty cool! Some very nice animations on there.

Re: Writing a winning 4K intro in Rust

#90
post #34

That intro was very cool! Does anyone have pointers for a fullstack web dev who is interested in the demoscene (or computer generated art in general)? I've actually played around a bit with rust [1] (I understand it probably isn't ideal for demoscence), but I haven't really done any graphics programming before. I get the feeling it is a pretty deep rabbit hole. [1] https://github.com/dwaltrip/advent-of-code-2019-rust

> but I haven't really done any graphics programming before I've never written any demos but do enjoy playing with GPUs. Regarding anything and everything graphics related, try not to get overwhelmed by modern APIs; it's very easy to lose the forest for the trees. Shadertoy is a really good starting point. My impression of the demoscene can be loosely summarized as extreme code golf for graphics and sound.

That all makes sense. Thanks for the advice.
Post reply on HN