【问题标题】:3D Viewport to 2D Image3D 视口到 2D 图像
【发布时间】:2013-07-19 10:52:42
【问题描述】:

这是我非常简单的光线追踪器的视口类。

public sealed class ViewPort
{
    public readonly Rectangle3D Rectangle;

    public readonly int Width;
    public readonly int Height;

    public Bitmap Image { get; private set; }

    public ViewPort(Rectangle3D rec, int width, int height)
    {
        this.Rectangle = rec;

        this.Width = width;
        this.Height = height;

        this.Image = new Bitmap(this.Width, this.Height);
    }

    public bool TryRecord(Ray ray)
    {
        Point3D cross;
        if (this.Rectangle.Intersect(ray, out cross))
        {
            this.Image.SetPixel(cross...,ray.Light);
        }
        else
        {
            return false;
        }
    }
}

好的,现在如何将 3 维点映射到二维图像?非常感谢您的帮助。谢谢。

【问题讨论】:

  • 你要透视投影公式吗?还是要对 2D 图像平面的像素进行着色?

标签: c# .net linear-algebra raytracing


【解决方案1】:

像往常一样,最好是查看 Scratchapixel.com,它详细解释了所有这些概念。在网络上进行一些搜索,我相信您会找到这个惊人的资源:

http://scratchapixel.com/lessons/3d-basic-lessons/lesson-1-writing-a-simple-raytracer/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-02
    • 2020-09-17
    • 2012-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-07
    • 1970-01-01
    相关资源
    最近更新 更多