English 中文(简体)
适当计算照明的方法
原标题:Proper way of calculating lighting

我在3D引擎中安装照明设备,发现我计算照明的方法有缺陷。在混合遮光镜中,我得到分散的颜色和照明计算。

return diffuseColor * (diffuseLight + ambient);

As far as I can tell, this is the standard way of doing things. But, for example, what if the color is 0,1,0, and the light is 1,0,0. (Ignore ambient in this example) The result would be 0,0,0. But in real life, if I get a pure green bit of paper, and shine a tinted red light onto it, it should turn out yellow. Or at least not black.

其他游戏如何解决这个问题?

最佳回答

A green paper will absorb red light and appear black, not yellow. Addition means you shine a white paper with red and green light. Then the paper appears yellow.

http://www.physics.wisc.edu/museum/Exhibits-2/Light_Optics/ColorObj/Color_index.html

问题回答

它应该是(对于每个RGB组成部分)

return (diffuseColor * diffuseLight) + ambient;

环境组件是固定的,在所有其他照明计算完成后添加,不取决于光线方向或观测方向。

正如Julio所说,绿纸在红灯下将显得黑色。

当某物看起来绿色时,它就是因为它吸收了光谱中的所有其他颜色,而左边的颜色(如绿色)被反射。如果你在它上照亮红灯,没有绿色可以被反射。





相关问题
3D Engine for Driving Simulation [closed]

Is there any open-source 3D graphics and physics engine specialized in driving simulation? Something like a configurable game engine targeted at games that involve driving, or something more ...

How to rotate 3d object on Z axis only?

We used 3DTools (http://3dtools.codeplex.com) to draw a 3d line, it allows user rotate it by mouse. I have question, how to limit user can rotate it on Z axis only? or on X axis, Y axis only? <...

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

Java - Zoom / 3D Data Visualization Libraries

What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java? I d like to be able to do some prototyping of creating new types of interfaces for navigating within data and ...

Using Unreal 3 Engine within a .NET application

Now that the Unreal Development Kit for Unreal 3 engine is free I am thinking about utilizing it for an appication. Do you think it is possible to emebedd a Unreal 3 powered 3D window into a .NET (WPF ...

WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

热门标签