【问题标题】:converting a ShaderToy in to Webgl shader for the Three js ( need help )将 ShaderToy 转换为三个 js 的 Webgl 着色器(需要帮助)
【发布时间】:2018-10-13 07:40:39
【问题描述】:

你能帮我把这个着色器翻译成三个js吗!

this shadertoy

这样试了,就是白屏!

#ifdef GL_ES
precision mediump float;
#endif

#define F length(.5-fract(gl_FragColor.xyw*=mat3(-2,-1,2, 3,-2,1, 1,2,2)*

uniform vec2 u_resolution;

void main() {
    vec2 p = gl_FragCoord.xy / u_resolution.xy;
    gl_FragColor.xy = p*(gl_FragColor.w+.2)*.1;
    gl_FragColor = pow(min(min(F.5)),F.4))),F.3))), 7.)*25.+vec4(0,.35,.5,1);
}

请尝试使用此编辑器:

https://thebookofshaders.com/edit.php?log=180503054204

提前致谢 =)

【问题讨论】:

  • 嗨,欢迎来到堆栈溢出!请阅读:stackoverflow.com/help/mcve
  • u_resolution 传递了什么,剩下的代码THREE.ShaderMaterial 等在哪里
  • gl_FragColor.w 你希望这是什么?尝试用 0.5 代替那个
  • 或者实际上是gl_FragColor.w = 0.5;以上vec2 p
  • @pailhead 实际上,现在,我尝试通过这个编辑器来实现:thebookofshaders.com/edit.php?log=180503053430

标签: three.js glsl webgl shader fragment-shader


【解决方案1】:

哦!谢谢@pailhead...是的,你一开始就设置 gl_FragColor 是对的!

它解决了我的问题。

感谢您的帮助 =)

【讨论】:

    猜你喜欢
    • 2020-05-24
    • 2021-11-06
    • 1970-01-01
    • 2015-05-11
    • 2022-06-12
    • 1970-01-01
    • 2019-03-22
    • 2013-11-07
    • 1970-01-01
    相关资源
    最近更新 更多