使用 VB6 的 3D 软件渲染器
我是 IT 学生,我必须用 VB6 制作一个项目,我想制作一个 3D 软件渲染器,但我真的不知道从哪里开始,我找到了一些教程,但我想要一些深入数学的东西和算法,我会喜欢一些能够展示如何进行 3D 变换、相机、灯光、阴影...
使用的编程语言并不重要,我只需要一些资源来准确地展示如何进行此操作。
所以我只是想知道在哪里可以找到一些资源,或者你可以向我展示一些源代码并告诉我从哪里开始。
或者如果你们对 VB6 项目有更好的想法。
谢谢。
I am IT student and I have to make a project in VB6, I was thinking to make a 3D Software Renderer but I don't really know where to start, I found a few tutorials but I want something that goes in depth with the maths and algorithms, I will like something that shows how to make 3D transformations, Camera, lights, shading ...
It does not matter the programing language used, I just need some resources that shows me exactly how to make this.
So I just want to know where to find some resources, or you can show me some source code and tell me where to start from.
Or if any of you have a better idea for a VB6 project.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我不同意之前的帖子,3D 渲染器实际上非常简单。然而,高质量的 3D 渲染器很难。
现在您将失去深度缓冲区,因此一开始就坚持使用线框。 :-)
不要听这些反对者的话,出去玩吧!
I disagree with the previous posts, a 3D renderer is actually pretty simple. A high-quality 3D renderer is hard however.
Now you're going to lose out on a depth buffer, so stick to wireframes in the beginning. :-)
Don't listen to these nay-sayers, go out and have some fun!
许多年前,我制作了一个阴影三角形渲染器,它使用库调用来绘制三角形。这是一种相当幼稚的方法,但使用 VB6 也可以达到相同的结果。我得到了所有的数学和数学知识。 Foley 等人的《计算机图形原理与实践》中的技术。有些零件现在已经过时了,但我认为您会发现它对这个项目非常有帮助,并且可以例如从亚马逊以合理的价格购买二手的。
一种简单的方法可能是:
这涵盖了线框查看。要将其扩展到隐藏表面去除,您需要计算出哪些三角形在前面。两种可能的方法:
之后,您还需要某种基于光照的阴影。计算机图形学原理和实践中涵盖了计算。对于简单的着色,您可以坚持使用 gdi 绘制三角形,但如果您想要进行 gouraud 或 phong 着色,则整个三角形的颜色值会有所不同。解决这个问题的一种方法是将三角形细分为更小的三角形,但这种方法效率低下,并且不会给出非常漂亮的结果。更好的方法是按照上面软件深度缓冲区的要求自己绘制三角形。
一个好的扩展是支持三角形以外的图元。基本方法是在阅读基元时将它们分割成三角形。
祝你好运——可能是一个有趣的项目。
Many years ago I made a shaded triangle renderer that used library calls to draw the triangles. It's a rather naive approach but you would be able to achieve the same result using VB6. I got all the maths & techniques from "Computer Graphics principles and practice" by Foley et al. Some parts are out of date now but I think you'd find it very helpful for this project and it can be bought 2nd hand at reasonable prices from Amazon for example.
One simple approach could be:
This covers wireframe viewing. To extend this to hidden surface removal you need to work out which triangles are in front. Two possible ways:
After this you'd also need some kind of shading based on lighting. The calculations are covered in Computer Graphics principles and practice. For simple shading you can stick with drawing triangles using gdi , but if you want to do gouraud or phong shading the colour values vary across a triangle. One way around this is to sub-divide the triangle into smaller triangles, but this is inefficient and won't give very nice looking results. Better would be to draw the triangles yourself as required above for the software depth buffer.
A good extension would be to support primitives other than triangles. Basic approach would be to split primitives into triangles as you read them.
Good luck - could be an interesting project.
VB6 并不是最适合做数学和 3D 图形的语言,并且考虑到您之前也没有关于该主题的知识,我建议您选择不同的(并且更简单的)语言。
因为它是 Visual Basic,所以你可以尝试一些更面向形式的东西,这就是该语言的初衷。
VB6 is not the best suited language to do maths and 3D graphics, and given that you have no previous knowledge about the subject either, I would recommend you to choose something different (and easier).
As it's Visual Basic, you could try something more form-oriented, that is the original intent of the language.
有 3D 引擎列表,其中列出了三个纯基本引擎(矛盾修饰法)+源代码及其其中一种是 Visual Basic (Dex3D)
There is the 3D engine list which lists three engine in pure basic (an oxymoron) + Source code and of them one is in Visual Basic (Dex3D)
EGL25 作者:Erkan Sanli是一个快速开源 VB 6 渲染器,可以渲染、旋转、动画等由数千个多边形组成的复杂实体形状。只是 Windows API 调用 – 没有 DirectX,没有 OpenGL。
VBMigration.com 选择 EGL25 作为高质量的开放式源VB6项目来演示他们的VB6到VB.Net的升级工具。
EGL25 by Erkan Sanli is a fast open source VB 6 renderer that can render, rotate, animate, etc. complex solid shapes made of thousands of polygons. Just Windows API calls – no DirectX, no OpenGL.
VBMigration.com chose EGL25 as a high-quality open-source VB6 project to demonstrate their VB6 to VB.Net upgrade tool.
如果您以前从未使用过,那么 3D 软件渲染器作为整个项目是相当复杂的。我建议做一些更小的事情——比如只做 3D 部分并使用线条进行渲染,或者只编写一个阴影三角形渲染器(无论如何,这是 3D 渲染器的基础)。
比一开始就尝试编写成熟的 3D 软件渲染器更简单一些 - 尤其是在 VB 中。
A 3D software renderer as a whole project is fairly complex if you've never done it before. I would suggest something smaller - like just doing the 3D portion and using lines to do the rendering OR just write a shaded triangle renderer (which is the underpinnings of 3D renderers anyway).
Something a little simpler rather than trying to write a full-blown 3D software renderer on the first go - especially in VB.
软件渲染器是一个非常困难的项目,并且根本没有指出 VB6 语言(对于像这样的任务,c++ 就是这样。),无论如何,我可以向您推荐一些我使用过的好书:
还有其他2本书。即使它们适用于 VB.NET,您也可以找到一些有用的代码:
A software renderer is a very difficult project and the language VB6 is not indicated at all ( for a task like this c++ is the way.. ), anyway I can suggest you some great books I used:
There are other 2 books. Even if they are for VB.NET you can find some useful code:
我认为您可以采取两种方法,要么采用 Direct X 方式,要么使用支持 VB 5-6 的 DirectX 8。我找到了一个页面 http://www.gamedev.net/reference/articles/article1308。 asp
你总是可以编写一个引擎组,但是这样做你将需要一些基本的线性代数,就像 Frank Krueger 所建议的那样。
I think you can take two ways either go the Direct X way and use DirectX 8 that has VB 5-6 support. I found a page http://www.gamedev.net/reference/articles/article1308.asp
You can always write a engine group up but by doing so you will need some basic linear algebra like Frank Krueger suggests.