myagent-ai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +30 -0
- package/README.md +333 -0
- package/agents/__init__.py +6 -0
- package/agents/__pycache__/main_agent.cpython-312.pyc +0 -0
- package/agents/base.py +115 -0
- package/agents/main_agent.py +695 -0
- package/agents/memory_agent.py +313 -0
- package/agents/tool_agent.py +248 -0
- package/chatbot/__init__.py +5 -0
- package/chatbot/base.py +124 -0
- package/chatbot/discord_bot.py +146 -0
- package/chatbot/feishu_bot.py +548 -0
- package/chatbot/manager.py +164 -0
- package/chatbot/qq_bot.py +189 -0
- package/chatbot/telegram_bot.py +167 -0
- package/chatbot/wechat_bot.py +558 -0
- package/communication/__init__.py +66 -0
- package/communication/channel.py +576 -0
- package/communication/crypto.py +347 -0
- package/communication/manager.py +397 -0
- package/communication/peer.py +156 -0
- package/config.py +464 -0
- package/core/__init__.py +10 -0
- package/core/config_broadcast.py +276 -0
- package/core/llm.py +878 -0
- package/core/logger.py +241 -0
- package/core/task_queue.py +362 -0
- package/core/utils.py +184 -0
- package/executor/__init__.py +4 -0
- package/executor/__pycache__/engine.cpython-312.pyc +0 -0
- package/executor/engine.py +1215 -0
- package/groups/__init__.py +15 -0
- package/groups/manager.py +724 -0
- package/knowledge/__init__.py +4 -0
- package/knowledge/rag.py +444 -0
- package/main.py +801 -0
- package/memory/__init__.py +4 -0
- package/memory/manager.py +840 -0
- package/organization/__init__.py +4 -0
- package/organization/manager.py +350 -0
- package/package.json +58 -0
- package/requirements.txt +59 -0
- package/setup.py +40 -0
- package/skills/ASR/LICENSE.txt +21 -0
- package/skills/ASR/SKILL.md +580 -0
- package/skills/ASR/scripts/asr.ts +27 -0
- package/skills/LLM/LICENSE.txt +21 -0
- package/skills/LLM/SKILL.md +856 -0
- package/skills/LLM/scripts/chat.ts +32 -0
- package/skills/TTS/LICENSE.txt +21 -0
- package/skills/TTS/SKILL.md +735 -0
- package/skills/TTS/tts.ts +25 -0
- package/skills/VLM/LICENSE.txt +21 -0
- package/skills/VLM/SKILL.md +588 -0
- package/skills/VLM/scripts/vlm.ts +57 -0
- package/skills/__init__.py +5 -0
- package/skills/agent-browser/SKILL.md +328 -0
- package/skills/ai-news-collectors/SKILL.md +157 -0
- package/skills/ai-news-collectors/_meta.json +6 -0
- package/skills/ai-news-collectors/references/sources.md +128 -0
- package/skills/aminer-open-academic/SKILL.md +312 -0
- package/skills/aminer-open-academic/_meta.json +6 -0
- package/skills/aminer-open-academic/evals/evals.json +46 -0
- package/skills/aminer-open-academic/references/api-catalog.md +1032 -0
- package/skills/aminer-open-academic/scripts/__pycache__/aminer_client.cpython-312.pyc +0 -0
- package/skills/aminer-open-academic/scripts/aminer_client.py +875 -0
- package/skills/auto-target-tracker/SKILL.md +317 -0
- package/skills/base.py +147 -0
- package/skills/blog-writer/2024-02-17-radical-transparency-sales.md +35 -0
- package/skills/blog-writer/2024-02-17-raycast-spotlight-superpowers.md +33 -0
- package/skills/blog-writer/2024-02-17-short-form-content-marketing.md +47 -0
- package/skills/blog-writer/2024-02-17-typing-speed-benefits.md +33 -0
- package/skills/blog-writer/2024-03-14-effective-ai-prompts.md +55 -0
- package/skills/blog-writer/2024-11-08-ai-revolutionizing-entry-level-sales.md +43 -0
- package/skills/blog-writer/2025-11-12-why-ai-art-is-useless.md +49 -0
- package/skills/blog-writer/README.md +2 -0
- package/skills/blog-writer/SKILL.md +158 -0
- package/skills/blog-writer/__pycache__/manage_examples.cpython-312.pyc +0 -0
- package/skills/blog-writer/_meta.json +6 -0
- package/skills/blog-writer/manage_examples.py +90 -0
- package/skills/blog-writer/style-guide.md +160 -0
- package/skills/browser_skill.py +146 -0
- package/skills/coding-agent/SKILL.md +120 -0
- package/skills/coding-agent/_meta.json +6 -0
- package/skills/coding-agent/criteria.md +48 -0
- package/skills/coding-agent/execution.md +42 -0
- package/skills/coding-agent/memory-template.md +38 -0
- package/skills/coding-agent/planning.md +31 -0
- package/skills/coding-agent/state.md +60 -0
- package/skills/coding-agent/verification.md +39 -0
- package/skills/content-strategy/SKILL.md +181 -0
- package/skills/content-strategy/_meta.json +6 -0
- package/skills/contentanalysis/ExtractWisdom/SKILL.md +229 -0
- package/skills/contentanalysis/ExtractWisdom/Workflows/Extract.md +60 -0
- package/skills/contentanalysis/SKILL.md +14 -0
- package/skills/docx/CHANGELOG.md +85 -0
- package/skills/docx/LICENSE.txt +30 -0
- package/skills/docx/SKILL.md +455 -0
- package/skills/docx/docx-js.md +681 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +615 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/add_toc_placeholders.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/document.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/utilities.cpython-312.pyc +0 -0
- package/skills/docx/scripts/add_toc_placeholders.py +220 -0
- package/skills/docx/scripts/document.py +1302 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/dream-interpreter/SKILL.md +88 -0
- package/skills/dream-interpreter/assets/example_asset.txt +24 -0
- package/skills/dream-interpreter/references/api_reference.md +34 -0
- package/skills/dream-interpreter/references/interpretation-guide.md +83 -0
- package/skills/dream-interpreter/references/output-schema.md +65 -0
- package/skills/dream-interpreter/references/questioning-strategy.md +62 -0
- package/skills/dream-interpreter/references/visual-mapping.md +81 -0
- package/skills/dream-interpreter/scripts/__pycache__/example.cpython-312.pyc +0 -0
- package/skills/dream-interpreter/scripts/example.py +19 -0
- package/skills/dream-interpreter/skill.json +7 -0
- package/skills/file_skill.py +246 -0
- package/skills/finance/Finance_API_Doc.md +445 -0
- package/skills/finance/SKILL.md +53 -0
- package/skills/fullstack-dev/SKILL.md +205 -0
- package/skills/get-fortune-analysis/SKILL.md +370 -0
- package/skills/get-fortune-analysis/lunar_python.py +91 -0
- package/skills/gift-evaluator/SKILL.md +83 -0
- package/skills/gift-evaluator/__pycache__/html_tools.cpython-312.pyc +0 -0
- package/skills/gift-evaluator/html_tools.py +268 -0
- package/skills/image-edit/LICENSE.txt +21 -0
- package/skills/image-edit/SKILL.md +896 -0
- package/skills/image-edit/scripts/image-edit.ts +36 -0
- package/skills/image-generation/LICENSE.txt +21 -0
- package/skills/image-generation/SKILL.md +583 -0
- package/skills/image-generation/scripts/image-generation.ts +28 -0
- package/skills/image-understand/LICENSE.txt +21 -0
- package/skills/image-understand/SKILL.md +855 -0
- package/skills/image-understand/scripts/image-understand.ts +41 -0
- package/skills/interview-designer/README.md +70 -0
- package/skills/interview-designer/SKILL.md +53 -0
- package/skills/interview-designer/_meta.json +6 -0
- package/skills/interview-designer/references/design_rationale.md +43 -0
- package/skills/interview-designer/templates/interview_guide_template.md +62 -0
- package/skills/market-research-reports/SKILL.md +901 -0
- package/skills/market-research-reports/assets/FORMATTING_GUIDE.md +428 -0
- package/skills/market-research-reports/assets/market_report_template.tex +1380 -0
- package/skills/market-research-reports/assets/market_research.sty +564 -0
- package/skills/market-research-reports/references/data_analysis_patterns.md +548 -0
- package/skills/market-research-reports/references/report_structure_guide.md +999 -0
- package/skills/market-research-reports/references/visual_generation_guide.md +1077 -0
- package/skills/market-research-reports/scripts/__pycache__/generate_market_visuals.cpython-312.pyc +0 -0
- package/skills/market-research-reports/scripts/generate_market_visuals.py +529 -0
- package/skills/marketing-mode/README.md +49 -0
- package/skills/marketing-mode/SKILL.md +693 -0
- package/skills/marketing-mode/_meta.json +6 -0
- package/skills/marketing-mode/mode-prompt.md +39 -0
- package/skills/marketing-mode/skill.json +51 -0
- package/skills/mindfulness-meditation/SKILL.md +65 -0
- package/skills/mindfulness-meditation/_meta.json +6 -0
- package/skills/multi-search-engine/CHANGELOG.md +15 -0
- package/skills/multi-search-engine/CHANNELLOG.md +48 -0
- package/skills/multi-search-engine/SKILL.md +78 -0
- package/skills/multi-search-engine/_meta.json +6 -0
- package/skills/multi-search-engine/config.json +14 -0
- package/skills/multi-search-engine/metadata.json +7 -0
- package/skills/multi-search-engine/references/international-search.md +651 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +1534 -0
- package/skills/pdf/forms.md +205 -0
- package/skills/pdf/reference.md +765 -0
- package/skills/pdf/scripts/__pycache__/add_zai_metadata.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes_test.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/convert_pdf_to_images.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/create_validation_image.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/extract_form_field_info.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_pdf_form_with_annotations.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/sanitize_code.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/add_zai_metadata.py +172 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/pdf/scripts/sanitize_code.py +110 -0
- package/skills/podcast-generate/LICENSE.txt +21 -0
- package/skills/podcast-generate/SKILL.md +198 -0
- package/skills/podcast-generate/generate.ts +661 -0
- package/skills/podcast-generate/package.json +30 -0
- package/skills/podcast-generate/readme.md +177 -0
- package/skills/podcast-generate/test_data/segments.jsonl +3 -0
- package/skills/podcast-generate/tsconfig.json +26 -0
- package/skills/pptx/LICENSE.txt +30 -0
- package/skills/pptx/SKILL.md +507 -0
- package/skills/pptx/html2pptx.md +625 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-313.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/rearrange.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/replace.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/thumbnail.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/html2pptx.js +1044 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/qingyan-research/SKILL.md +294 -0
- package/skills/qingyan-research/__pycache__/generate_html.cpython-312.pyc +0 -0
- package/skills/qingyan-research/generate_html.py +33 -0
- package/skills/registry.py +344 -0
- package/skills/search_skill.py +228 -0
- package/skills/seo-content-writer/SKILL.md +661 -0
- package/skills/seo-content-writer/_meta.json +6 -0
- package/skills/seo-content-writer/references/content-structure-templates.md +875 -0
- package/skills/seo-content-writer/references/title-formulas.md +339 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-creator/agents/analyzer.md +274 -0
- package/skills/skill-creator/agents/comparator.md +202 -0
- package/skills/skill-creator/agents/grader.md +223 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/__pycache__/generate_review.cpython-312.pyc +0 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/skill-creator/references/schemas.md +430 -0
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/aggregate_benchmark.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/generate_report.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/improve_description.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/package_skill.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_loop.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/utils.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/skill-creator/scripts/generate_report.py +326 -0
- package/skills/skill-creator/scripts/improve_description.py +236 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/skill-creator/scripts/run_eval.py +310 -0
- package/skills/skill-creator/scripts/run_loop.py +328 -0
- package/skills/skill-creator/scripts/utils.py +47 -0
- package/skills/skill-finder-cn/SKILL.md +66 -0
- package/skills/skill-finder-cn/_meta.json +6 -0
- package/skills/skill-finder-cn/package.json +5 -0
- package/skills/skill-finder-cn/scripts/search.sh +15 -0
- package/skills/skill-vetter/SKILL.md +137 -0
- package/skills/stock-analysis-skill/SKILL.md +156 -0
- package/skills/stock-analysis-skill/package.json +21 -0
- package/skills/stock-analysis-skill/src/analyzer.ts +264 -0
- package/skills/stock-analysis-skill/src/dataFetcher.ts +130 -0
- package/skills/stock-analysis-skill/src/dividend.ts +226 -0
- package/skills/stock-analysis-skill/src/index.ts +327 -0
- package/skills/stock-analysis-skill/src/rumorScanner.ts +200 -0
- package/skills/stock-analysis-skill/src/types.ts +167 -0
- package/skills/stock-analysis-skill/src/watchlist.ts +292 -0
- package/skills/stock-analysis-skill/tsconfig.json +15 -0
- package/skills/storyboard-manager/SKILL.md +532 -0
- package/skills/storyboard-manager/index.js +9 -0
- package/skills/storyboard-manager/package.json +11 -0
- package/skills/storyboard-manager/references/character_development.md +232 -0
- package/skills/storyboard-manager/references/story_structures.md +148 -0
- package/skills/storyboard-manager/scripts/__pycache__/consistency_checker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/__pycache__/timeline_tracker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/consistency_checker.py +391 -0
- package/skills/storyboard-manager/scripts/timeline_tracker.py +352 -0
- package/skills/system_skill.py +249 -0
- package/skills/ui-ux-pro-max/SKILL.md +43 -0
- package/skills/ui-ux-pro-max/_meta.json +6 -0
- package/skills/ui-ux-pro-max/assets/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/assets/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/assets/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/assets/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/assets/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/assets/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/assets/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/references/upstream-README.md +488 -0
- package/skills/ui-ux-pro-max/references/upstream-skill-content.md +288 -0
- package/skills/ui-ux-pro-max/scripts/__init__.py +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1071 -0
- package/skills/ui-ux-pro-max/scripts/search.py +111 -0
- package/skills/video-generation/LICENSE.txt +21 -0
- package/skills/video-generation/SKILL.md +1082 -0
- package/skills/video-generation/scripts/video.ts +168 -0
- package/skills/video-understand/LICENSE.txt +21 -0
- package/skills/video-understand/SKILL.md +916 -0
- package/skills/video-understand/scripts/video-understand.ts +41 -0
- package/skills/visual-design-foundations/SKILL.md +318 -0
- package/skills/visual-design-foundations/references/color-systems.md +417 -0
- package/skills/visual-design-foundations/references/spacing-iconography.md +425 -0
- package/skills/visual-design-foundations/references/typography-systems.md +432 -0
- package/skills/web-reader/LICENSE.txt +21 -0
- package/skills/web-reader/SKILL.md +1140 -0
- package/skills/web-reader/scripts/web-reader.ts +37 -0
- package/skills/web-search/LICENSE.txt +21 -0
- package/skills/web-search/SKILL.md +912 -0
- package/skills/web-search/scripts/web_search.ts +44 -0
- package/skills/web-shader-extractor/SKILL.md +145 -0
- package/skills/web-shader-extractor/references/config-extraction.md +50 -0
- package/skills/web-shader-extractor/references/encoded-definitions.md +53 -0
- package/skills/web-shader-extractor/references/extraction-workflow.md +61 -0
- package/skills/web-shader-extractor/references/porting-strategy.md +164 -0
- package/skills/web-shader-extractor/references/shader-injection.md +126 -0
- package/skills/web-shader-extractor/references/shaders-com.md +190 -0
- package/skills/web-shader-extractor/references/tech-signatures.md +54 -0
- package/skills/web-shader-extractor/references/tsl-extraction.md +41 -0
- package/skills/web-shader-extractor/references/unicorn-studio.md +353 -0
- package/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs +153 -0
- package/skills/web-shader-extractor/scripts/scan-bundle.sh +76 -0
- package/skills/writing-plans/SKILL.md +116 -0
- package/skills/writing-plans/_meta.json +6 -0
- package/skills/xlsx/LICENSE.txt +30 -0
- package/skills/xlsx/SKILL.md +496 -0
- package/skills/xlsx/__pycache__/recalc.cpython-312.pyc +0 -0
- package/skills/xlsx/recalc.py +178 -0
- package/start.sh +36 -0
- package/web/__init__.py +1 -0
- package/web/__pycache__/api_server.cpython-312.pyc +0 -0
- package/web/api_server.py +2043 -0
- package/web/ui/chat.html +3235 -0
- package/web/ui/index.html +458 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# shaders.com 提取工作流
|
|
2
|
+
|
|
3
|
+
shaders.com 是一个 shader 设计工具,使用 Nuxt.js + Three.js r183 TSL + Supabase。
|
|
4
|
+
|
|
5
|
+
## 识别特征
|
|
6
|
+
|
|
7
|
+
- URL: `shaders.com/collection/{slug}/{presetId}` 或 `shaders.com/preset/{id}`
|
|
8
|
+
- Canvas: `data-renderer="shaders"` + `data-engine="three.js r183"`
|
|
9
|
+
- Nuxt.js (`_nuxt/` 路径)
|
|
10
|
+
- Clerk 认证
|
|
11
|
+
- Supabase 存储 (`data.shaders.com/storage/v1/`)
|
|
12
|
+
|
|
13
|
+
## 关键架构差异
|
|
14
|
+
|
|
15
|
+
与 Unicorn Studio 完全不同:
|
|
16
|
+
- **不使用 GLSL** — 使用 Three.js TSL (Three Shader Language) 节点系统
|
|
17
|
+
- **87 种组件类型** — 每种有自己的 TSL `fragmentNode` 函数
|
|
18
|
+
- **定义数据是 XOR + base64 编码的**
|
|
19
|
+
- **组件可嵌套** — 树形结构(Glass 的 children 是其内部效果)
|
|
20
|
+
|
|
21
|
+
## 数据获取
|
|
22
|
+
|
|
23
|
+
### API 端点
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 集合变体(含编码定义)— 公开,无需认证
|
|
27
|
+
curl -s "https://shaders.com/api/collections/{slug}/{variantId}"
|
|
28
|
+
|
|
29
|
+
# 预览 API(含编码定义 + 水印注入)
|
|
30
|
+
curl -s "https://shaders.com/api/preview/preset/{presetId}"
|
|
31
|
+
|
|
32
|
+
# Nuxt payload(只含元数据,不含 shader 定义)
|
|
33
|
+
curl -s "https://shaders.com/collection/{slug}/{id}/_payload.json"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 定义解码
|
|
37
|
+
|
|
38
|
+
定义使用 XOR + base64 编码,有两套密钥:
|
|
39
|
+
|
|
40
|
+
1. **网站 API**(`/api/collections/`):
|
|
41
|
+
- 混淆密钥: `a5e7244ad0973f07e10285bfa75ddbe4`(来自 Nuxt runtime config)
|
|
42
|
+
- 组件/属性名用短代码(`C52`=Plasma, `p06`=angle, 等)
|
|
43
|
+
- 解码: `JSON.parse(XOR(base64decode(encoded), keyBytes))`
|
|
44
|
+
- 然后需要 code→name 映射表还原可读名称
|
|
45
|
+
|
|
46
|
+
2. **预览 API**(`/api/preview/`):
|
|
47
|
+
- 密钥: `shaders-preview-key`
|
|
48
|
+
- 使用人类可读属性名(无需映射)
|
|
49
|
+
- 注意:会注入水印 `ImageTexture` 组件
|
|
50
|
+
|
|
51
|
+
### 代码映射表
|
|
52
|
+
|
|
53
|
+
87 种组件按字母排序编号 `C00-C86`,233 种属性按字母排序编号 `p00-p232`。
|
|
54
|
+
映射表可从 JS bundle 中提取。
|
|
55
|
+
|
|
56
|
+
## 已知陷阱
|
|
57
|
+
|
|
58
|
+
### Y 轴翻转(反复出现!)
|
|
59
|
+
|
|
60
|
+
**SDF 纹理和 UV 坐标系统性 Y 翻转** — 已在多次提取中确认:
|
|
61
|
+
|
|
62
|
+
shaders.com 的 SDF 二进制(`.bin`)使用**图像坐标系**(Y=0 在顶部),
|
|
63
|
+
而 WebGL 纹理坐标 Y=0 在底部。直接加载会导致形状上下翻转。
|
|
64
|
+
|
|
65
|
+
```glsl
|
|
66
|
+
// 错误:直接用 shapeUV 采样
|
|
67
|
+
float sdf = texture(tSDF, shapeUV).r;
|
|
68
|
+
|
|
69
|
+
// 正确:翻转 Y
|
|
70
|
+
vec2 sdfUV = vec2(shapeUV.x, 1.0 - shapeUV.y);
|
|
71
|
+
float sdf = texture(tSDF, sdfUV).r;
|
|
72
|
+
|
|
73
|
+
// 注意:梯度的 Y 分量也需要取反
|
|
74
|
+
float dSdy = -(texture(tSDF, sdfUV - vec2(0, eps)).r - sdf) / eps;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
同样,组件定义中的 `center.y` 使用 DOM 坐标(Y=0 在顶部),
|
|
78
|
+
在 Glass shader 中需要翻转:`center.y = 1.0 - center.y`。
|
|
79
|
+
|
|
80
|
+
### SDF 二进制格式
|
|
81
|
+
|
|
82
|
+
- 格式:512×512 Float32 单通道(1,048,576 bytes = 512² × 4)
|
|
83
|
+
- 值域:有符号距离,负值=内部,正值=外部(如 [-0.065, 0.486])
|
|
84
|
+
- **不需要重映射**(不要做 `*2-1`),直接使用原始值
|
|
85
|
+
- 需要 `OES_texture_float_linear` 扩展做线性过滤
|
|
86
|
+
- WebGL2 加载:`gl.texImage2D(gl.TEXTURE_2D, 0, gl.R32F, 512, 512, 0, gl.RED, gl.FLOAT, data)`
|
|
87
|
+
|
|
88
|
+
## 组件类型速查
|
|
89
|
+
|
|
90
|
+
| 类别 | 组件 | 复杂度 |
|
|
91
|
+
|------|------|--------|
|
|
92
|
+
| 纹理 | Plasma, Godrays, SimplexNoise, LinearGradient, RadialGradient | 中 |
|
|
93
|
+
| 形状 | Glass, Blob, Circle, Ring, Star, RoundedRect, Polygon | 高(Glass 最复杂) |
|
|
94
|
+
| 畸变 | WaveDistortion, ChromaticAberration, Liquify, Twirl, Bulge | 低-中 |
|
|
95
|
+
| 风格化 | FilmGrain, Halftone, Ascii, Dither, Glow, Bloom | 低-中 |
|
|
96
|
+
| 后处理 | Blur, ProgressiveBlur, BrightnessContrast, HueShift | 低 |
|
|
97
|
+
|
|
98
|
+
## 渲染管线
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Three.js r183 TSL 渲染器
|
|
102
|
+
├─ 优先尝试 WebGPU,降级到 WebGL
|
|
103
|
+
├─ 正交相机 + 单个全屏四边形
|
|
104
|
+
├─ 组件树从底到顶合成
|
|
105
|
+
├─ 有 children 的组件用 RTT (render-to-texture) 捕获子内容
|
|
106
|
+
├─ blend mode 用自定义混合函数
|
|
107
|
+
└─ Glass 组件最复杂:SDF 评估 → 梯度法线 → 折射 → 色差 → 模糊 → 着色 → 高光 → 菲涅尔 → 合成
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 移植策略
|
|
111
|
+
|
|
112
|
+
1. **TSL 不能直接复制** — 需要翻译为 GLSL
|
|
113
|
+
2. **从 JS bundle 提取 TSL `fragmentNode`** → 反混淆 → 翻译为 GLSL
|
|
114
|
+
3. **组件树 → multi-pass FBO 管线**
|
|
115
|
+
4. **SDF 纹理需要 Y-flip**(见上方陷阱)
|
|
116
|
+
5. **Glass 组件参数多**(20+),需要精确匹配每个值
|
|
117
|
+
|
|
118
|
+
## 颜色空间处理(关键)
|
|
119
|
+
|
|
120
|
+
shaders.com 的 Three.js 渲染器全程在 **linear 空间** 工作:
|
|
121
|
+
- 组件定义中的 hex 颜色(如 `#2c2c42`)是 **sRGB** 值
|
|
122
|
+
- TSL 的 `color()` 函数自动将 sRGB→linear
|
|
123
|
+
- 所有中间 FBO 均存储 linear 值
|
|
124
|
+
- 最终由渲染器做 linear→sRGB 输出编码
|
|
125
|
+
|
|
126
|
+
移植时:
|
|
127
|
+
```glsl
|
|
128
|
+
// 1. 颜色定义时:sRGB hex → linear
|
|
129
|
+
vec3 colorA = pow(vec3(0.173, 0.173, 0.259), vec3(2.2)); // #2c2c42
|
|
130
|
+
|
|
131
|
+
// 2. 中间 pass:全部在 linear 空间计算,不做 gamma
|
|
132
|
+
// 3. 最终输出 pass(仅一次):linear → sRGB
|
|
133
|
+
fragColor = vec4(pow(color.rgb, vec3(1.0/2.2)), color.a);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**常见错误**:在中间 pass 做 gamma 校正,导致后续 pass 在错误空间累加高光/菲涅尔。
|
|
137
|
+
|
|
138
|
+
## 参数精确对齐原则
|
|
139
|
+
|
|
140
|
+
**绝对禁止手动调参**。所有参数必须严格匹配 TSL 翻译中的公式和乘数:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
TSL 原始乘数 → GLSL 必须使用的值
|
|
144
|
+
aberration * 0.06 → 不能改为 0.12
|
|
145
|
+
fresnelSoftness * 0.06 → 不能改为 0.12
|
|
146
|
+
fresnel (0.17) → 不能改为 0.4
|
|
147
|
+
SDF gradient eps = 0.01 → 不能改为 0.005
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
如果视觉效果不匹配,应检查:
|
|
151
|
+
1. 颜色空间是否正确(sRGB/linear 混乱是最常见原因)
|
|
152
|
+
2. 噪声函数实现差异(Perlin 实现 vs `mx_noise_float`)
|
|
153
|
+
3. 时间基准是否正确
|
|
154
|
+
4. FBO 管线顺序是否与组件树匹配
|
|
155
|
+
|
|
156
|
+
**不要**通过修改乘数来"补偿"视觉差异 — 这会在其他参数配置下崩溃。
|
|
157
|
+
|
|
158
|
+
## TSL 时间约定
|
|
159
|
+
|
|
160
|
+
`timerLocal(speed)` = 每秒递增 `speed` 单位。移植时:`uTime = seconds * speed`。
|
|
161
|
+
|
|
162
|
+
然后 shader 内部再乘自己的系数:
|
|
163
|
+
|
|
164
|
+
| 组件 | speed 参数 | shader 内部乘数 | 实际速率/秒 |
|
|
165
|
+
|------|-----------|----------------|------------|
|
|
166
|
+
| Plasma | 2 | × 0.125 | 0.25 |
|
|
167
|
+
| Godrays | 0.7 | × 0.2 | 0.14 |
|
|
168
|
+
| WaveDistortion | 0.8 | × 0.5 | 0.4 |
|
|
169
|
+
| FilmGrain | — | 无时间(静态) | 0 |
|
|
170
|
+
|
|
171
|
+
## TSL→GLSL 标识符映射(SPCVwBqR.js)
|
|
172
|
+
|
|
173
|
+
常用映射(随构建版本变化,需动态提取):
|
|
174
|
+
|
|
175
|
+
| 本地名 | TSL 函数 | GLSL |
|
|
176
|
+
|--------|---------|------|
|
|
177
|
+
| C / z | vec4() | vec4 |
|
|
178
|
+
| x / D | vec2() | vec2 |
|
|
179
|
+
| q / N | vec3() | vec3 |
|
|
180
|
+
| P / J | resolution | u_resolution |
|
|
181
|
+
| A / $ | uv | vUv |
|
|
182
|
+
| se / Oe | sin() | sin() |
|
|
183
|
+
| W / I | cos() | cos() |
|
|
184
|
+
| ne | mix() | mix() |
|
|
185
|
+
| D | smoothstep() | smoothstep() |
|
|
186
|
+
| fe | clamp() | clamp() |
|
|
187
|
+
| ar | mx_noise_float() | perlinNoise3D() |
|
|
188
|
+
| dr / Gt | timerLocal() | u_time × speed |
|
|
189
|
+
| Me / wt | rtt() | FBO pass |
|
|
190
|
+
| Ce | renderOutput() | fragColor |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 框架识别特征
|
|
2
|
+
|
|
3
|
+
## Three.js
|
|
4
|
+
|
|
5
|
+
**未混淆**:`THREE.`, `WebGLRenderer`, `ShaderMaterial`, `BufferGeometry`
|
|
6
|
+
|
|
7
|
+
**混淆后**(通过构造参数推断):
|
|
8
|
+
|
|
9
|
+
| 调用模式 | 原始类 |
|
|
10
|
+
|---------|--------|
|
|
11
|
+
| `new X({canvas, antialias, alpha})` | `WebGLRenderer` |
|
|
12
|
+
| `new X(fov, aspect, near, far)` — 4 数字 | `PerspectiveCamera` |
|
|
13
|
+
| `new X(-1, 1, 1, -1, 0, 1)` — 6 参数 | `OrthographicCamera` |
|
|
14
|
+
| `new X(w, h, {wrapS, minFilter})` | `WebGLRenderTarget` |
|
|
15
|
+
| `new X(data, w, h, format, type)` — Float32Array | `DataTexture` |
|
|
16
|
+
| `new X(2, 2)` 作为几何体 | `PlaneGeometry` |
|
|
17
|
+
| `new X({uniforms, vertexShader, fragmentShader})` | `ShaderMaterial` |
|
|
18
|
+
| `X.getElapsedTime()` | `Clock` |
|
|
19
|
+
|
|
20
|
+
**常量**:`ClampToEdgeWrapping`, `NearestFilter`, `RGBAFormat`, `FloatType`, `DoubleSide`
|
|
21
|
+
|
|
22
|
+
## 2D Canvas
|
|
23
|
+
|
|
24
|
+
`dataEngine: null` 时,用 `getContext('2d')` 有无 + `createShader`/`shaderSource` 有无区分:
|
|
25
|
+
- 有 `getContext('2d')`,无 WebGL 调用 → 纯 2D Canvas
|
|
26
|
+
- 有 WebGL 调用 → Raw WebGL / PixiJS
|
|
27
|
+
|
|
28
|
+
## Raw WebGL
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
gl.createShader / gl.shaderSource / gl.compileShader / gl.createProgram
|
|
32
|
+
gl.bindBuffer / gl.bindFramebuffer / gl.drawArrays
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## PixiJS
|
|
36
|
+
|
|
37
|
+
`PIXI.Application`, `PIXI.Filter`, `new PIXI.Filter(vertSrc, fragSrc, uniforms)`
|
|
38
|
+
|
|
39
|
+
## Babylon.js
|
|
40
|
+
|
|
41
|
+
`BABYLON.Engine`, `BABYLON.ShaderMaterial`, `BABYLON.Effect.ShadersStore`
|
|
42
|
+
|
|
43
|
+
## GPGPU 模式
|
|
44
|
+
|
|
45
|
+
两个 `WebGLRenderTarget`(ping-pong)+ `OrthographicCamera(-1,1,1,-1,0,1)` + `PlaneGeometry(2,2)` + `DataTexture` 初始位置 + `setRenderTarget` 循环
|
|
46
|
+
|
|
47
|
+
## 常见噪声
|
|
48
|
+
|
|
49
|
+
| 函数 | 类型 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| `snoise` | Simplex noise (Ashima) |
|
|
52
|
+
| `cnoise` | Classic Perlin |
|
|
53
|
+
| `cellular` | Worley/Voronoi |
|
|
54
|
+
| `fbm` | Fractal Brownian Motion |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Three.js TSL 识别与重建
|
|
2
|
+
|
|
3
|
+
Three.js r170+ 的 TSL (Three Shading Language) 用 JS 函数调用链组合 shader 节点图,运行时编译为 GLSL。
|
|
4
|
+
|
|
5
|
+
## 识别信号
|
|
6
|
+
|
|
7
|
+
1. Bundle 有大量 `uniform`/`shader` 但几乎没有 `precision`/`gl_FragColor`
|
|
8
|
+
2. canvas `data-engine` 显示 r170+
|
|
9
|
+
3. 存在 `.mul()`/`.add()`/`.toVar()`/`.assign()` 链式调用
|
|
10
|
+
|
|
11
|
+
## TSL → GLSL 映射
|
|
12
|
+
|
|
13
|
+
| TSL | GLSL |
|
|
14
|
+
|-----|------|
|
|
15
|
+
| `screenUV` | `gl_FragCoord.xy / resolution` |
|
|
16
|
+
| `viewportSize` | `uniform vec2 resolution` |
|
|
17
|
+
| `float()`/`vec2()`/`vec3()`/`vec4()` | 同名(但 TSL 中是 JS 函数) |
|
|
18
|
+
| `.mul()`/`.add()`/`.sub()`/`.div()` | `*`/`+`/`-`/`/` |
|
|
19
|
+
| `sin()`/`cos()`/`mix()`/`smoothstep()` | 同名 |
|
|
20
|
+
| `clamp()`/`abs()`/`fract()`/`floor()` | 同名 |
|
|
21
|
+
| `pow()`/`exp()`/`sqrt()`/`dot()`/`length()` | 同名 |
|
|
22
|
+
| `Fn()` | shader 函数包裹器(内联到 GLSL) |
|
|
23
|
+
| `uniform()` | `uniform <type> name` |
|
|
24
|
+
| `convertToTexture()` | RTT(多 pass 渲染) |
|
|
25
|
+
| `.sample(uv)` | `texture(sampler, uv)` |
|
|
26
|
+
| `.toVar()`/`.assign()` | 声明/赋值可变变量 |
|
|
27
|
+
| `.oneMinus()` | `1.0 - x` |
|
|
28
|
+
|
|
29
|
+
## 重建步骤
|
|
30
|
+
|
|
31
|
+
1. **定位**:搜索组件名附近的 `fragmentNode` 属性
|
|
32
|
+
2. **映射表**:从 bundle 顶部 import 语句推断 minified → TSL 函数名
|
|
33
|
+
```javascript
|
|
34
|
+
import { A as screenUV, W as sin, ... } from "three-module"
|
|
35
|
+
```
|
|
36
|
+
3. **翻译**:链式调用 → GLSL 表达式
|
|
37
|
+
```javascript
|
|
38
|
+
// TSL: screenUV.x.sub(center.x).mul(aspect)
|
|
39
|
+
// GLSL: (uv.x - center.x) * aspect
|
|
40
|
+
```
|
|
41
|
+
4. **RTT**:`convertToTexture(childNode)` → 独立 pass 渲染到 FBO,主 shader 中 `texture()` 采样
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Unicorn Studio 提取工作流
|
|
2
|
+
|
|
3
|
+
Unicorn Studio (unicorn.studio) 是一个 no-code WebGL 设计工具,使用 curtains.js 作为渲染引擎,Firebase/Firestore 作为后端。
|
|
4
|
+
|
|
5
|
+
## 识别特征
|
|
6
|
+
|
|
7
|
+
- URL 模式: `unicorn.studio/remix/{remixId}` 或 `unicorn.studio/edit/{designId}`
|
|
8
|
+
- Meta tag: `<meta name="ai:technical-stack" content="Vue 3, curtains.js, Firebase, JavaScript SDK">`
|
|
9
|
+
- 嵌入 SDK: `unicornStudio-*.js`(~84KB embed 版本)
|
|
10
|
+
- 主应用 bundle: `index-*.js`(~2.1MB,含 shader 模板)
|
|
11
|
+
|
|
12
|
+
## 数据获取路径
|
|
13
|
+
|
|
14
|
+
### 路径 1: Firestore REST API(推荐,适用于 remix)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Firebase 配置(从 unicorn.studio 前端 JS bundle 中提取,每次提取时动态获取)
|
|
18
|
+
# 获取方式:curl -s https://www.unicorn.studio/ | grep -oP 'apiKey:"[^"]+"' | head -1
|
|
19
|
+
API_KEY="<从网站 bundle 动态提取>"
|
|
20
|
+
PROJECT="unicorn-studio"
|
|
21
|
+
|
|
22
|
+
# Step 1: 获取 remix 元数据(含 versionId、designId、cre建者信息)
|
|
23
|
+
curl -s "https://firestore.googleapis.com/v1/projects/$PROJECT/databases/(default)/documents/remixes/{REMIX_ID}?key=$API_KEY"
|
|
24
|
+
|
|
25
|
+
# Step 2: 获取版本数据(含所有图层定义、参数、纹理引用)
|
|
26
|
+
# versionId 从 Step 1 的 fields.versionId.stringValue 提取
|
|
27
|
+
curl -s "https://firestore.googleapis.com/v1/projects/$PROJECT/databases/(default)/documents/versions/{VERSION_ID}?key=$API_KEY"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 路径 2: GCS/CDN Embed 数据(适用于已发布的嵌入)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 非 Pro 用户
|
|
34
|
+
curl -s "https://storage.googleapis.com/unicornstudio-production/embeds/{DESIGN_ID}"
|
|
35
|
+
|
|
36
|
+
# Pro 用户
|
|
37
|
+
curl -s "https://assets.unicorn.studio/embeds/{DESIGN_ID}"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Embed JSON 格式: `{ options: {...}, layers/history: [...], modules: [...] }`
|
|
41
|
+
包含 `compiledFragmentShaders[]` 和 `compiledVertexShaders[]`(已编译的 GLSL)。
|
|
42
|
+
|
|
43
|
+
### 路径 3: 从页面内嵌 JSON 提取
|
|
44
|
+
|
|
45
|
+
Unicorn Studio 嵌入使用 `data-us-project` 或 `data-us-project-src` HTML 属性,
|
|
46
|
+
SDK `init()` 会扫描这些属性并加载对应项目。
|
|
47
|
+
|
|
48
|
+
## 先判断数据形态
|
|
49
|
+
|
|
50
|
+
Unicorn Studio 至少有两种常见数据形态:
|
|
51
|
+
|
|
52
|
+
### 1. embed/export scene
|
|
53
|
+
|
|
54
|
+
- 一般是最终给 `addScene()` 的 scene JSON
|
|
55
|
+
- 往往已经带 `compiledFragmentShaders[]` / `compiledVertexShaders[]`
|
|
56
|
+
- 这种格式可以直接喂给 embed runtime
|
|
57
|
+
|
|
58
|
+
### 2. editor/version history
|
|
59
|
+
|
|
60
|
+
- 常见来源是 Firestore `versions/{id}` 的 `history`
|
|
61
|
+
- 这是编辑器原始层数据,**不能**直接喂给 `addScene()`
|
|
62
|
+
|
|
63
|
+
如果把 `history` 误当 embed scene,典型症状是:
|
|
64
|
+
|
|
65
|
+
- `Plane: No fragment shader provided, will use a default one`
|
|
66
|
+
- `Plane: No vertex shader provided, will use a default one`
|
|
67
|
+
- `No composite shader data for element`
|
|
68
|
+
- canvas 创建成功,但画面全黑或只剩默认层
|
|
69
|
+
|
|
70
|
+
## Firestore 集合结构
|
|
71
|
+
|
|
72
|
+
| Collection | 用途 | 关键字段 |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| `designs` | 设计元数据 | creatorId, name, versionId, hasEmbed |
|
|
75
|
+
| `versions` | 版本数据(核心) | history[], options |
|
|
76
|
+
| `remixes` | 可 remix 设计 | designId, versionId, creatorId, thumbnail |
|
|
77
|
+
|
|
78
|
+
## 版本数据结构
|
|
79
|
+
|
|
80
|
+
Firestore REST 返回格式用 `{stringValue, integerValue, arrayValue, mapValue, ...}` 包裹,需递归解析。
|
|
81
|
+
|
|
82
|
+
`history` 数组中每个元素是一个图层:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
layerType: "effect" | "text" | "image" | "model" | "shape"
|
|
86
|
+
type: 效果类型 (gradient, noiseFill, sdf_shape, glyphDither, bloomFast, ...)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 图层参数(常见)
|
|
90
|
+
|
|
91
|
+
- `pos`, `scale`, `speed`, `opacity`, `blendMode`
|
|
92
|
+
- `trackMouse`, `trackAxes`, `mouseMomentum`
|
|
93
|
+
- `parentLayer`: UUID 或 false(关联父元素)
|
|
94
|
+
- `breakpoints[]`: 响应式断点配置
|
|
95
|
+
- `states`: appear/scroll/hover/mousemove 动画
|
|
96
|
+
- `customFragmentShaders[]`, `customVertexShaders[]`(通常为空,用内置效果时)
|
|
97
|
+
|
|
98
|
+
## 正确初始化策略
|
|
99
|
+
|
|
100
|
+
如果拿到的是 Firestore `version/history`,优先模仿站点自己的初始化链路,不要硬套 embed API。
|
|
101
|
+
|
|
102
|
+
典型调用顺序:
|
|
103
|
+
|
|
104
|
+
1. `unpackageHistory()` 或 `unpackVersion()`
|
|
105
|
+
2. `createFontScript()`
|
|
106
|
+
3. `createCurtains()`
|
|
107
|
+
4. `handleItemPlanes()`
|
|
108
|
+
5. `fullRedraw()`
|
|
109
|
+
|
|
110
|
+
如果页面 bundle 里有专门的 Remix/Preview 组件,优先跟着它走,不要只看公开 UMD/SDK 文档。
|
|
111
|
+
|
|
112
|
+
### 资源本地化
|
|
113
|
+
|
|
114
|
+
- image/font/texture 尽量下载到本地
|
|
115
|
+
- `history` 里的 `src`、`fontCSS.src` 要改成本地路径
|
|
116
|
+
- 某些对象字段可能是数字 key 的 map,落地前要规整成数组
|
|
117
|
+
|
|
118
|
+
### 效果类型特有参数
|
|
119
|
+
|
|
120
|
+
| 效果 | 关键参数 |
|
|
121
|
+
|---|---|
|
|
122
|
+
| gradient | fill[], stops[], gradientType, gradientAngle, wrap |
|
|
123
|
+
| noiseFill | noiseType, turbulence, color1, color2, colorPhase, chroma, direction |
|
|
124
|
+
| sdf_shape | shape(0-22), refraction, extrude, smoothing, axis, animationDirection, lightPosition |
|
|
125
|
+
| glyphDither | characters, glyphSet, scale, gamma, monochrome, texture(sprite atlas) |
|
|
126
|
+
| bloomFast | amount, intensity, exposure, tint |
|
|
127
|
+
|
|
128
|
+
## Shader 代码提取
|
|
129
|
+
|
|
130
|
+
**关键发现**: Embed SDK(~84KB)不含 GLSL shader 代码。Shader 模板在主应用 bundle(~2.1MB)中,经 7 步编译管线处理后存入 embed JSON。
|
|
131
|
+
|
|
132
|
+
### Shader 在 App Bundle 中的位置
|
|
133
|
+
|
|
134
|
+
Shader 模板是字符串字面量,通过变量名标识:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
效果名 → 变量名
|
|
138
|
+
glyphDither → X$ (fragment)
|
|
139
|
+
noiseFill → WY (fragment)
|
|
140
|
+
sdf_shape → XY (fragment)
|
|
141
|
+
gradient → eX (fragment)
|
|
142
|
+
bloomFast → Hj (fragment)
|
|
143
|
+
通用顶点 → ye (vertex)
|
|
144
|
+
梯度顶点 → ko (vertex)
|
|
145
|
+
合成片段 → Uz (composite fragment)
|
|
146
|
+
合成顶点 → Nz (composite vertex)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
注意:变量名会随构建版本变化,需搜索关键特征定位。
|
|
150
|
+
|
|
151
|
+
### 模板变量
|
|
152
|
+
|
|
153
|
+
Shader 模板中含 `${variable}` 占位符,编译时替换:
|
|
154
|
+
|
|
155
|
+
| 变量 | 内容 |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `${fe}` | mask 相关 uniform 声明 |
|
|
158
|
+
| `${Vt}` | 图层混合辅助函数 (applyLayerMix, applyLayerMixAlpha, applyLayerMixClip) |
|
|
159
|
+
| `${gt}` | PCG hash / 随机数函数 (pcg2d, randFibo) |
|
|
160
|
+
| `${ht}` | 混合模式函数 (17 种模式: Normal, Add, Multiply, Screen, Overlay, ...) |
|
|
161
|
+
| `${pe("var")}` | mask 应用 + fragColor 输出 |
|
|
162
|
+
| `${wf}` | BCC noise derivatives (OpenSimplex2S) |
|
|
163
|
+
| `${Aa}` | Perlin noise 函数 |
|
|
164
|
+
| `${yr}` | deband 抖动函数 |
|
|
165
|
+
| `${cm}` | 渐变颜色/停止点 uniform 声明 |
|
|
166
|
+
| `${xz}` | 高斯权重函数 (bloom blur) |
|
|
167
|
+
|
|
168
|
+
### 编译管线
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
1. Fz(): 替换 uniform 值为常量
|
|
172
|
+
2. Dz(): 处理渐变颜色数量(switch case 裁剪)
|
|
173
|
+
3. Mz(): 求值常量 switch(死代码消除)
|
|
174
|
+
4. Rz(): 处理 #ifelseopen/#ifelseclose 块(条件编译)
|
|
175
|
+
5. Iz(): 移除未使用函数
|
|
176
|
+
6. Cz(): 移除未使用 uniform 声明
|
|
177
|
+
7. Bp(): 去注释、规范化空白
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 渲染管线(核心,移植时必须正确还原)
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
curtains.js WebGL2 渲染器
|
|
184
|
+
├─ 每个效果图层 = 一个 Plane + 独立 FBO
|
|
185
|
+
├─ 图层按 renderOrder 线性链式渲染,每个 plane 读前一个 FBO 为 uTexture
|
|
186
|
+
├─ Element(shape/text/image)+ 子效果形成 render group:
|
|
187
|
+
│ 1. Element 自身 plane 先渲染 → FBO_elem
|
|
188
|
+
│ 2. 子效果按 effects 数组顺序依次渲染 → FBO_child1, FBO_child2, ...
|
|
189
|
+
│ 3. Composite plane 最后渲染:alpha-blend 子效果输出到背景场景
|
|
190
|
+
├─ 独立后处理效果 (parentLayer=false) 处理全局场景
|
|
191
|
+
└─ 最后一个 plane 直接输出到 canvas(无 FBO)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Element + 子效果的 FBO 链(关键)
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
以 shape group (sdf + noise) 为例:
|
|
198
|
+
|
|
199
|
+
FBO_before ─────────────────────────────────────────┐
|
|
200
|
+
│
|
|
201
|
+
Shape 自身 plane → FBO_shape (渲染基础几何) │
|
|
202
|
+
↓ │
|
|
203
|
+
Child noiseFill → FBO_noise (uBgTexture = FBO_shape) │
|
|
204
|
+
↓ │
|
|
205
|
+
Child sdf_shape → FBO_sdf (uTexture = FBO_noise) │
|
|
206
|
+
↓ (showBg=0: 形状外 = vec4(0) 透明) │
|
|
207
|
+
↓ │
|
|
208
|
+
Composite plane → FBO_result │
|
|
209
|
+
uTexture = FBO_sdf (最后一个子效果输出) │
|
|
210
|
+
uBgTexture = FBO_before (element 之前的场景) ←─────┘
|
|
211
|
+
output = alpha_blend(fg, bg) = fg + bg * (1 - fg.a)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 子效果关联机制
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
// Element 的 effects 数组 → 子效果的 parentLayer UUID 列表
|
|
218
|
+
shape.effects = ["e270a7cd-...", "fb591190-..."]
|
|
219
|
+
|
|
220
|
+
// 每个子效果引用父 element 的 UUID
|
|
221
|
+
noiseFill.parentLayer = "e270a7cd-..." // effects[0]
|
|
222
|
+
sdf_shape.parentLayer = "fb591190-..." // effects[1]
|
|
223
|
+
|
|
224
|
+
// embed SDK 中查找子效果:
|
|
225
|
+
getChildEffectItems() {
|
|
226
|
+
return this.effects.map(uuid =>
|
|
227
|
+
state.layers.find(l => l.parentLayer === uuid)
|
|
228
|
+
).filter(Boolean)
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### uTime 时间基准(关键陷阱)
|
|
233
|
+
|
|
234
|
+
Embed SDK 中 `uTime` **不是秒数**,而是逐帧累加:
|
|
235
|
+
```js
|
|
236
|
+
// setEffectPlaneUniforms() 中:
|
|
237
|
+
t.uniforms.time.value += speed * 60 / this.fps;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
在 60fps 下:`uTime += speed` 每帧。1 秒后 `uTime = speed × 60`。
|
|
241
|
+
|
|
242
|
+
| 效果层 | speed | 1 秒后 uTime |
|
|
243
|
+
|--------|-------|-------------|
|
|
244
|
+
| noiseFill | 0.25 | 15 |
|
|
245
|
+
| sdf_shape | 0.5 | 30 |
|
|
246
|
+
| gradient | 0.25 | 15 |
|
|
247
|
+
|
|
248
|
+
**移植时必须乘以 `speed × 60`**,否则动画慢 15-60 倍:
|
|
249
|
+
```js
|
|
250
|
+
// 正确:
|
|
251
|
+
uni1f(prog, 'uTime', elapsedSeconds * speed * 60);
|
|
252
|
+
// 错误:
|
|
253
|
+
uni1f(prog, 'uTime', elapsedSeconds);
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### showBg 参数的关键作用
|
|
257
|
+
|
|
258
|
+
- `showBg=0`:光线未命中几何体时输出 `vec4(0)` **透明**(不是黑色!)
|
|
259
|
+
- `showBg=1`:光线未命中时采样 `uTexture/uBgTexture`(显示背景内容)
|
|
260
|
+
|
|
261
|
+
**移植时 showBg=0 是最常见的陷阱**:如果错误地输出 `vec4(0,0,0,1)` 不透明黑色,
|
|
262
|
+
composite alpha blend 会被覆盖而不是透过下方图层。必须确保 alpha=0。
|
|
263
|
+
|
|
264
|
+
## 移植策略
|
|
265
|
+
|
|
266
|
+
1. **纯 2D 后处理效果** (glyphDither, bloomFast): 原生 WebGL2 全屏四边形
|
|
267
|
+
2. **生成式效果** (noiseFill, gradient): 原生 WebGL2
|
|
268
|
+
3. **3D SDF** (sdf_shape): 原生 WebGL2 raymarching
|
|
269
|
+
4. **复杂场景** (多图层合成): 需要 multi-pass FBO 管线
|
|
270
|
+
5. **文字图层**: Canvas 2D 渲染文字 → 作为纹理上传 WebGL
|
|
271
|
+
|
|
272
|
+
## Playwright 验证
|
|
273
|
+
|
|
274
|
+
Playwright 默认 headless 环境可能没有可用 WebGL。出现下面症状时,先怀疑环境,不要立刻怀疑提取逻辑:
|
|
275
|
+
|
|
276
|
+
- `Renderer: WebGL context could not be created`
|
|
277
|
+
- `0 canvas(es) found`
|
|
278
|
+
- `Error creating Curtains instance`
|
|
279
|
+
- 截图纯黑
|
|
280
|
+
|
|
281
|
+
这时改用 `swiftshader` 再验证:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
--use-angle=swiftshader
|
|
285
|
+
--use-gl=angle
|
|
286
|
+
--enable-unsafe-swiftshader
|
|
287
|
+
--ignore-gpu-blocklist
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
建议验证顺序:
|
|
291
|
+
|
|
292
|
+
1. 看 console 是 shader/runtime 错误,还是 WebGL context 创建失败
|
|
293
|
+
2. 看 DOM 里是否真的生成了 `canvas`
|
|
294
|
+
3. 用 `swiftshader` 截图
|
|
295
|
+
4. 和原站缩略图或首屏截图做构图对比
|
|
296
|
+
|
|
297
|
+
### Glyph Atlas 生成
|
|
298
|
+
|
|
299
|
+
原始 glyph atlas 是 base64 PNG(存在跨浏览器兼容问题)。
|
|
300
|
+
推荐用 Canvas 2D 动态生成:
|
|
301
|
+
|
|
302
|
+
```js
|
|
303
|
+
function createGlyphAtlas(chars, size = 40) {
|
|
304
|
+
const canvas = document.createElement('canvas');
|
|
305
|
+
canvas.width = size * chars.length;
|
|
306
|
+
canvas.height = size;
|
|
307
|
+
const ctx = canvas.getContext('2d');
|
|
308
|
+
ctx.fillStyle = '#000';
|
|
309
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
310
|
+
ctx.fillStyle = '#fff';
|
|
311
|
+
ctx.font = `bold ${size * 0.8}px monospace`;
|
|
312
|
+
ctx.textAlign = 'center';
|
|
313
|
+
ctx.textBaseline = 'middle';
|
|
314
|
+
for (let i = 0; i < chars.length; i++) {
|
|
315
|
+
ctx.fillText(chars[i], size * i + size / 2, size / 2);
|
|
316
|
+
}
|
|
317
|
+
return canvas; // → gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas)
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Cloud Functions 端点
|
|
322
|
+
|
|
323
|
+
所有位于 `https://us-central1-unicorn-studio.cloudfunctions.net/`:
|
|
324
|
+
- `publishEmbedTest` — 发布/更新 embed(需认证)
|
|
325
|
+
- `getUserIdByUsername` — 用户名→userId
|
|
326
|
+
- `handleVideos/handleModels/handleImages` — 资源处理
|
|
327
|
+
- `generateImprovedMSDF` — MSDF 文字渲染
|
|
328
|
+
- `generateDepthMap` — 深度图生成
|
|
329
|
+
- `copyRemixAssets` — remix 资源复制
|
|
330
|
+
|
|
331
|
+
## 示例:完整提取流程
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# 1. 从 URL 提取 remix ID
|
|
335
|
+
REMIX_ID="QZxhNFb1X1OaUqaJLT9S"
|
|
336
|
+
|
|
337
|
+
# 2. 获取 remix 元数据
|
|
338
|
+
curl -s "https://firestore.googleapis.com/v1/projects/unicorn-studio/databases/(default)/documents/remixes/$REMIX_ID?key=$API_KEY" > remix.json
|
|
339
|
+
|
|
340
|
+
# 3. 提取 versionId
|
|
341
|
+
VERSION_ID=$(python3 -c "import json; print(json.load(open('remix.json'))['fields']['versionId']['stringValue'])")
|
|
342
|
+
|
|
343
|
+
# 4. 获取版本数据
|
|
344
|
+
curl -s "https://firestore.googleapis.com/v1/projects/unicorn-studio/databases/(default)/documents/versions/$VERSION_ID?key=$API_KEY" > version.json
|
|
345
|
+
|
|
346
|
+
# 5. 解析版本数据中的图层和参数 → 用 Python/Node 递归解析 Firestore REST 格式
|
|
347
|
+
|
|
348
|
+
# 6. 从 app bundle 提取对应效果类型的 shader 模板
|
|
349
|
+
curl -s "https://www.unicorn.studio/assets/index-*.js" > app-bundle.js
|
|
350
|
+
# 搜索效果类型名定位 shader 代码
|
|
351
|
+
|
|
352
|
+
# 7. 组合参数 + shader 模板 → 构建独立 WebGL2 项目
|
|
353
|
+
```
|