Giter VIP home page Giter VIP logo

shadertoy's Introduction

Shader DEMO

开始预览

使用vscode并安装以下插件

"stevensona.shader-toy",
"raczzalan.webgl-glsl-editor"

右击shadertoy: show GLSL preview

避免在 shader 中使用 if else 等流程控制

https://www.bilibili.com/read/cv1469216/

动态分支会损害 GPU 性能。

GPU 使用了不同于 CPU 的技术来实现分支语句,在最坏的情况下,我们花在一个分支语句的时间相当于运行了所有分支语句的时间,因此不鼓励在 shader 中使用流程控制语句,因为他们会降低 GPU 的并行处理操作(尽管在现代的 GPU 上已经有了改进)

而且shader的思维是函数思维,每个像素执行相同的函数输出对应的颜色值,每个像素线程是不共享的没有记忆的,需要统一的函数去控制。

为此所必备的网站如下:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.