Remix.run Logo
reactordev 15 hours ago

I’m not a fan of the minified glsl that guys like this produce but I do get a chuckle when variable declarations spell out damnit. The frustrations are real.

That aside, i love the work, I just hate having to mentally grok the d and c style variables. As if number of chars minimum is the goal. Number of instructions yes, but we can do better than d and t.

Moonlight is beautiful.

jesse__ 12 hours ago | parent | next [-]

If there was some absolute measure of program 'interestingness'/'readability', programs found on shadertoy would no doubt have an asymptotically high score.

My theory is that graphics programmers, at some point, stop having to care very much about what the textual representation of their program actually looks like. Because graphics programming is so hard, once you get to the point of understanding what you're doing, and typing in the shader, it becomes self-explanatory; you don't actually need variable names, what you need is understanding.

Inigo Quilez (author of shadertoy, and graphics programming legend) is one of the most talented graphics programmers alive, and produces some of the least readable code I've ever seen.

Just my 2c on why this is so common in graphics, specifically

ludicrousdispla 2 hours ago | parent | next [-]

It probably helps someone be more prolific when they can't understand what they did last week.

Agentlien 7 hours ago | parent | prev | next [-]

As a graphics programmer this doesn't ring true to me.

Using more readable names definitely helps during development. I think the cause of this is twofold.

First, there's a lot of equations used in graphics programming where the canonical names of variables are single letters. If you know the formula a single letter is a good name and it is expected that others reading it also understand it - if you didn't you'd have to read up on the formula anyway.

But beyond that I also think it's a bit of misguided pride. Thinking it's cool to have as minimal inscrutable shader code as possible because that's trendy. It's very common for shaders to be developed with reasonable names and good layout then rewritten before publishing like it was an IOCCC entry.

reactordev 11 hours ago | parent | prev [-]

I am a graphics programmer. It still enrages me to see those variables but (but) I understand that most of the time, it’s that way in the math. So the math variable becomes the shader variable name. Ugh. I love me a good float lut = lut_equation(uv, lutTex) * lut_factor.r

jesse__ 8 hours ago | parent [-]

Fair enough :)

hansvm 6 hours ago | parent | prev [-]

> number of chars minimum not the goal

For my tastes this is excessive (especially since the formatting is non-existent), but you do pay a cost for longer variable names. There's only so much you can grok when reading a passage, and long names hinder any higher-level understanding of what that passage actually does, requiring you to resort to carefully thinking about the problem rather than any shortcuts and insights your powerful visual cortex might provide.