小编Tam*_*man的帖子

解决奇怪的行为:glsl/金属着色器。(无意识的坐标翻转)

我有这个着色器,我从着色器玩具移植到 iOS 的金属着色器中。原来的工作正常,但现在我已经把它移到了 iOS,我得到了一些奇怪的行为。基本上,在着色器运行的前几秒钟,一切都没有对齐。我认为这是因为 X 轴上有镜像,这是正确的,但垂直坐标也以某种方式在一侧翻转。谁能告诉我我应该如何解决这个问题?

原始Shadertoy:https ://www.shadertoy.com/view/ltl3Dj

我的版本,转换成金属着色语言:

#include <metal_stdlib>
using namespace metal;

////////////////

///CSB CONSTANTS (not required, just make sure it's handled properly at the bottom)
constant float2 resolution = (1, 1);
constant float contrast = 1.0;
constant float saturation = 1.02;
constant float brightness = 1.5;

struct FloweringQuadVertexToFragmentVariables
{
    //basic Active Shader Variables
    float4 position [[ position ]];
    float2 textureCoordinates;
    float time;

    //Shader specific variables go here (not required)

};

vertex FloweringQuadVertexToFragmentVariables FloweringQuadVertexShader (constant float4 *positions …
Run Code Online (Sandbox Code Playgroud)

shader glsl ios metal

2
推荐指数
1
解决办法
905
查看次数

标签 统计

glsl ×1

ios ×1

metal ×1

shader ×1