I have been reading and writing both GLSL and CG for the past few years, and have noticed a trend. In programming, we are generally advised to be as meaningful and concise as possible with variable names, but I see this rule to be brokensuggestion being ignored almost every time I look at shaders.
Here is a random example I grabbed off of Shadertoy:
vec3 tex_wmcs(vec2 p)
{
float s=mix(0.2,1.2,sqrt(smoothNoise2(p*3.0)));
vec3 col=mix(vec3(0.15,0.2,0.2)*0.4,vec3(0.2,0.15,0.11)*0.7*s,sqrt(max(0.0,sm...
vec2 p2=p*vec2(4.0,10.0)+vec2(smoothNoise2(p*24.0),smoothNoise2...
p2.x+=floor(p2.y)*0.5;
float bh=pow(0.5+0.5*cos(floor(p2.y)*14.0)*cos(floor(p2.x)*1.0),2.0);
float brick=brickt(p2);
vec3 bn=normalize(vec3(brickt(p2+vec2(1e-3,0.0))-brick,b...
...
}
Why doIs there a practical reason so many graphics programmers like to minify their code to thesuch a point that it is no longer comprehensible by someone else at first glance? I have not worked in a production environment so I can't say that this is how every graphics programmer codes, but it is an observation.
Is there a downsidetechnical downside to spelling out brickNormal instead of lazily leaving it as bn? And, or using brick_tangent or brickTexture instead of brickt? Brick tangent? Brick texture?
Are there any practical or technical reasons today as for why this is done?