分类: 隨筆

  • Compiling PBRT v3, v4 and Mitsuba 3 on macOS and Linux (English)

    PBRT Getting Started

    https://github.com/mmp/pbrt-v3

    https://github.com/mmp/pbrt-v4

    To compile PBRT v3, run the following commands:

    git clone --recursive https://github.com/mmp/pbrt-v3/
    cd pbrt-v3
    mkdir build
    cd build
    cmake ../
    make -j
    Bash

    To compile PBRT v4, run the following commands:

    git clone --recursive https://github.com/mmp/pbrt-v4/
    cd pbrt-v4
    mkdir build
    cd build
    cmake ../
    make -j
    Bash

    (Options) After compiling both versions, you can create symbols links for easier access from terminal.

    sudo ln -s /[your-pbrt-v4-PATH]/build/pbrt /usr/local/bin/pbrt4
    sudo ln -s /[your-pbrt-v3-PATH]/build/pbrt /usr/local/bin/pbrt3
    Bash

    Notice: You need to change the PATH above.

    If you wanna delete the links, type:

    sudo rm /usr/local/bin/pbrt4
    sudo rm /usr/local/bin/pbrt3
    Bash

    Some Problem when building pbrt-v4 cmake files:

    Error Log:

    Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
    OPENGL_INCLUDE_DIR)
    Call Stack (most recent call first):

    You need to download the OpenGL Lib:

    sudo apt update
    sudo apt install -y \
        mesa-utils \
        libgl1-mesa-dev \
        libglu1-mesa-dev \
        freeglut3-dev \
        xorg-dev
    Bash

    Error Log:

    CMake Error at src/ext/glfw/src/CMakeLists.txt:76 (message):
    Failed to find wayland-scanner

    Lack wayland-scanner tool when cmake building GLFW, run following command:

    sudo apt update
    sudo apt install -y \
        wayland-protocols \
        libwayland-dev
    Bash

    Error Log:

    CMake Error at /home/linuxbrew/.linuxbrew/share/cmake/Modules/FindPkgConfig.cmake:645 (message):
    The following required packages were not found:

    • xkbcommon>=0.5.0

    Need download Wayland:

    sudo apt update
    sudo apt install -y \
        libxkbcommon-dev
    Bash

    Warnning Log:

    CMake Warning at CMakeLists.txt:200 (message):
    Found CUDA but PBRT_OPTIX7_PATH is not set. Disabling GPU compilation.

    Optix doesn’t support WSL2 yet.

    Go optix link , download the file.

    Maybe you got the file named: “NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh”. (Change the name Remember)

    Then, ensure the .sh file has executable permissions:

    chmod +x NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh
    Bash

    Execute the installer script:

    sudo ./NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64-35015278.sh
    Bash

    press y to accept the license:

    Log:

    Do you accept the license? [yn]:
    y
    By default the NVIDIA OptiX will be installed in:
    “/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64”
    Do you want to include the subdirectory NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64?
    Saying no will install in: “/home/remo-wsl” [Yn]:
    y

    Using target directory: /home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
    Extracting, please wait…

    Unpacking finished successfully

    Set the Environment Variable After Installation (Remember Change The File Name) :

    export PBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
    Bash

    To make it permanent, add it to your .bashrc:

    echo 'export PBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64' >> ~/.bashrc
    source ~/.bashrc
    Bash

    Finally, back to the pbrt-v4 PATH:

    rm -rf build
    mkdir build
    cd build
    cmake .. -DPBRT_OPTIX7_PATH=/home/remo-wsl/NVIDIA-OptiX-SDK-8.1.0-linux64-x86_64
    make -j$(nproc)
    Bash

    Mitsuba 3 Getting Started

    https://www.mitsuba-renderer.org

    Requirements

    • Python >= 3.8
    • (optional) For computation on the GPU: NVidia driver >= 495.89
    • (optional) For vectorized / parallel computation on the CPU: LLVM >= 11.1

    The following command leads you to intall both Mitsuba 3 and JIT (If your system not already available. )

    pip install mitsuba
    Bash

  • wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。

    link to: https://github.com/microsoft/WSL/releases/tag/2.0.0

    Windows 11 24H2

    1. Open or create the wsl configuration file (located at %USERPROFILE%\.wslconfig ), and enter the following content:

    [experimental]
    autoMemoryReclaim=gradual | dropcache | disabled
    networkingMode=mirrored
    dnsTunneling=true
    firewall=true
    autoProxy=true
    Bash

    2. Open the command prompt and execute wsl --shutdown

  • pbrt-v4 build on windows 11 cmake generation requires target “zlibstatic” that is not in any export set. (English)

    link same issue: https://github.com/mmp/pbrt-v4/issues/467

    My Env:

    • Win11 24H2
    • AMD Ryzen 9 5900X 12-Core Processor
    • Microsoft Visual Studio Community 2022 17.12.3
    • VisualStudio.17.Release/17.12.3+35527.113
    • Microsoft .NET Framework 4.8.09032
    • Visual C++ 2022 00482-90000-00000-AA244
    • Microsoft Visual C++ 2022

    Log:

    1> [CMake] CMake Error: install(EXPORT “Ptex” …) includes target “Ptex_static” which requires target “zlibstatic” that is not in any export set.
    1> [CMake] — Generating done (0.2s)
    1> [CMake] CMake Generate step failed. Build files cannot be regenerated correctly.

    Place the following file to pbrt4 dir and double click to compile.

    Then cd ./build/pbrt4deploy -> ./pbrt

    Log:

    PS G:\pbrt\pbrt-v4\pbrt-v4\build\pbrt4deploy\bin> ./pbrt
    pbrt version 4 (built Jan 6 2025 at 21:39:19)
    Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
    The source code to pbrt (but not the book contents) is covered by the Apache 2.0 License.
    See the file LICENSE.txt for the conditions of the license.

    Then maybe you will get the following Warnning:

    link to: https://www.janwalter.org/rnd/blog/rnd-pbrt-v4-002/

    Log:

    Found CUDA but PBRT_OPTIX7_PATH is not set. Disabling GPU compilation

    Make sure that the SDK Path is correct. (-DPBRT_OPTIX7_PATH)

  • Finally Fix my PC (English)

    Finally Fix my PC (English)

    5900x + 3070, yes in 2025…

    Change my 3700x to 5900x. Cuz my b450 didn’t work, so I have to bought a new motherboard. Finally, I chose the B550 + 5900X (79 USD + 163 USD) as a transition for the new product (Yes, 9950x3d).

  • Article Share – 2025.1.6 (English)

    Article Share – 2025.1.6 (English)

    How To Ask Questions The Smart Way

    http://www.catb.org/~esr/faqs/smart-questions.html

    In the world of hackers, the kind of answers you get to your technical questions depends as much on the way you ask the questions as on the difficulty of developing the answer. This guide will teach you how to ask questions in a way more likely to get you a satisfactory answer.

    Now that use of open source has become widespread, you can often get as good answers from other, more experienced users as from hackers. This is a Good Thing; users tend to be just a little bit more tolerant of the kind of failures newbies often have. Still, treating experienced users like hackers in the ways we recommend here will generally be the most effective way to get useful answers out of them, too.

    The first thing to understand is that hackers actually like hard problems and good, thought-provoking questions about them. If we didn’t, we wouldn’t be here. If you give us an interesting question to chew on we’ll be grateful to you; good questions are a stimulus and a gift. Good questions help us develop our understanding, and often reveal problems we might not have noticed or thought about otherwise. Among hackers, “Good question!” is a strong and sincere compliment.

    Despite this, hackers have a reputation for meeting simple questions with what looks like hostility or arrogance. It sometimes looks like we’re reflexively rude to newbies and the ignorant. But this isn’t really true.

    What we are, unapologetically, is hostile to people who seem to be unwilling to think or to do their own homework before asking questions. People like that are time sinks — they take without giving back, and they waste time we could have spent on another question more interesting and another person more worthy of an answer. We call people like this “losers” (and for historical reasons we sometimes spell it “lusers”).

    We realize that there are many people who just want to use the software we write, and who have no interest in learning technical details. For most people, a computer is merely a tool, a means to an end; they have more important things to do and lives to live. We acknowledge that, and don’t expect everyone to take an interest in the technical matters that fascinate us. Nevertheless, our style of answering questions is tuned for people who do take such an interest and are willing to be active participants in problem-solving. That’s not going to change. Nor should it; if it did, we would become less effective at the things we do best.

    We’re (largely) volunteers. We take time out of busy lives to answer questions, and at times we’re overwhelmed with them. So we filter ruthlessly. In particular, we throw away questions from people who appear to be losers in order to spend our question-answering time more efficiently, on winners.

    If you find this attitude obnoxious, condescending, or arrogant, check your assumptions. We’re not asking you to genuflect to us — in fact, most of us would love nothing more than to deal with you as an equal and welcome you into our culture, if you put in the effort required to make that possible. But it’s simply not efficient for us to try to help people who are not willing to help themselves. It’s OK to be ignorant; it’s not OK to play stupid.

    So, while it isn’t necessary to already be technically competent to get attention from us, it is necessary to demonstrate the kind of attitude that leads to competence — alert, thoughtful, observant, willing to be an active partner in developing a solution. If you can’t live with this sort of discrimination, we suggest you pay somebody for a commercial support contract instead of asking hackers to personally donate help to you.

    If you decide to come to us for help, you don’t want to be one of the losers. You don’t want to seem like one, either. The best way to get a rapid and responsive answer is to ask it like a person with smarts, confidence, and clues who just happens to need help on one particular problem.

    (Improvements to this guide are welcome. You can mail suggestions to esr@thyrsus.com or respond-auto@linuxmafia.com. Note however that this document is not intended to be a general guide to netiquette, and we will generally reject suggestions that are not specifically related to eliciting useful answers in a technical forum.)

  • 人生有什么最幸福的瞬间?

    人生有什么最幸福的瞬间?

    很多时候,以为这天是又一个很平常的日子。

    多年后才发现,这其实是你人生里最棒的一天。

    并且这样的时光,再也不会有了。

    那是多年前的一个夏日午后,我还在读中学。

    我既不回家,也不在学校午休,而是到隔壁小区的花园,

    躺在一张石椅上。

    四周安静,偶尔几声鸟鸣,我就这样静静地躺着,

    直到午休结束,与友人一同回到学校。

    人生大抵如是,最好的时光大抵就不经不觉中悄然离去。

    蓦然回首才发现幸福已经轻轻掠过,

    才发现那份温暖早已悄然远去。

  • 随记 2024 圣诞

    随记 2024 圣诞

    圣诞当天下午摸鱼。和老友A在咖啡馆自习。

    正式开始写一份基于typst的论文模版。

    由于之前对typst了解不多,详细读了一下中山大学的研究生模版,遂决定照葫芦画瓢开始。

    和本科的一位朋友一起弄。忙活了一下午,把第一页、第二页的版面复刻了。

    但只能说代码结构相当简单,并且拓展性为零。

    但是顾不上这么多了,能跑就是胜利,剩下的事情后面再谈。

    当天晚上,和老友A一起去小北吃烤肉。

    走过长长的走廊,一切都很熟悉。

    每次都是我提议来这里吃烤肉的,并且每次吃完都说这个地方性价比好低以后不来了。

    吃完之后一路打嗝,这辈子第一次,从小北走回杨箕。

    当然,晃荡了半天,十一点多才回到家。

    第二天依旧在忙typst的模版,从下午一直写到凌晨三点半。最终完成了。放在了GitHub上。

    https://github.com/Remyuu/thesis-typst-cn

    朋友说,我怎么这么拼。我笑了笑。

    生活如此糟糕,我却反而沉迷这种电子排版给我带来的秩序和规则感,确实可笑。

    周五也是繁忙的一天。

    回到家打了会游戏,准备明天需要发送的邮件,最后躺在床上写这则流水账。

    不得不说,这半年过得着实浑浑噩噩。改变了很多,但没人能看得到了。

    加油。

zh_CNCN