问题标签 [direct3d9]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1071 浏览

c++ - Direct3D 9 阴影映射混合模式

我目前正在尝试在 direct3d 9 中的场景上绘制阴影。我正在尝试进行一些多通道渲染,但无法理解如何使用/设置混合模式。

我已经完成了一个填充深度缓冲区的深度通道,然后我有一个循环遍历场景中的所有灯光。在那个循环中,我有 2 个循环,它们都遍历场景中的所有形状

我有这种设置

在 pix 中,我可以看到它循环穿过每个灯,但是当我运行它时,只显示灯阵列中的最后一个灯。我认为这与混合模式有关。

我查看了混合模式并找到了有关源和目标混合的信息。这是我需要的吗/有人可以帮忙解释一下吗?

提前致谢,

标记

[编辑]我使用以下代码使两个灯都可见

阴影看起来不正确,但我越来越接近预期的结果。

任何更多的建议会很棒,

谢谢,

标记

0 投票
2 回答
641 浏览

direct3d - D3D9 应用程序是否与确切的 D3DX DLL 版本相关联?

如果我针对 D3DX June2007_d3dx9_34 构建我的应用程序并且目标系统具有更新的版本 Nov2007_d3dx9_36 这应该是个问题吗?

我使用 MS 的 redist-installer 工具分发 D3DX DLL,但我注意到一台“干净”的 PC(以前没有安装 D3DX)我收到关于缺少 D3DX DLL 的错误。在尝试确定安装程序本身是否无法正常工作之前,我想知道是否可能提供了一个太新版本的 DLL 是问题 - 应用程序会寻找具有确切名称的 DLL 吗?

0 投票
2 回答
1343 浏览

c++ - 使用 D3D,我是否需要在退出流程之前调用 release?

我正在为 direct3d 学习的教程是这样说的:

“...基本上,如果您创建 Direct3D,但从不关闭它,它会一直在计算机后台运行,直到您下次重新启动,即使在程序本身关闭之后也是如此。糟糕。如果你有很多游戏中的资源。释放这两个接口让一切都摆脱困境,并允许 Windows 收回它的内存。(链接

我真的不相信本教程所说的,退出进程后资源仍然会挂起......

就像我的程序崩溃或者我只是在调试时按停止..资源仍然存在吗?和其他使用directx的游戏,我经常通过杀死进程来关闭它们。

如果我退出我的进程并且不调用 device->Release,资源是否会免费提供给操作系统?

0 投票
5 回答
4406 浏览

c++ - 基于 2D 瓷砖的游戏,当我用相机放大时显示瓷砖精灵之间的间隙?

我正在使用 D3DXSPRITE 方法将我的地图图块绘制到屏幕上,我刚刚添加了一个缩放功能,当您按住向上箭头时会放大,但注意到您现在可以看到图块之间的间隙,这是一些屏幕截图

每个图块的正常尺寸 (32x32)

在此处输入图像描述

放大(您可以看到瓷砖之间的白色间隙)

在此处输入图像描述

缩小(甚至更糟!)

在此处输入图像描述

这是我翻译和缩放世界的代码片段。

这是我绘制的地图,(瓷砖位于瓷砖矢量的矢量中......我还没有完成剔除)

0 投票
2 回答
84 浏览

mesh - 该drawmesh操作刚刚绘制到哪些像素?

好的,这是一个相对简单的问题,我想知道在屏幕空间中,刚刚绘制了一个特定的网格。然后我计划将该信息存储在某种数据存储中,这样当我与屏幕空间中的某些东西交互时,我可以在寄存器中查找并找到对象,即单击屏幕上绘制的宇宙飞船,然后选择目标等等

我找不到任何方法来找出网格被绘制到的像素...

或者,如果我遗漏了一些关于我想要做什么的明显内容,请告诉我!

0 投票
2 回答
2257 浏览

directx - (DirectX9) Gamma correction applied implicitely

UPDATE:

Thank you all very much for your answers. As Jesse Hall suggested, it looks like it is a driver (or hardware) problem. I tried the same app on other configurations and it worked as expected.

I tested the app on other computers which share the same GPU (ATI 4800 HD) but different versions of the driver and they all showed the same erroneous behavior (what seems to be a double gamma correction on write). On these computers, if have to set D3DRS_SRGBWRITEENABLE to false to fix the display. Anyone knows if this is a known bug on this hardware?

Even more strange is that I get the same end results with these two configurations:

  • D3DRS_SRGBWRITEENABLE = FALSE and D3DSAMP_SRGBTEXTURE to TRUE
  • D3DRS_SRGBWRITEENABLE = FALSE and D3DSAMP_SRGBTEXTURE to FALSE

In the pixel debugger, I see that linearization is applied properly in case 1 but (automatic) correction on write gives the same output as case 2 (which performs no conversion at all)...

// -- END OF UPDATE

I'm having some trouble fixing the gamma correction of a DirectX9 application.

When I enable texture linearization in the samplers (D3DSAMP_SRGBTEXTURE) and sRGB write for output (D3DRS_SRGBWRITEENABLE), it looks like gamma correction is applied twice.

Here is my setup. I used the following texture (from here) to draw a fullscreen quad: enter image description here

The results were visually too bright on the right side of the picture. I used PIX to debug one of those grey pixels and, if everything was set up properly, I would have expected an output value of 0.73 (=0.5^(1.0/2.2)). Unfortunately, the output of the pixel shader was 0.871 (which looks like it could be a gamma correction applied twice ?). I stepped inside the pixel shader with the debugger and the texture fetch returned a value of (0.491, 0.491, 0.491), which should mean linearization on read worked properly.

enter image description here

When I disable D3DRS_SRGBWRITEENABLE, the output of the pixel shader is 0.729 which looks much more correct to me.

enter image description here enter image description here

Any idea where does this conversion come from (in the debugger the pixel shader output was 0.491)? What other flags/render states should I check?

Thank you very much for your help!

0 投票
2 回答
2360 浏览

c++ - 截屏 C++ directx 得到黑色图像

我正在尝试使用directx 进行屏幕截图。我尝试了几页的代码,这些代码解释了如何但总是得到黑屏。如果有人可以帮助我,我将不胜感激。

我的代码是:

0 投票
2 回答
1993 浏览

c++ - 来自 D3D 显示适配器 ID 的描述性监视器名称

正如问题所暗示的那样,我正在尝试提取描述性监视器名称以匹配显示适配器名称。下面的代码给了我一个像 \.\DISPLAY1 这样的设备 ID,这是可以理解的,但不是我想要的。

我查看了文档以了解从何处获取该实际名称,但直到现在我还没有找到它。有时我有点愚蠢(或者盲人,如果你愿意的话),所以我会在午休时间再试一次——但也许有人能指出我正确的方向?非常感谢。

(实际名称是指图形配置面板中显示的名称)

0 投票
1 回答
512 浏览

c++ - ID3DXFont::DrawText 修改 IDirect3DDevice9 vtable

我正在搞乱 Direct3D - 修改设备对象的 vtable 条目,以便调用我的函数而不是提供的函数。我注意到尽管这主要是有效的,但有时某些东西会恢复IDirect3DDevice9vtable,例如ID3DXFont::DrawText- 第一次调用;别有用心的不要碰它。

为什么会这样?

0 投票
2 回答
4495 浏览

direct3d - 如何使用“WaitForVBlank”在 Direct3d9 中获取 VSYNC 中断

我是 Direct3D9 的新手,正在尝试一些东西。我希望在“IDirect3DDevice9Ex”设备上使用“WaitForVSync”。但是,我不知道如何使用它并获得 VSYNC 中断。我在 MSDN 和任何代码片段上都找不到太多帮助。任何帮助,将不胜感激。

谢谢,莫茨