Datasets:
id stringlengths 6 6 | author stringclasses 55
values | date timestamp[ns] | image_code stringlengths 746 52.3k | license stringclasses 7
values | func_bytes sequencelengths 5 5 | functions sequencelengths 1 32 | comment stringlengths 7 1.29k | header stringlengths 18 169 | body stringlengths 18 2.14k | model_inp stringlengths 30 1.35k | function_frequency int64 1 176 | header_frequency int64 1 16.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
lsfXWH | iq | 2014-05-15T00:14:43 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
3256,
3289,
3316,
3316,
3347
] | [
[
1978,
2039,
2083,
2083,
3254
],
[
3256,
3289,
3316,
3316,
3347
],
[
3348,
3348,
3375,
3375,
3410
],
[
3411,
3411,
3438,
3438,
3473
],
[
3474,
3474,
3501,
3501,
3536
],
[
3537,
3537,
... | // unrolled version of the above
| float SH_0_0( in vec3 s ) { | vec3 n = s.zxy; return k01; } | // unrolled version of the above
float SH_0_0( in vec3 s ) { | 3 | 3 |
4ssSRl | iq | 2014-07-18T08:21:44 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
0,
1196,
1243,
1243,
1363
] | [
[
0,
1196,
1243,
1243,
1363
],
[
1365,
1365,
1422,
1422,
3103
]
] | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | float line( in vec2 a, in vec2 b, in vec2 p )
{ |
vec2 pa = p - a;
vec2 ba = b - a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
return length( pa - ba*h );
} | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | 3 | 5 |
4djXzz | otaviogood | 2014-08-21T06:53:07 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
562,
589,
612,
612,
689
] | [
[
562,
589,
612,
612,
689
],
[
690,
690,
713,
713,
805
],
[
806,
806,
847,
847,
890
],
[
928,
928,
952,
952,
1225
],
[
1226,
1226,
1251,
1251,
1473
],
[
1474,
1474,
1496,
1496,
... | // various noise functions
| float Hash2d(vec2 uv)
{ |
float f = uv.x + uv.y * 47.0;
return fract(cos(f*3.333)*100003.9);
} | // various noise functions
float Hash2d(vec2 uv)
{ | 4 | 17 |
4dBXz3 | iq | 2014-10-24T08:55:07 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1272,
1348,
1388,
1388,
1443
] | [
[
1272,
1348,
1388,
1388,
1443
],
[
1445,
1524,
1564,
1564,
1626
],
[
1628,
1704,
1744,
1744,
1834
],
[
1903,
1903,
1952,
1952,
2072
],
[
2074,
2115,
2179,
2179,
2977
],
[
3046,
3046,
... | // Flip v if in the negative half plane defined by r (this works in 3D too)
| vec2 flipIfNeg( in vec2 v, in vec2 r )
{ |
float k = dot(v,r);
return (k>0.0) ? v : -v;
} | // Flip v if in the negative half plane defined by r (this works in 3D too)
vec2 flipIfNeg( in vec2 v, in vec2 r )
{ | 1 | 1 |
4dBXz3 | iq | 2014-10-24T08:55:07 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1445,
1524,
1564,
1564,
1626
] | [
[
1272,
1348,
1388,
1388,
1443
],
[
1445,
1524,
1564,
1564,
1626
],
[
1628,
1704,
1744,
1744,
1834
],
[
1903,
1903,
1952,
1952,
2072
],
[
2074,
2115,
2179,
2179,
2977
],
[
3046,
3046,
... | // Reflect v if in the negative half plane defined by r (this works in 3D too)
| vec2 reflIfNeg( in vec2 v, in vec2 r )
{ |
float k = dot(v,r);
return (k>0.0) ? v : v-2.0*r*k;
} | // Reflect v if in the negative half plane defined by r (this works in 3D too)
vec2 reflIfNeg( in vec2 v, in vec2 r )
{ | 1 | 1 |
4dBXz3 | iq | 2014-10-24T08:55:07 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1628,
1704,
1744,
1744,
1834
] | [
[
1272,
1348,
1388,
1388,
1443
],
[
1445,
1524,
1564,
1564,
1626
],
[
1628,
1704,
1744,
1744,
1834
],
[
1903,
1903,
1952,
1952,
2072
],
[
2074,
2115,
2179,
2179,
2977
],
[
3046,
3046,
... | // Clip v if in the negative half plane defined by r (this works in 3D too)
| vec2 clipIfNeg( in vec2 v, in vec2 r )
{ |
float k = dot(v,r);
return (k>0.0) ? v : (v-r*k)*inversesqrt(1.0-k*k/dot(v,v));
} | // Clip v if in the negative half plane defined by r (this works in 3D too)
vec2 clipIfNeg( in vec2 v, in vec2 r )
{ | 1 | 1 |
4dBXz3 | iq | 2014-10-24T08:55:07 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2074,
2115,
2179,
2179,
2977
] | [
[
1272,
1348,
1388,
1388,
1443
],
[
1445,
1524,
1564,
1564,
1626
],
[
1628,
1704,
1744,
1744,
1834
],
[
1903,
1903,
1952,
1952,
2072
],
[
2074,
2115,
2179,
2179,
2977
],
[
3046,
3046,
... | // https://www.shadertoy.com/view/slj3Dd
| float sdArrow( in vec2 p, vec2 a, vec2 b, float w1, float w2 )
{ |
const float k = 3.0;
vec2 ba = b - a;
float l2 = dot(ba,ba);
float l = sqrt(l2);
p = p-a;
p = mat2(ba.x,-ba.y,ba.y,ba.x)*p/l;
p.y = abs(p.y);
vec2 pz = p-vec2(l-w2*k,w2);
vec2 q = p;
q.x -= clamp( q.x, 0.0, l-w2*k );
q.y -= w1;
float di = dot(q,q);
q = pz;
q.y -... | // https://www.shadertoy.com/view/slj3Dd
float sdArrow( in vec2 p, vec2 a, vec2 b, float w1, float w2 )
{ | 1 | 2 |
ld2SzK | otaviogood | 2014-10-27T05:24:30 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
2076,
2262,
2316,
2316,
2619
] | [
[
997,
997,
1020,
1020,
1097
],
[
1098,
1098,
1121,
1121,
1213
],
[
1237,
1237,
1260,
1260,
1289
],
[
1290,
1290,
1313,
1313,
1342
],
[
1343,
1343,
1368,
1368,
1397
],
[
1399,
1399,
14... | // This function basically is a procedural environment map that makes the sun
vec3 sunCol = vec3(258.0, 208.0, 100.0) / 4255.0;//unfortunately, i seem to have 2 different sun colors. :(
| vec3 GetSunColorReflection(vec3 rayDir, vec3 sunDir)
{ |
vec3 localRay = normalize(rayDir);
float dist = 1.0 - (dot(localRay, sunDir) * 0.5 + 0.5);
float sunIntensity = 0.015 / dist;
sunIntensity = pow(sunIntensity, 0.3)*100.0;
sunIntensity += exp(-dist*12.0)*300.0;
sunIntensity = min(sunIntensity, 40000.0);
return sunCol * sunIntensity*0.0425;
} | // This function basically is a procedural environment map that makes the sun
vec3 sunCol = vec3(258.0, 208.0, 100.0) / 4255.0;//unfortunately, i seem to have 2 different sun colors. :(
vec3 GetSunColorReflection(vec3 rayDir, vec3 sunDir)
{ | 2 | 8 |
ld2SzK | otaviogood | 2014-10-27T05:24:30 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
2925,
2970,
3032,
3032,
3240
] | [
[
997,
997,
1020,
1020,
1097
],
[
1098,
1098,
1121,
1121,
1213
],
[
1237,
1237,
1260,
1260,
1289
],
[
1290,
1290,
1313,
1313,
1342
],
[
1343,
1343,
1368,
1368,
1397
],
[
1399,
1399,
14... | // This is a spline used for the camera path
| vec4 CatmullRom(vec4 p0, vec4 p1, vec4 p2, vec4 p3, float t)
{ |
float t2 = t*t;
float t3 = t*t*t;
return 0.5 *((2.0 * p1) +
(-p0 + p2) * t +
(2.0 * p0 - 5.0 * p1 + 4.0 * p2 - p3) * t2 +
(-p0 + 3.0 * p1- 3.0 * p2 + p3) * t3);
} | // This is a spline used for the camera path
vec4 CatmullRom(vec4 p0, vec4 p1, vec4 p2, vec4 p3, float t)
{ | 1 | 1 |
ld2SzK | otaviogood | 2014-10-27T05:24:30 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
3242,
3713,
3741,
3741,
4290
] | [
[
997,
997,
1020,
1020,
1097
],
[
1098,
1098,
1121,
1121,
1213
],
[
1237,
1237,
1260,
1260,
1289
],
[
1290,
1290,
1313,
1313,
1342
],
[
1343,
1343,
1368,
1368,
1397
],
[
1399,
1399,
14... | // This spiral noise works by successively adding and rotating sin waves while increasing frequency.
// It should work the same on all computers since it's not based on a hash function like some other noises.
// It can be much faster than other noise functions if you're ok with some repetition.
const float nudge = 0.73... | float SpiralNoiseC(vec3 p)
{ |
float n = 0.0; // noise amount
float iter = 1.0;
for (int i = 0; i < 8; i++)
{
// add sin and cos scaled inverse with the frequency
n += -abs(sin(p.y*iter) + cos(p.x*iter)) / iter; // abs for a ridged look
// rotate by adding perpendicular and scaling down
p.xy += vec2(p... | // This spiral noise works by successively adding and rotating sin waves while increasing frequency.
// It should work the same on all computers since it's not based on a hash function like some other noises.
// It can be much faster than other noise functions if you're ok with some repetition.
const float nudge = 0.73... | 7 | 17 |
ld2SzK | otaviogood | 2014-10-27T05:24:30 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
6229,
6323,
6345,
6345,
7577
] | [
[
997,
997,
1020,
1020,
1097
],
[
1098,
1098,
1121,
1121,
1213
],
[
1237,
1237,
1260,
1260,
1289
],
[
1290,
1290,
1313,
1313,
1342
],
[
1343,
1343,
1368,
1368,
1397
],
[
1399,
1399,
14... | // from a time t, this finds where in the camera path you are.
// It uses Catmull-Rom splines
| vec4 CamPos(float t)
{ |
t = mod(t, 14.0); // repeat after 14 time units
float bigTime = floor(t);
float smallTime = fract(t);
// Can't do arrays right, so write this all out.
if (bigTime == 0.0) return CatmullRom(c00, c01, c02, c03, smallTime);
if (bigTime == 1.0) return CatmullRom(c01, c02, c03, c04, smallTime);
... | // from a time t, this finds where in the camera path you are.
// It uses Catmull-Rom splines
vec4 CamPos(float t)
{ | 1 | 1 |
4dSXDd | otaviogood | 2014-11-27T22:26:38 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
695,
714,
737,
737,
810
] | [
[
695,
714,
737,
737,
810
],
[
811,
811,
834,
834,
905
],
[
906,
906,
929,
929,
1015
],
[
1016,
1016,
1057,
1057,
1100
],
[
1138,
1138,
1162,
1162,
1435
],
[
1436,
1436,
1458,
1458... | // noise functions
| float Hash1d(float u)
{ |
return fract(sin(u)*143.9); // scale this down to kill the jitters
} | // noise functions
float Hash1d(float u)
{ | 6 | 6 |
4dSXDd | otaviogood | 2014-11-27T22:26:38 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
3152,
3681,
3708,
3708,
4272
] | [
[
695,
714,
737,
737,
810
],
[
811,
811,
834,
834,
905
],
[
906,
906,
929,
929,
1015
],
[
1016,
1016,
1057,
1057,
1100
],
[
1138,
1138,
1162,
1162,
1435
],
[
1436,
1436,
1458,
1458... | // This spiral noise works by successively adding and rotating sin waves while increasing frequency.
// It should work the same on all computers since it's not based on a hash function like some other noises.
// It can be much faster than other noise functions if you're ok with some repetition.
const float nudge = 0.71... | float RustNoise3D(vec3 p)
{ |
float n = 0.0;
float iter = 1.0;
float pn = noise(p*0.125);
pn += noise(p*0.25)*0.5;
pn += noise(p*0.5)*0.25;
pn += noise(p*1.0)*0.125;
for (int i = 0; i < 7; i++)
{
//n += (sin(p.y*iter) + cos(p.x*iter)) / iter;
float wave = saturate(cos(p.y*0.25 + pn) - 0.998);
... | // This spiral noise works by successively adding and rotating sin waves while increasing frequency.
// It should work the same on all computers since it's not based on a hash function like some other noises.
// It can be much faster than other noise functions if you're ok with some repetition.
const float nudge = 0.71... | 1 | 2 |
4dSXDd | otaviogood | 2014-11-27T22:26:38 | /*--------------------------------------------------------------------------------------
License CC0 - http://creativecommons.org/publicdomain/zero/1.0/
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This s... | cc0-1.0 | [
4341,
4412,
4444,
4534,
6672
] | [
[
695,
714,
737,
737,
810
],
[
811,
811,
834,
834,
905
],
[
906,
906,
929,
929,
1015
],
[
1016,
1016,
1057,
1057,
1100
],
[
1138,
1138,
1162,
1162,
1435
],
[
1436,
1436,
1458,
1458... | // This is the big money function that makes the crazy fractally shape
| float DistanceToObject(vec3 p)
{ |
if (dot(p, rotDir) > 1.0) p *= rotMat;
// Repeat our position so we can carve out many cylindrical-like things from our solid
vec3 rep = fract(p)-0.5;
//final = max(final, -(length(rep.xz*rep.xz)*1.0 - 0.0326));
float final = -(length(rep.xy*rep.xz) - 0.109);
final = max(final, -(length(rep.zy... | // This is the big money function that makes the crazy fractally shape
float DistanceToObject(vec3 p)
{ | 1 | 6 |
Links
- repository: https://github.com/Vipitis/shadertoys-dataset
- benchmark task: https://github.com/bigcode-project/bigcode-evaluation-harness/pull/173
- leaderboard/demo/metric: https://huggingface.co/spaces/Vipitis/shadermatch
- results dataset: https://huggingface.co/datasets/Vipitis/Shadereval-results
- runs dataset (gated): https://huggingface.co/datasets/Vipitis/Shadereval-runs
Dataset description
467 functions as well as their reference programs, from Shadertoy.com. Sourced from the shaders21k dataset, as well as the public API (for years 2022 and 2023).
Annotated with the following fields:
- id (string): The unique 6 character identifier of the shader program, set by the website when first saving your shader program. To get the source of any shader program can be accessed it via the url
https://www.shadertoy.com/view/<id> - author (string): Unige username of the shader program author.
- date (timestamp[ns]) UNIX-timestamp of when this program was first shadered (saved as non private).
- image_coded (string): GLSL-shaderder code of the Image-renderpass.
- license (string): SPDX license identifier (via scancode-toolkit)
- func_bytes (5tuple(int)): byte indices for where comment starts, ends, header ends, docstring ends, function ends. Parsed with tree-sitter-glsl
- functions (list(5tuple(int))): func_bytes for all functions in this program.
- comment (string): author written code comments immediately before the funciton header
- header (string): function header and initial
{ - body (string): function body
- model_inp (string): comment+header, used for the function completion benchmark
- function_frequency (int): occurances of this function (header+body) in the unfiltered dataset of 202k functions
- header_frequency (int): occurances of this header in the unfiltered dataset of 202k functions
Citation
Please cite the following when using or expanding upon this dataset.
@INPROCEEDINGS{11028297,
author={Kels, Jan and Dahou, Abdelhalim Hafedh and Mathiak, Brigitte},
booktitle={2025 IEEE/ACM International Workshop on Large Language Models for Code (LLM4Code)},
title={Evaluating Language Models for Computer Graphics Code Completion},
year={2025},
pages={96-103},
doi={10.1109/LLM4Code66737.2025.00017},
url={https://doi.org/10.1109/LLM4Code66737.2025.00017}
}
A recording of the presentation can be found on the conference website.
Usage
Exclusively used for a Function Completion benchmark, using the model_inp field and evaluated using the shadermatch metric.
revisions
these are historic revisions used for steps during the development
v0.3
contains 394 functions gathers from shaders20k (years 2013-2021) and the Shadertoy.com API (years 2022-2023). All programs went through a assemble of filters. Then parsed to functions and additional filters were applied.
All functions are run with wgpu-shadertoy using the wgpu-py PR branch that updates to wgpu-native 22.1 ref, and then confirmed to be needed (it errors when the funciton is omitted).
the columns model_inp contains the comment just before the function as well as the header.
v0.2
257 functions from shaders20k through various filters ref run with wgpu-py 0.16.0 and wgpu-shadertoy on this commit. Used for input experiments.
LICENSE information
please look at the license column in each row for an SPDX license tag of that individual program. You should also see the exact license text at the beginning of image_code as a comment.
- Downloads last month
- 46