Home Forums Games202-高质量实时渲染 作业3 关于RayMarching加速的minmap实现 Reply To: 作业3 关于RayMarching加速的minmap实现

#11638 Score: 0
charvl
Participant
2 pts

生成 mipmap 的关键操作:
– 先为 mipmap 预留足够的内存: glGenerateMipmap(GL_TEXTURE_2D)
– 为 framebuffer 绑定不同 level 的 mipmap 作为输出:glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, your_view_depth_tex, mipmap_level)
– 在 shader 里面使用 textureLod(your_view_depth_tex, uv, mipmap_level) 来采样某个级别的深度值。