为什么Unity着色器在编辑器游戏模式下为粉红色,但在编辑器场景模式下是正确的?

发布于 2025-01-28 04:20:09 字数 480 浏览 1 评论 0原文

我正在使用通用渲染管道,我构建了一个显然效果很好的着色器。

这是显示结果的图像,请注意,我在场景选项卡中

这是在“游戏”选项卡中显示结果的图像

当我设置_cameraopaquetext for for the Sharder时,我开始遇到此问题。 我在管道设置中启用了不透明的纹理。

我还尝试使用正确连接到相机的渲染纹理,但结果是相同的。

我试图在项目设置中包含着色器,尝试使用不同的摄像机,禁用后处理,但结果仍然相同。

你们是否有提示如何解决此问题?

任何帮助都非常感谢

I am using Universal Render Pipeline, I built a shader which apparently works good.

here is the image showing the result, please note that I am in the scene tab

here is the image showing the result in the game tab

I started getting this problem when I set _CameraOpaqueTexture for the shader.
I enabled opaque textures in the pipeline settings.

I also tried to use a render texture correctly connected to a camera but result is the same.

I tried to include the shader in the project settings, tried using different cameras, disable post processing but the result is still the same.

Do you guys have an hint on how to fix this problem?

Any help is much appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唯憾梦倾城 2025-02-04 04:20:09

我发现问题是什么,在我的着色器中,我正在使用这些功能:

struct v2f
        {
            ......
            UNITY_FOG_COORDS(1);
           ......
        };

然后:

v2f vert (appdata v)
        {
            .......
            UNITY_TRANSFER_FOG(o,o.vertex);
            ......
        }

我不知道为什么使用这些功能不起作用,也许是我身边的错误,但是避免了这些功能,我实际上可以看到我的着色器在游戏中。

I Found what the problem is, in my shader I was using these functions:

struct v2f
        {
            ......
            UNITY_FOG_COORDS(1);
           ......
        };

and then:

v2f vert (appdata v)
        {
            .......
            UNITY_TRANSFER_FOG(o,o.vertex);
            ......
        }

I don't know exactly why using these is not working, maybe is a mistake by my side, but avoiding those functions I can actually see my shader in game.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文