quine golf 2: surface shader boogaloo, 55x55 3019B

This commit is contained in:
Crispy 2024-08-13 20:04:30 +02:00
parent c1df57a20b
commit 2680a70a20
6 changed files with 111 additions and 9 deletions

View file

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: QuineSurface
m_Shader: {fileID: 4800000, guid: 5bd1d031163240cafb58059c2b6286f2, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a912cfd0d29b182919c919ffe9311039
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,2 @@
Shader"h"{Properties{_t("",2D)=""}SubShader{CGPROGRAM #pragma surface s Standard
struct Input{float2 uv_t;};void s(Input u,inout SurfaceOutputStandard o){const uint t[]={0x2f00576f,0x33f2daf7,0x3b3e892f,0x341ab0cd,0x39140cc6,0x3642f521,0x53b01103,0x5843a14b,0x22a54455,0x5d855ba6,0x607b6a2b,0x401f30ed,0x1adde055,0x276739b0,0x46cee37b,0x70bc799e,0x73a439b4,0x208fff2e,0x4095ea40,0x78656b73,0x011e2b7b,0x7d997ab9,0x44c9692f,0x7699f55b,0x011b0aee,0x3e24e313,0x5889a37d,0x25db0c8a,0x58b8d37b,0x70bc799e,0x00c6903d,0x3e733d70,0x58c34670,0x438677b7,0x56037f75,0x53b5cea3,0x09ebc134,0x2c299338,0x18f6ebf7,0x0eb63932,0x09dc5151,0x029203e4,0x0c7d1484,0x13bec954,0x2c1174d6,0x161877a3,0x09e3ef55,0x2c294923,0x160184a7,0x111eec27,0x11a3ebf4,0x0c6445a2,0x09eb29f4,0x2c28e4d3,0x2c390136,0x0a123ea7,0x111f0488,0x0cc21df7,0x139099a2,0x09cc02f6,0x141550f2,0x1136a457,0x09d562a1,0x1640315a,0x2c28fba1,0x2c11a68a,0x075c9393,0x112f6cd1,0x2c313093,0x0509aba3,0x02a7e2a9,0x2c11a4a3,0x1155e9a8,0x079249a2,0x04ea5027,0x09e502a4,0x09dc0662,0x09d562f2,0x09cccc89,0x2c11a4aa,0x02b07fa2,0x04f24ff3,0x0f32ebfa,0x111eeea3,0x077a2b35,0x07e036f9,0x11a450e9,0x13bf9342,0x1136a689,0x0a0c1344,0x04fa515a,0x2c294926,0x163866a3,0x07919b3a,0x141538d6,0x0a1289a2,0x051112f9,0x04eb92a3,0x1881d4a8,0x0cc1d2aa,0x0ec70485,0x1147a2f8,0x079a0142,0x13af2b87,0x16394344,0x161124a6,0x0799a0a2,0x09d3eb53,0x2c11748a,0x0ed57ba4,0x07630548,0x18f70502,0x05195f55,0x1685d4d2,0x0ee57a56,0x2c219185,0x079b13e7,0x13af5d42,0x13a03a39,0x2c30b439,0x2c01d2a9,0x0791e9a8,0x07a1b7e2,0x18739393,0x111fcb43,0x2c40b881,0x0ef470a3,0x04f1ba41,0x02888ea2,0x09d3eb51,0x2c0a2134,0x02a1a484,0x13b7daa2,0x2c115b37,0x02841b00,0x78656b73,0x00ce7d76,0x596d96a7,0x0ed9e65c,0x7120f422,0x89c43af1,0x2db2aa56,0x8e2966d8,0x90fdc7cc,0x8c3030e6,0x7d5f59cc,0x94fd525e,0x983ee7f3,0x0c7e903d,0x53f6fec2,0x13931d02,0x0671bfad,0x99ecd2bd,0x9bbbb78b,0x06e6efc2,0x04f029a9,0xa216e35f,0x4630f481,0x529ca2d5,0x96cc99bc,0x4c1a6d11,0x979fca35,0x976e408b,0x0673dfe1,0x474477fc,0x53f6ff12,0x13931a33,0x02b057fd,0x53da0d03,0x10491019,0x343a0022,0x10373fb5,0x7d639591,0x21cbc4d1,0x7ceedaa9,0x0402ecf2,0x4c7f785c,0x8c303163,0x89c4af56,0x2b5b4287,0x12a7f209,0x78003b79,0x53f9bbb6,0x52428f4d,0x83478ee8,0x91cdb101,0x9772a634,0xa972a903,0x55730000},R[]={0,234663,68679,2265159,3280003,5348,7376003,3185831,233604,6592806,6600966,2234534,34023,6182,8665390,6601774,4267074,301257,65,6330631,1088809,6210,337920,4262980,7642145,206118,3312673,72774,1049633,133250,31,2130978,3319079,1116225,229600,2240642,5286,6587686,6337838,3312809,6595878,2270697,585393,11512810,12923174,11953,7465,272866,7407687,33826,5282,131202,3179555,3213379,32,166048,18157905,567428,567426,72768,7168,1118273,72955190,4260932,9570592,211030020,131200,266305,7375911,306601};float2 p=u.uv_t*55;uint c,X=p.x,Y=p.y,i=X+(54-Y)*55;if(i>169&&i<2248){c=(i-170)%11;c=c<2?(c<<4)+1:c==10?18:(t[(i-170)/11]>>(7-(c-2)&7)*4&15)+1;}else{i-=(i>170)*2077;c=t[i/5];for(i%=5;i<4;i++)c/=80;c%=80;}Y=(p.y-Y)*6;X=(p.x-X)*6;o.Albedo=(X<5)*R[c]>>(X+Y*5)&1;}ENDCG}}

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5bd1d031163240cafb58059c2b6286f2
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,5 @@
const uint t[]={0x2f00576f,0x33f2c1f7,0x2f1fb204,0x1b49dda7,0x3d618237,0x42c83a2e,0x4541a121,0x53a72e14,0x1adea1c5,0x5d3cd90b,0x603c289b,0x568d5310,0x339e664f,0x62d0e527,0x51d53c3a,0x3b06de0b,0x62ec13db,0x45bce019,0x620fc24a,0x5d6c6c36,0x00f4742a,0x70a7a790,0x5bc6aa73,0x76b38992,0x7d04286b,0x5cdd77af,0x793c758e,0x4a25d683,0x6a865f87,0x8a7a6d41,0x80979732,0x3e5dcab0,0x7aab42e2,0x4386c736,0x8f2b05f5,0x3b014639,0x38a8286b,0x5cdd77af,0x793c758e,0x4a25d683,0x285ca196,0x0c38abc3,0x8ce0fa73,0x76b38992,0x7dd7e131,0x8802215d,0x793c7e9e,0x6a7c4ea1,0x8951495d,0x7fe41a29,0x005bbcb0,0x5c2c10d0,0x71e0b2d0,0x79542e24,0x78f372b0,0x7aab42e2,0x4386c736,0x9131fc1b,0x7b8dda68,0x76bb5f80,0x4d905394,0x89a6a269,0x6a7fa4e2,0x7227c8a2,0x76b440b0,0x7b8dd81f,0x966a1e78,0x8cc22484,0x831d7ba1,0x3e5dca93,0x793a255e,0x91784c1e,0x6f044498,0x6546356c,0x9cb68111,0x712516f2,0x3e72fc95,0x6f03fc1e,0x6e9eb2bd,0x3c2881d6,0x3b3ff82e,0x7e49bd4e,0x1c044410,0x91c85dac,0x735912b1,0x1b827fd6,0x38911a9a,0x5cc864f8,0x5cc9ca92,0x9a885fbd,0xa0bace31,0x2c09d597,0x11380439,0x11567fa3,0x078a46a6,0x18f704f9,0x0278ea52,0x0ec5bfe2,0x13a80a31,0x02920342,0x1628c242,0x2c09d547,0x0299d436,0x18825157,0x2c295f51,0x18a164a3,0x0772bee4,0x0cc20591,0x07740432,0x161234d7,0x11464721,0x2c295f52,0x13c702a5,0x078a7858,0x0cc20452,0x0782ada7,0x0f335044,0x02a814b2,0x04eab3d9,0x02c0e433,0x04eb9344,0x13d66b62,0x0c4d1ffa,0x160293e3,0x16317487,0x0c4ca396,0x2c020543,0x0eaf9436,0x163831d7,0x2c291548,0x161926a4,0x09d3edd1,0x18f750ea,0x0eed1ae2,0x076b3857,0x18aa43e9,0x0ec63b52,0x04f236a3,0x1608bea4,0x09d3ed38,0x0a50d2fa,0x07727485,0x2c01d526,0x0a5136f9,0x07e068f8,0x13b0d2f8,0x079a0142,0x13afc0f2,0x04ea5027,0x09e50344,0x161124a4,0x02988df3,0x2c219185,0x078b7343,0x2c098b32,0x052a12a4,0x04f98962,0x13af2b87,0x163942f4,0x050a0a62,0x09cc8131,0x056ed342,0x075b20a8,0x0a031922,0x056ed4d2,0x0ee57a56,0x2c11a4aa,0x02b07fa6,0x1155fdf9,0x2c1177a6,0x13afdad9,0x2c09bc91,0x113e60a3,0x05015c28,0x1685d2a2,0x112ebcf2,0x09e42242,0x2c02392a,0x0c83b932,0x076b6c31,0x02fdeb5a,0x18822192,0x09d46b26,0x0ed6a343,0x0501a68a,0x2c025131,0x0c7d1483,0x13bf96a8,0x051996a2,0x04f281f8,0x0a5168fa,0x0ed51521,0x2c195d31,0x188990aa,0x0ee49aea,0x07dfeba2,0x02905953,0x02fded37,0x09cc7853,0x285ca196,0x075665db,0x6e9f0d35,0x7d428da6,0x006762cf,0x54633ed7,0x9add12d2,0x660a727b,0x113d0e6c,0xa3ca3d19,0x28e106e5,0x0c72b559,0xafe78baa,0x933108eb,0x66348e98,0x94b682d3,0x21aa8b83,0xb6784bc8,0x0e1064cf,0x21af57a1,0xb4ba8feb,0x5ec7a015,0x0c5ceb0b,0x04f82826,0x90504f7d,0xa8926238,0x94880332,0x108164d3,0x8e13522f,0x396e20eb,0x663c5e98,0x9487bd88,0x08e2c8d6,0x9ff8a522,0x7d0484cb,0x66597913,0x664c0d19,0xa81d205b,0x9a1578fd,0xb4261183,0x8f4de992,0x6f3b8e6c,0xa3cebbcf,0x91190a95,0x83404d63,0x33bded95,0x637a3386,0x948a595d,0xa34bc8a5,0xa7b83d1c,0xad6bad54,0x7bba8bfa,0x8f5f2000,}; const uint t[]={0x2f00576f,0x33f2daf7,0x3b3e892f,0x341ab0cd,0x39140cc6,0x3642f521,0x53b01103,0x5843a14b,0x22a54455,0x5d855ba6,0x607b6a2b,0x401f30ed,0x1adde055,0x276739b0,0x46cee37b,0x70bc799e,0x73a439b4,0x208fff2e,0x4095ea40,0x78656b73,0x011e2b7b,0x7d997ab9,0x44c9692f,0x7699f55b,0x011b0aee,0x3e24e313,0x5889a37d,0x25db0c8a,0x58b8d37b,0x70bc799e,0x00c6903d,0x3e733d70,0x58c34670,0x438677b7,0x56037f75,0x53b5cea3,0x09ebc134,0x2c299338,0x18f6ebf7,0x0eb63932,0x09dc5151,0x029203e4,0x0c7d1484,0x13bec954,0x2c1174d6,0x161877a3,0x09e3ef55,0x2c294923,0x160184a7,0x111eec27,0x11a3ebf4,0x0c6445a2,0x09eb29f4,0x2c28e4d3,0x2c390136,0x0a123ea7,0x111f0488,0x0cc21df7,0x139099a2,0x09cc02f6,0x141550f2,0x1136a457,0x09d562a1,0x1640315a,0x2c28fba1,0x2c11a68a,0x075c9393,0x112f6cd1,0x2c313093,0x0509aba3,0x02a7e2a9,0x2c11a4a3,0x1155e9a8,0x079249a2,0x04ea5027,0x09e502a4,0x09dc0662,0x09d562f2,0x09cccc89,0x2c11a4aa,0x02b07fa2,0x04f24ff3,0x0f32ebfa,0x111eeea3,0x077a2b35,0x07e036f9,0x11a450e9,0x13bf9342,0x1136a689,0x0a0c1344,0x04fa515a,0x2c294926,0x163866a3,0x07919b3a,0x141538d6,0x0a1289a2,0x051112f9,0x04eb92a3,0x1881d4a8,0x0cc1d2aa,0x0ec70485,0x1147a2f8,0x079a0142,0x13af2b87,0x16394344,0x161124a6,0x0799a0a2,0x09d3eb53,0x2c11748a,0x0ed57ba4,0x07630548,0x18f70502,0x05195f55,0x1685d4d2,0x0ee57a56,0x2c219185,0x079b13e7,0x13af5d42,0x13a03a39,0x2c30b439,0x2c01d2a9,0x0791e9a8,0x07a1b7e2,0x18739393,0x111fcb43,0x2c40b881,0x0ef470a3,0x04f1ba41,0x02888ea2,0x09d3eb51,0x2c0a2134,0x02a1a484,0x13b7daa2,0x2c115b37,0x02841b00,0x78656b73,0x00ce7d76,0x596d96a7,0x0ed9e65c,0x7120f422,0x89c43af1,0x2db2aa56,0x8e2966d8,0x90fdc7cc,0x8c3030e6,0x7d5f59cc,0x94fd525e,0x983ee7f3,0x0c7e903d,0x53f6fec2,0x13931d02,0x0671bfad,0x99ecd2bd,0x9bbbb78b,0x06e6efc2,0x04f029a9,0xa216e35f,0x4630f481,0x529ca2d5,0x96cc99bc,0x4c1a6d11,0x979fca35,0x976e408b,0x0673dfe1,0x474477fc,0x53f6ff12,0x13931a33,0x02b057fd,0x53da0d03,0x10491019,0x343a0022,0x10373fb5,0x7d639591,0x21cbc4d1,0x7ceedaa9,0x0402ecf2,0x4c7f785c,0x8c303163,0x89c4af56,0x2b5b4287,0x12a7f209,0x78003b79,0x53f9bbb6,0x52428f4d,0x83478ee8,0x91cdb101,0x9772a634,0xa972a903,0x55730000}
b=447; b=170;
uint magic_number_L_plus_b= 3219; uint magic_number_L_plus_b= 2248;
uint magic_number_L= 2772; uint magic_number_L= 2077;
const uint R[]={0,234663,68679,2265159,3280003,5348,7376003,3185831,233604,6592806,6600966,2234534,34023,6182,8665390,6601774,4267074,301257,65,6330631,1088809,6210,337920,4262980,5286,7642145,133250,6587686,6337838,3312809,6595878,2270697,585393,11512810,3312673,12923174,11953,5282,72774,272866,7465,1049633,33826,304422,567426,32,206118,131200,7407687,231490,306601,131202,7375911,18157905,3319079,567428,31,574788,2240642,2130978,1116225,33831,15994959,229600,2099267,3179555,3213379,166048,72768,7168,1118273,72955190,4260932,9570592,211030020,266305}; const uint R[]={0,234663,68679,2265159,3280003,5348,7376003,3185831,233604,6592806,6600966,2234534,34023,6182,8665390,6601774,4267074,301257,65,6330631,1088809,6210,337920,4262980,7642145,206118,3312673,72774,1049633,133250,31,2130978,3319079,1116225,229600,2240642,5286,6587686,6337838,3312809,6595878,2270697,585393,11512810,12923174,11953,7465,272866,7407687,33826,5282,131202,3179555,3213379,32,166048,18157905,567428,567426,72768,7168,1118273,72955190,4260932,9570592,211030020,131200,266305,7375911,306601};

View file

@ -82,7 +82,8 @@ fn main() {
fn golfed() { fn golfed() {
// source code conversion // source code conversion
let source_text = read_to_string("../Assets/test/quine_golf.shader").unwrap(); // let source_text = read_to_string("../Assets/test/quine_golf.shader").unwrap();
let source_text = read_to_string("../Assets/test/QuineSurface.shader").unwrap();
let mut encoded_text: Vec<u32> = Vec::new(); let mut encoded_text: Vec<u32> = Vec::new();
let mut temp = 0; let mut temp = 0;
let mut i = 0; let mut i = 0;
@ -120,13 +121,14 @@ fn golfed() {
for t in &encoded_text { for t in &encoded_text {
out_string += &format!("{t:#010x},"); out_string += &format!("{t:#010x},");
} }
out_string += "};\n"; out_string.pop();
out_string += "}\n";
out_string += &format!("b={blob_start};\n"); out_string += &format!("b={blob_start};\n");
out_string += &format!( out_string += &format!(
"uint magic_number_L_plus_b= {};\n", "uint magic_number_L_plus_b= {};\n",
encoded_text.len() * 11 + blob_start encoded_text.len() * 11 + blob_start - 1
); );
out_string += &format!("uint magic_number_L= {};\n", encoded_text.len() * 11); out_string += &format!("uint magic_number_L= {};\n", encoded_text.len() * 11 - 2);
// font // font
let img = ImageReader::open("6x6.png").unwrap().decode().unwrap(); let img = ImageReader::open("6x6.png").unwrap().decode().unwrap();