Skip to content

Repository files navigation

render_explore_by_opengl

render_explore_by_opengl

TODO:

  1. 在着色器中区分纹理是单通道还是多通道, 对于ao,specular,Metallic, Roughness 这些贴图,一般是单通道的
  2. 3D 纹理和 2D 纹理不能混淆
  3. 金属度贴图效果可能不明显,只有边缘是金属

build

mkdir build
cd build
cmake ..
make -j6

./src/render_explore_by_opengl

bazel build

bazel build //src:refactor_test 

// debug version
bazel build --cxxopt="-g" --strip=never  //src:refactor_test 

GPU

  • 在wsl2中默认使用集显进行渲染或者软件模拟渲染,速度很慢,内存占用很大
glxinfo -B | grep -E "OpenGL renderer"
OpenGL renderer string: llvmpipe (LLVM 20.1.2, 256 bits)

测试使用GPU渲染

  • export GALLIUM_DRIVER=d3d12
glxinfo -B | grep -E "OpenGL renderer"
OpenGL renderer string: D3D12 (NVIDIA GeForce GTX 1060)
  • 实测可行,perfect!!! 2701 shensun+ 20 0 2578356 267680 117376 S 32.3 1.6 0:29.99 refactor_test

NDK build for x86 lib

mkdir build
cd build

export ANDROID_NDK=/opt/ndk

cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=x86_64 \
    -DANDROID_PLATFORM=android-29 \
    ..

make -j$(nproc)

# strip debug info
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --strip-unneeded src/librender_explore_by_opengl.so

perf profiling

./perf.sh bazel-bin/src/refactor_test perf

todos

todo

questions

  1. AO 贴图用于中间阶段还是应用于最后的结果中
  2. skybox 作为环境光的时候应该与漫反射颜色相乘还是相加。-- 相乘作为环境光颜色看起来更好一些。

result

latest state(20260404)

instanced rendering

latest state(20260327)

20260327

phong model effect

diffuse + specular + normal + ao textures

phong

diffuse + specular + normal + ao textures + skybox reflection

skybox

use ao texture to the final result

ao

use ao texture to the final result and add roughness texture

roughness

skybox reflection multiplied with diffuse color

skybox mix

light attenuation

attenuation

android studio

android

gamma correction

(wrong!!!)

gamma

right

right

About

render_explore_by_opengl

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages