灯光/激光表演模拟器的推荐 3D 编程方面?
嘿伙计们,我想开发一个光/激光表演编辑器和模拟器,为此我当然要学习一些图形编程。我正在考虑使用 C# 和 XNA。
我只是想知道鉴于我正在从事的项目,我应该研究或关注图形编程的哪些方面。我是图形编程的新手,所以我对此了解不多,但例如我想象我可能会研究的东西(可能?)是体积照明。
例如,渲染不同宽度/颜色的“激光”的实用方法是什么?我在某处读到只绘制一个圆柱体并对其应用着色器,我想确认这就是方法。
鉴于这似乎是一个大项目,我正在考虑从创建光源并赋予它们属性开始,以便我可以轻松地操纵它们。我(误)读到在任何给定时间只能渲染一定数量的灯光,我相信是八个。这仅适用于环境光吗?考虑到这种可能的限制,以及我将使用的大多数灯光都是定向的这一事实,例如头灯或激光,渲染这些灯光的不同方式是什么?这就是体积照明吗?
在深入探讨之前,我想先弄清楚一些事情。因为我是新手,所以我可能没有充分利用文字,所以如果有什么地方没有意义,请告诉我。感谢并为我的无知感到抱歉。
Hey guys, I would like to develop a light/laser show editor and simulator, and for this of course I am going to learn some graphics programming. I am thinking about using C# and XNA.
I was just wondering what aspects of graphics programming I should research or focus on given the project I am working on. I am new to graphics programming so I don't know much about it, but for example I imagine something that I might look into would (possibly?) be volumetric lighting.
For example, what would be a practical way to go about rendering a 'laser' of varied width/color? I read somewhere to just draw a cylinder and apply a shader to it, I would like to confirm that this is the way.
Given that this seems like a big project, I was thinking about starting off by creating light sources and giving them properties so that I can easily manipulate them. I have (mis)read that only a certain amount of lights can be rendered at any given time, I believe eight. Does this only apply to ambient lights? Given this possible limitation, and the fact that most of the lights I will use will be directional, such as head-lights or lasers, what would be a different way to render these? Is that what volumetric lighting would be?
I'd just like to get some things clear before I dive into it. Since I'm new to this I probably didn't make the best use of words, so if something doesn't make sense please let me know. Thanks and sorry for my ignorance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个问题的答案取决于显示模拟所需的复杂程度。计算机图形学最终是对光传输的模拟。该模拟可以像计算被大气中的粒子偏转到观察者视点的激光的比例一样复杂,也可以像画一条线一样简单。尝试一下圆柱体效果,看看它是否适合您的项目。如果您需要更复杂的东西,请研究着色器编程(例如使用 Nvidia Cg),以及您提到的体积着色;后期处理发光效果也可能有用。对于OpenGL,我相信有8个限制?场景中的光源,但您可以通过执行自己的着色逻辑来解决此限制。
The answer to this depends on the level of sophistication that you need in your display simulation. Computer graphics is ultimately a simulation of the transport of light; that simulation can be as sophisticated as calculating the fraction of laser light deflected by particles in the atmosphere to the viewer's eyepoint, or as simple as drawing a line. Try out the cylinder effect and see if it works for your project. If you need something more sophisticated, look into shader programming (using Nvidia Cg, for example), and volumetric shading as you mentioned; also post-processing glow effects may be useful. For OpenGL, I believe there is a limit of 8? light sources in a scene, but you could conceivably work around this limit by doing your own shading logic.
好吧,如果只是为了灯光秀模拟,我想您将需要大量自定义灯光效果 - 因此,无论您决定使用 XNA 还是直接 DirectX,您最好的选择是从学习着色器语言以及如何对各种编程进行编程开始使用它们的灯光效果。一旦您可以重现所需的激光照明类型,您就可以尝试用于表示激光的多边形。 (我在一些工作中出于个人目的使用了圆柱体方法,但我不确定直圆柱体是否适合您的目的)。
Well if it's just for light show simulations I'd imagine your going to need a lot of custom lighting effects - so regardless if you decide to use XNA or straight DirectX your best bet would be to start by learning shader languages and how to program various lighting effects using them. Once you can reproduce the type of laser lighting you want, then you can experiment with the polygons you want to use to represent the lasers. (I've used the cylinder method in some of my work for personal purposes, but I'm not sure how well straight cylinders will fit your purpose).
虽然速度更快,但我认为最好不要使用普通硬件照明,因为它有其局限性。像素着色器可以帮助您完成任务。此外,您可能会选择 OpenGL,因为其可移植性及其渲染方法的清晰度。在转向 OpenGL 之前,我在 Direct3D 上工作了几年。 OpenGL 函数和状态更容易学习,渲染方法(如多通道渲染)也很清晰。如果您喜欢在 C# 上编写代码(我不推荐用于这些任务),您可以使用 CsGL 库来访问 OpenGL 函数。
Although its faster, I think its best not to use vanilla hardware lighting because of its limitations. Pixel shaders can help with you task. Also you may want to chose OpenGL because of portability and its clarity in rendering methods. I worked on Direct3D for several years before switching to OpenGL. OpenGL functions and states are easier to learn and rendering methods (like multi-pass rendering) is a lot clear. If you like to code on C# (which I dont recommend for these tasks), you can use CsGL library to access OpenGL functions.