{"id":11060,"date":"2023-11-22T00:14:41","date_gmt":"2023-11-21T16:14:41","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11060"},"modified":"2023-11-22T00:18:44","modified_gmt":"2023-11-21T16:18:44","slug":"cube-lut-colormapfilter-pixijs","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2023\/11\/cube-lut-colormapfilter-pixijs\/","title":{"rendered":"cube\u683c\u5f0f\u7684LUT\u6ee4\u955c\u4e5f\u53ebColorMapFilter\u5728pixi\u4e2d\u5e94\u7528"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11060\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11060<\/a> \u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202311-pixi-cube.png';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/cute-cover.png\" width=\"318\" height=\"197\" alt=\"cube\u6587\u4ef6\u793a\u610f\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u5173\u4e8eLUT\u6ee4\u955c<\/h3>\n<p>\u63a5\u4e0a\u7bc7\u6587\u7ae0\uff0c\u8bb2\u8bb2\u5404\u7c7b\u89c6\u9891\u526a\u8f91APP\u4e2d\u6ee4\u955c\u6548\u679c\u5728Web\u4e2d\u7684\u5b9e\u73b0\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/2023-11-19_224155.jpg\" width=\"524\" height=\"243\" alt=\"\u526a\u6620\u4e2d\u7684\u6ee4\u955c\" class=\"alignnone size-medium\"><\/p>\n<p>\u8fd9\u79cd\u6ee4\u955c\u5176\u5b9e\u4e5f\u5206\u4e3a\u4e24\u5927\u7c7b\uff0c\u4e00\u7c7b\u662f\u7b97\u6cd5\u6ee4\u955c\uff0c\u4f8b\u5982\u9ad8\u65af\u6a21\u7cca\uff0c\u53cd\u76f8\uff0c\u8272\u8c03\u53d8\u5316\uff0c\u672c\u8d28\u4e0a\u662f\u6570\u5b66\u8ba1\u7b97\uff0c\u4f8b\u5982<a href=\"https:\/\/github.com\/pixijs\/filters\" target=\"_blank\" rel=\"nofollow noopener\">pixijs\/filters<\/a>\u8fd9\u4e2a\u9879\u76ee\u4e2d\u7684ColorMatrixFilter\u7c7b\u6548\u679c\u5c31\u662f\u901a\u8fc7\u77e9\u9635\u53d8\u6362\u8ba1\u7b97\u5b9e\u73b0\u7684\u3002<\/p>\n<p>\u8fd9\u7c7b\u6ee4\u955c\u7684\u7b97\u6cd5\u56fa\u5b9a\uff0c\u4f7f\u7528\u7b80\u5355\uff0c\u4f46\u662f\u6548\u679c\u5355\u4e00\uff0c\u4e0d\u591f\u4e30\u5bcc\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u7c7b\u5c31\u662f\u672c\u6587\u8981\u4ecb\u7ecd\u7684\u989c\u8272\u6620\u5c04\u6ee4\u955c\uff0c\u4e5f\u53ebLUT\u6ee4\u955c\uff0cLUT\u662fLook Up Table\u7684\u7f29\u5199\uff0c\u4e2d\u6587\u53eb\u67e5\u627e\u8868\uff0c\u4e5f\u53eb\u989c\u8272\u6620\u5c04\u8868\uff0c\u5728<a href=\"https:\/\/github.com\/pixijs\/filters\" target=\"_blank\" rel=\"nofollow noopener\">pixijs\/filters<\/a>\u8fd9\u4e2a\u9879\u76ee\u4e2d\u4f7f\u7528ColorMapFilter\u65b9\u6cd5\u5b9e\u73b0\uff0c\u8fd9\u7c7b\u6ee4\u955c\u6548\u679c\u4e30\u5bcc\uff0c\u7ec6\u8282\u7ec6\u817b\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5de5\u4e1a\u7535\u5f71\u4e00\u822c\u7684\u89c6\u89c9\u8d28\u611f\u3002<\/p>\n<p>LUT\u6ee4\u955c\u591a\u4ee5.cube\u6216.3dl\u540e\u7f00\u7ed3\u5c3e\uff0c\u6709\u6587\u672c\u548c\u56fe\u7247\u4e24\u79cd\u5f62\u5f0f\uff0c\u4e92\u76f8\u662f\u53ef\u4ee5\u8f6c\u6362\u7684\u3002<\/p>\n<p>\u6587\u672c\u683c\u5f0f\u7684LUT\u6ee4\u955c\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre>\r\n# Created by Adobe Photoshop CC 2019.0.1\r\nTITLE \"Adobe Photoshop CC 2019.0.1\"\r\nLUT_3D_SIZE 33\r\n0.000000 0.000000 0.000000\r\n0.000000 0.000000 0.000000\r\n...\r\n<\/pre>\n<p>\u5305\u542b\u6807\u9898\u3001\u5c3a\u5bf8\u548c\u8be6\u7ec6\u7684\u989c\u8272\u6620\u5c04\u4fe1\u606f\u3002<\/p>\n<p>\u56fe\u7247\u683c\u5f0f\u7684LUT\u6ee4\u955c\u6587\u4ef6\u591a\u8868\u73b0\u4e3a\u6e10\u53d8\u5f69\u8272\u8272\u5757\uff0c\u6709\u65b9\u7684\uff0c\u6a2a\u7684\uff0c\u8fd8\u6709\u7ad6\u7684\uff0c\u4f8b\u5982\uff0817*17*17\u5c3a\u5bf8\u5927\u5c0f\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/2023-11-21_163945.png\" alt=\"LUT\u6ee4\u955c\u56fe\u7247\u793a\u610f\" width=\"305\" height=\"29\"><\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u901a\u5e38\u7684WebGL JS\u5e93\u4e2d\uff0c\u90fd\u662f\u4f7f\u7528\u6a2a\u5411\u7684LUT\u6ee4\u955c\u56fe\u7247\uff0c\u4f8b\u5982pixijs\/filters\u9879\u76ee\u4e2d\u7684ColorMapFilter\u7c7b\uff0c\u4f7f\u7528\u7684\u5c31\u662f\u6a2a\u5411\u7684LUT\u6ee4\u955c\u56fe\u7247\u3002<\/p>\n<p>\u5173\u4e8eLUT\u6ee4\u955c\u66f4\u591a\u7684\u77e5\u8bc6\u53ef\u4ee5\u53c2\u8003\u62114\u5e74\u524d\u5199\u7684\u8fd9\u7bc7\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/02\/3d-lut-principle\/\">3D LUT \u6ee4\u955c\u989c\u8272\u6620\u5c04\u539f\u7406\u5256\u6790\u4e0eJS\u5b9e\u73b0<\/a>\u201d\u3002<\/p>\n<h3>\u4e8c\u3001LUT\u6ee4\u955c\u5728pixi\u4e2d\u7684\u5e94\u7528<\/h3>\n<p>\u8bf4\u5230pixi.js\u4e2d\u7684\u6ee4\u955c\u6548\u679c\uff0c\u4e0d\u5f97\u4e0d\u63d0\u4e00\u4e0b\u5b98\u65b9\u8fd9\u4e2a\u9879\u76ee\uff1a<a href=\"https:\/\/github.com\/pixijs\/filters\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/pixijs\/filters<\/a><\/p>\n<p>LUT\u6ee4\u955c\u672c\u8d28\u4e0a\u5c31\u662f\u989c\u8272\u6620\u5c04\uff0c\u82f1\u6587\u79f0\u4e3a color map\uff0c\u56e0\u6b64\uff0c\u9700\u8981\u4f7f\u7528\u5176\u63d0\u4f9b\u7684ColorMapFilter\u7c7b\u3002<\/p>\n<p>\u4f7f\u7528\u793a\u610f\u5982\u4e0b\uff1a<\/p>\n<pre>import {ColorMapFilter} from '@pixi\/filter-color-map';\r\nimport {Container} from 'pixi.js';\r\n\r\nconst container = new Container();\r\nconst colorMap = new Image();\r\ncolorMap.src = 'foo\/bar\/colorMap.png';\r\n\r\ncontainer.filters = [new ColorMapFilter(colorMap)];<\/pre>\n<p>\u5982\u679c\u662f\u5e0c\u671b\u76f4\u8054\u4f7f\u7528\uff0c\u53ef\u4ee5\u53c2\u8003\uff1a<\/p>\n<pre>&lt;script src=\".\/pixi.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\".\/pixi-filters.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\nconst container = new PIXI.Container();\r\nconst colorMap = new Image();\r\ncolorMap.src = 'foo\/bar\/colorMap.png';\r\n\r\ncontainer.filters = [new PIXI.filters.ColorMapFilter(colorMap)];\r\n&lt;\/script&gt;<\/pre>\n<p>\u4e0d\u8fc7\u652f\u6301\u76f4\u8054\u7528\u6cd5\u7684pixi-filters.js\u7684\u7248\u672c\u597d\u591a\u5e74\u6ca1\u66f4\u65b0\u4e86\uff0c\u9700\u8981\u4f7f\u7528\u65e7\u7248\u7684pixi.js\uff0c\u53ef\u80fd\u4f1a\u6709\u95ee\u9898\uff0c\u6240\u4ee5\uff0c\u63a8\u8350\u4f7f\u7528ESM\u7248\u672c\u7684\u3002<\/p>\n<pre>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/pixi.js@7.x\/dist\/pixi.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script type=\"module\"&gt;\r\n    import { ColorMapFilter } from 'https:\/\/cdn.jsdelivr.net\/npm\/@pixi\/filter-color-map@5.1.1\/+esm'\r\n    ...\r\n&lt;\/script&gt;<\/pre>\n<h4>ColorMapFilter\u7684\u8bed\u6cd5<\/h4>\n<p><a href=\"https:\/\/api.pixijs.io\/@pixi\/filter-color-map\/PIXI\/filters\/ColorMapFilter.html\" target=\"_blank\" rel=\"nofollow\">ColorMapFilter\u7c7b\u7684\u8bed\u6cd5<\/a>\u5982\u4e0b\uff1a<\/p>\n<pre>new PIXI.filters.ColorMapFilter(colorMap: HTMLImageElement | HTMLCanvasElement | PIXI.BaseTexture | PIXI.Texture, nearest: boolean, mix: number) \u2192 {}<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<dl>\n<dt><strong>colorMap<\/strong><\/dt>\n<dd>\u989c\u8272\u6620\u5c04\u7684\u56fe\u50cf\u5143\u7d20\uff0c\u56fe\u7247\u5143\u7d20\uff0ccanvas\u5143\u7d20\u6216\u8005PIXI\u7684\u7eb9\u7406\u90fd\u53ef\u4ee5\u3002<\/dd>\n<dt><strong>nearest<\/strong><\/dt>\n<dd>\u662f\u5426\u5bf9colorMap\u7eb9\u7406\u4f7f\u7528NEAREST\u3002<\/dd>\n<dt><strong>mix<\/strong><\/dt>\n<dd>\u989c\u8272\u6620\u5c04\u4f7f\u7528\u7684\u767e\u5206\u7387\uff0c\u8303\u56f4\u662f0~1\uff0c0\u5c31\u662f\u539f\u56fe\u3002<\/dd>\n<\/dl>\n<p>\u4ece\u4e0a\u9762\u7684\u8bed\u6cd5\u53ef\u4ee5\u770b\u51fa\uff0c\u5728PIXI\u4e2d\uff0c\u53ea\u652f\u6301\u56fe\u50cf\u7c7b\u578b\u7684LUT\u7d20\u6750\u7684\u6e32\u67d3\uff0c\u7136\u800c\uff0c\u5f88\u591a\u65f6\u5019\uff0c\u6211\u4eec\u5df2\u6709\u7684\u7d20\u6750\u90fd\u662f\u6587\u672c\u683c\u5f0f\u7684\u7d20\u6750\uff0c\u4e00\u5806<code>.cube<\/code>\u540e\u7f00\u7684\u6587\u4ef6\uff0c\u6211\u4ece\u8001\u6587\u4ef6\u5939\u91cc\u627e\u4e86\u4e2a\u793a\u610f\u7d20\u6750\uff0c\u558f\uff0c<a href=\"https:\/\/www.zhangxinxu.com\/study\/202002\/Candlelight.cube\">Candlelight.cube\u6ee4\u955c<\/a>\u3002<\/p>\n<\/p>\n<p>\u91cc\u9762\u662f\u4e00\u6233\u6587\u672c\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-26_223046.png\" width=\"334\" height=\"114\" alt=\"4828\u884c\u989c\u8272\u793a\u610f\" class=\"alignnone size-medium\"><\/p>\n<p>\u6240\u4ee5\uff0c\u6709\u5fc5\u8981\u5148\u5c06\u6587\u672c\u683c\u5f0f\u7684LUT\u6ee4\u955c\u8f6c\u6362\u4e3a\u56fe\u7247\u683c\u5f0f\u7684LUT\u6ee4\u955c\u624d\u884c\u3002<\/p>\n<h3>\u4e09\u3001Cube\u6587\u672cLUT\u8f6c\u56fe\u7247<\/h3>\n<p>cube\u91cc\u9762\u7684\u6587\u672c\u5185\u5bb9\uff0c\u5176\u5b9e\u5c31\u662f\u4e00\u5806\u989c\u8272\u503c\uff0c\u6bcf\u884c\u4e09\u4e2a\uff0c\u5206\u522b\u662fRGB\u4e09\u4e2a\u901a\u9053\u7684\u503c\uff0c\u8303\u56f4\u662f0~1\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>0.000000 0.000000 0.000000\r\n0.000000 0.000000 0.000000\r\n0.000000 0.000000 0.000000<\/pre>\n<p>\u5c31\u8868\u793a\u8fde\u7eed\u4e09\u4e2a\u50cf\u7d20\u70b9\u90fd\u662f\u7eaf\u9ed1\u8272\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5c06\u8fd9\u4e9b\u5185\u5bb9\u8f6c\u6362\u6210RGB\u8272\u503c\uff0c\u7136\u540e\u5728Canvas\u5143\u7d20\u4e0a\u8fdb\u884c\u7ed8\u5236\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u4e8e\u662f\uff0c\u9996\u5148\u7b2c\u4e00\u6b65\uff0c\u6211\u4eec\u9700\u8981\u89e3\u6790cube\u6587\u4ef6\uff0c\u5f97\u5230\u989c\u8272\u6620\u5c04\u56fe\u7247\u7684\u5c3a\u5bf8\u548c\u6240\u6709\u7684\u8272\u503c\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5373\u53ef\uff0c\u53c2\u8003\u81ea<a href=\"https:\/\/github.com\/thibauts\/parse-cube-lut\" target=\"_blank\" rel=\"nofollow\">\u8fd9\u4e2aGithub\u9879\u76ee<\/a>\u3002<\/p>\n<pre>\/\/ \u89e3\u6790cube\u6587\u4ef6\u7684\u65b9\u6cd5\r\nconst parseCubeLUT = function (str) {\r\n    if (typeof str !== 'string') {\r\n        str = str.toString();\r\n    }\r\n\r\n    var title = null;\r\n    var type = null;\r\n    var size = 0;\r\n    var domain = [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]];\r\n    var data = [];\r\n\r\n    var lines = str.split('\\n');\r\n\r\n    for (var i=0; i&lt;lines.length; i++) {\r\n        var line = lines[i].trim();\r\n\r\n        if(line[0] === '#' || line === '') {\r\n            \/\/ Skip comments and empty lines\r\n            continue;\r\n        }\r\n\r\n        var parts = line.split(\/\\s+\/);\r\n\r\n        switch(parts[0]) {\r\n            case 'TITLE':\r\n                title = line.slice(7, -1);\r\n                break;\r\n            case 'DOMAIN_MIN':\r\n                domain[0] = parts.slice(1).map(Number);\r\n                break;\r\n            case 'DOMAIN_MAX':\r\n                domain[1] = parts.slice(1).map(Number);\r\n                break;\r\n            case 'LUT_1D_SIZE':\r\n                type = '1D';\r\n                size = Number(parts[1]);\r\n                break;\r\n            case 'LUT_3D_SIZE':\r\n                type = '3D';\r\n                size = Number(parts[1]);\r\n                break;\r\n            default:\r\n                data.push(parts.map(Number));\r\n        }\r\n    }\r\n\r\n    return {\r\n        title: title,\r\n        type: type,\r\n        size: size,\r\n        domain: domain,\r\n        data: data\r\n    };\r\n}<\/pre>\n<p>\u7136\u540e\uff0c\u6211\u4eec\u9700\u8981\u5c06\u8fd9\u4e9b\u8272\u503c\u8f6c\u6362\u4e3a\u56fe\u7247\uff0c\u8fd9\u91cc\u4f7f\u7528Canvas\u5143\u7d20\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>\/\/ \u5c06\u8272\u503c\u8f6c\u6362\u4e3a\u56fe\u7247\r\nconst lut2Img = function (lutData) {\r\n    const { size, data } = lutData;\r\n\r\n    \/\/ \u6839\u636esize\u521b\u5efacanvas\u5143\u7d20\r\n    const canvas = document.createElement('canvas');\r\n    canvas.width = size * size;\r\n    canvas.height = size;\r\n\r\n    \/\/ \u7ed8\u5236\u5728Canvas\u4e0a\r\n    const context = canvas.getContext('2d');\r\n    const imagedata = context.createImageData(canvas.width, canvas.height);\r\n    \/\/ \u7ed9\u5bf9\u5e94\u5750\u6807\u4f4d\u7f6e\u7684\u6570\u636e\u8bbe\u7f6e\u8272\u503c\u4e3a\u7eff\u8272\r\n    let startX = 0;\r\n    let startY = 0;\r\n    for (var x = 0; x &lt; data.length; x++) {\r\n        \/\/ \u5782\u76f4\u8ba1\u7b97\u4f4d\u7f6e\r\n        startY = Math.floor(x \/ size) % size;\r\n        startX = x % size + size * Math.floor(Math.floor(x \/ size) \/ size);\r\n\r\n        \/\/ index \u8ba1\u7b97\r\n        var index = 4 * (startY * size * size + startX);\r\n\r\n        imagedata.data[index] = data[x][0] * 255;\r\n        imagedata.data[index + 1] = data[x][1] * 255;\r\n        imagedata.data[index + 2] = data[x][2] * 255;\r\n        imagedata.data[index + 3] = 255;\r\n    }\r\n    \/\/ \u518d\u91cd\u7ed8\r\n    context.putImageData(imagedata, 0, 0);\r\n\r\n    return canvas;\r\n}<\/pre>\n<p>\u8fd9\u91cc\u6709\u4e2a\u5f88\u591a\u4eba\u90fd\u4f1a\u72af\u9519\u7684\u7ec6\u8282\uff0c\u90a3\u5c31\u662f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u7684cube\u989c\u8272\u8272\u503c\u662f\u6309\u7167\u5782\u76f4\u5bab\u683c\u5448\u73b0\u7684\uff08\u89c1\u4e0b\u56fe\uff09\uff0c\u800cPIXI\u4e2d\u9700\u8981\u7684\u989c\u8272\u6620\u5c04\u56fe\u5f62\u9700\u8981\u6a2a\u6392\uff0c\u6240\u4ee5\u5982\u679c\u6211\u4eec\u5355\u7eaf\u4e00\u4e2afor\u5faa\u73af\u6267\u884c\uff0c\u4f1a\u53d1\u73b0\u6700\u7ec8\u6e32\u67d3\u7684\u8272\u5f69\u6ee4\u955c\u6548\u679c\u548c\u771f\u5b9e\u7684cube\u6ee4\u955c\u6e32\u67d3\u6548\u679c\u662f\u6709\u8f83\u5927\u504f\u5dee\u7684\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/2023-11-21_173724.png\" width=\"48\" height=\"305\" alt=\"\u7ad6\u6392\u793a\u610f\"><\/p>\n<p>\u56e0\u6b64\uff0c\u5728for\u5faa\u73af\u7684\u65f6\u5019\uff0c\u9700\u8981\u7cbe\u51c6\u8ba1\u7b97\u6bcf\u884c\u8272\u503c\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u5c06\u4e0a\u9762\u4e24\u4e2a\u65b9\u6cd5\u7ed3\u5408\u8d77\u6765\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0cube\u6587\u672c\u8f6c\u56fe\u7247\u7684\u529f\u80fd\u4e86\u3002<\/p>\n<p>\u6709\u4e2a\u6620\u5c04\u56fe\u7247\uff0c\u6ee4\u955c\u6548\u679c\u81ea\u7136\u4e0d\u5728\u8bdd\u4e0b\u4e86\u3002<\/p>\n<h3>\u56db\u3001\u773c\u89c1\u4e3a\u5b9e\uff0cdemo\u6f14\u793a<\/h3>\n<p>OK\uff0c\u8fdb\u5165\u5927\u5bb6\u6700\u5173\u5fc3\u6700\u9700\u8981\u7684\u90e8\u5206\uff0c\u6f14\u793a\u548c\u6e90\u7801\uff0c\u8fd9\u91cc\u4f7f\u7528<a href=\"\/study\/202002\/Candlelight.cube\" style=\"color:#34538b\">Candlelight.cube<\/a>\u8fd9\u4e2a\u6ee4\u955c\u793a\u610f\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202311\/pixi-js-cube-lut-filter-demo.php\" rel=\"noopener\" target=\"_blank\">pixi.js\u5b9e\u73b0lut\u989c\u8272\u6620\u5c04\u6ee4\u955cdemo<\/a><\/p>\n<p>\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6548\u679c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/2023-11-21_234652.jpg\" width=\"489\" height=\"523\" alt=\"demo\u6ee4\u955c\u6548\u679c\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u901f\u5ea6\u8fd8\u662f\u633a\u5feb\u7684\uff0cwebGL\u6e32\u67d3\u679c\u7136\u6bd42d context\u901f\u5ea6\u5feb\u591a\u4e86\u3002<\/p>\n<h3>\u4e94\u3001\u7ed3\u8bed<\/h3>\n<p>\u5728pixi\u4f17\u591a\u6ee4\u955c\u4e2d\u770b\u5230\u4e86DisplacementFilter\u6ee4\u955c\uff0c\u8fd9\u4e2a\u5176\u5b9e\u4ee5\u524d\u4ecb\u7ecd\u8fc7\u7c7b\u4f3c\u7684\uff0c\u4e0d\u8fc7\u662fSVG\u7684\u76f8\u5173\u6ee4\u955c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5143\u7d20\u7684\u626d\u66f2\u6548\u679c\uff0c\u6709\u5174\u8da3\u53ef\u4ee5\u4e86\u89e3\u4e0b\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2017\/12\/understand-svg-fedisplacementmap-filter\/\">\u6df1\u5165\u7406\u89e3SVG feDisplacementMap\u6ee4\u955c\u53ca\u5b9e\u9645\u5e94\u7528<\/a>\u201d<\/p>\n<p>\u5176\u5b9e\uff0c\u5927\u5bb6\u53ea\u8981\u5728Web\u89c6\u89c9\u8868\u73b0\u6d78\u67d3\u8fc7\u4e86\uff0c\u5c31\u4f1a\u53d1\u73b0\u6240\u8c13\u7684\u6ee4\u955c\u554a\uff0c\u7279\u6548\u554a\uff0c\u90fd\u662f\u4e00\u4e2a\u8def\u5b50\u4e0b\u6765\u7684\uff0c\u65e0\u8bba\u662fCSS\u7684\u3001SVG\uff0c2D canvas\u6216\u8005WebGL\uff0c\u4e00\u901a\u767e\u901a\u3002<\/p>\n<p>\u6069\u2026\u2026SVG\u6ee4\u955c\u91cc\u9762\u8fd8\u6709\u51e0\u4e2a\u6ee4\u955c\u5143\u7d20\u6211\u8fd8\u4e0d\u662f\u5f88\u719f\u6089\uff0c\u6211\u89c9\u5f97\u5e74\u5e95\u524d\u53ef\u4ee5\u62bd\u65f6\u95f4\u7814\u7a76\u4e0b\uff0c\u4e0d\u7559\u5b66\u4e60\u6f0f\u6d1e\uff0c\u7b49\u5168\u90e8\u90fd\u901a\u900f\u4e86\uff0c\u90a3\u5c31\u662fSVG\u6ee4\u955c\u9ad8\u624b\uff0c\u800c\u524d\u7aef\u4ece\u4e1a\u8005\u8fd9\u4e48\u591a\uff0cSVG\u6ee4\u955c\u9ad8\u624b\u5be5\u5be5\u65e0\u51e0\uff0c\u5c82\u4e0d\u662f\u4f18\u52bf\u5728\u6211\u4e86\uff1f<button onclick=\"shareWeixin.click()\" class=\"entry-share-btn\">\u6233\u6211\u5206\u4eab\u2665\ufe0f<\/button><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/advance-me.jpg\" width=\"120\" height=\"80\" alt=\"\u4f18\u52bf\u5728\u6211\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11060\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11060<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202311\/cute-cover.png\" width=\"160\" height=\"99\" alt=\"cube\u6587\u4ef6\u793a\u610f\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u6ee4\u955c\u6548\u679c\u5927\u4f53\u5206\u4e24\u7c7b\uff0c\u4e00\u7c7b\u662f\u7b97\u6cd5\u6ee4\u955c\uff0c\u53e6\u5916\u4e00\u7c7b\u5219\u662f\u989c\u8272\u6620\u5c04\u6ee4\u955c\uff0c\u672c\u6587\u5c31\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528pixi.js\u5728WebGL\u4e2d\u5e94\u7528\u989c\u8272\u6620\u5c04\u6ee4\u955c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,180],"tags":[1192,1950,1562,1198,368,1193,206],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11060"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=11060"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11060\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=11060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=11060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=11060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}