目录
PBR Basics
prepare
- loadAssets: 加载模型
- prepareUniformBuffers
- createBuffer: 包括模型和PBR使用的参数
- updateUniformBuffers
- updateLights
- setupDescriptorSetLayout
- VkPushConstantRange: 常量里面设置了材质信息
- preparePipelines:
- setupDescriptorSets
- buildCommandBuffers
- 正常操作
- 常量在这里输入
render
- draw
- updateLights
shader
- shader是PBR的基础代码
小结
本节主要讲PBR的基础知识, 没有vulkan管线的特殊设置. 可以忽略本节.
PBR IBL
prepare
- loadAssets:
- 加载skybox cube
- 加载模型
- 加载 HDR(cube map)
- generateBRDFLUT: 生成PBR FLUT sampler
- Sampler
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateSampler
- renderpass
- vkCreateRenderPass
- vkCreateFramebuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkAllocateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- vkCmdBeginRenderPass
- vkCmdSetViewport
- vkCmdSetScissor
- vkCmdBindPipeline
- vkCmdDraw
- vkCmdEndRenderPass
- flushCommandBuffer
- vkQueueWaitIdle
- destroy
- vkDestroyPipeline
- vkDestroyPipelineLayout
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkDestroyDescriptorSetLayout
- vkDestroyDescriptorPool
- Sampler
- generateIrradianceCube 生成cube
- vkCreateImage: Array中包括6个image, 图像64X64, mipmap=log2(64)+1
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView: layerCount = 6
- vkCreateSampler:
- vkCreateRenderPass:创建用于渲染IrradianceCube的pass
- Offfscreen framebuffer
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateFramebuffer
- createCommandBuffer
- setImageLayout
- flushCommandBuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkUpdateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- createCommandBuffer
- vkCmdSetViewport
- vkCmdSetScissor
- setImageLayout
- 渲染cub么个面的mipmap
- vkCmdSetViewport
- vkCmdBeginRenderPass
- vkCmdPushConstants
- vkCmdBindPipeline
- vkCmdBindDescriptorSets
- draw
- vkCmdEndRenderPass
- setImageLayout
- vkCmdCopyImage
- setImageLayout
- setImageLayout
- flushCommandBuffer
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkFreeMemory
- vkDestroyImageView
- vkDestroyImage
- vkDestroyDescriptorPool
- vkDestroyDescriptorSetLayout
- vkDestroyPipeline
- vkDestroyPipelineLayout
- generatePrefilteredCube: 生成Pre-filtered cube map, 生成管线设置与IrradianceCub类似
- vkCreateImage
- vkGetImageMemoryRequirements- vkAllocateMemory -vkBindImageMemory
- vkCreateImageViewvkCreateSampler
- vkCreateRenderPass
- Offfscreen framebuffer
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateFramebuffer
- createCommandBuffer
- setImageLayout
- flushCommandBuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkAllocateDescriptorSets
- vkUpdateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- createCommandBuffer
- vkCmdSetViewport
- vkCmdSetScissor
- setImageLayout
- loop
- vkCmdSetViewport
- vkCmdBeginRenderPass
- vkCmdPushConstants
- vkCmdBindPipeline
- vkCmdBindDescriptorSets
- draw
- vkCmdEndRenderPass
- setImageLayout
- vkCmdCopyImage
- setImageLayout
- setImageLayout
- flushCommandBuffer
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkFreeMemory
- vkDestroyImageView
- vkDestroyImage
- vkDestroyDescriptorPool
- vkDestroyDescriptorSetLayout
- vkDestroyPipeline
- vkDestroyPipelineLayout
- prepareUniformBuffers
- createBuffer
- updateUniformBuffers
- updateParams:灯光
- setupDescriptors
- vkCreateDescriptorSetLayout
- Descriptor sets
- vkUpdateDescriptorSets: 模型
- vkUpdateDescriptorSets: Sky box
- preparePipelines:
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines: Skybox pipeline
- vkCreateGraphicsPipelines: PBR pipeline
- buildCommandBuffers
- 正常操作
- 常量在这里输入
render
- draw
shader
- shader: IBL资源渲染算法以及PBR相关算法
小结
本节主要讲IBL的Vulkan实现, 非常适合重复阅读, 可以加深理解Vulkan管线资源的创建, 传输, 以及销毁的过程.
Textured PBR with IBL
prepare
- loadAssets:
- 加载skybox cube
- 加载模型
- 加载 HDR(cube map)
- 加载材质纹理
- generateBRDFLUT: 生成PBR FLUT sampler
- Sampler
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateSampler
- renderpass
- vkCreateRenderPass
- vkCreateFramebuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkAllocateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- vkCmdBeginRenderPass
- vkCmdSetViewport
- vkCmdSetScissor
- vkCmdBindPipeline
- vkCmdDraw
- vkCmdEndRenderPass
- flushCommandBuffer
- vkQueueWaitIdle
- destroy
- vkDestroyPipeline
- vkDestroyPipelineLayout
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkDestroyDescriptorSetLayout
- vkDestroyDescriptorPool
- Sampler
- generateIrradianceCube 生成cube
- vkCreateImage: Array中包括6个image, 图像64X64, mipmap=log2(64)+1
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView: layerCount = 6
- vkCreateSampler:
- vkCreateRenderPass:创建用于渲染IrradianceCube的pass
- Offfscreen framebuffer
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateFramebuffer
- createCommandBuffer
- setImageLayout
- flushCommandBuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkUpdateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- createCommandBuffer
- vkCmdSetViewport
- vkCmdSetScissor
- setImageLayout
- 渲染cub么个面的mipmap
- vkCmdSetViewport
- vkCmdBeginRenderPass
- vkCmdPushConstants
- vkCmdBindPipeline
- vkCmdBindDescriptorSets
- draw
- vkCmdEndRenderPass
- setImageLayout
- vkCmdCopyImage
- setImageLayout
- setImageLayout
- flushCommandBuffer
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkFreeMemory
- vkDestroyImageView
- vkDestroyImage
- vkDestroyDescriptorPool
- vkDestroyDescriptorSetLayout
- vkDestroyPipeline
- vkDestroyPipelineLayout
- generatePrefilteredCube: 生成Pre-filtered cube map, 生成管线设置与IrradianceCub类似
- vkCreateImage
- vkGetImageMemoryRequirements- vkAllocateMemory -vkBindImageMemory
- vkCreateImageViewvkCreateSampler
- vkCreateRenderPass
- Offfscreen framebuffer
- vkCreateImage
- vkGetImageMemoryRequirements-vkAllocateMemory-vkBindImageMemory
- vkCreateImageView
- vkCreateFramebuffer
- createCommandBuffer
- setImageLayout
- flushCommandBuffer
- vkCreateDescriptorSetLayout
- vkCreateDescriptorPool
- vkAllocateDescriptorSets
- vkUpdateDescriptorSets
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines
- createCommandBuffer
- vkCmdSetViewport
- vkCmdSetScissor
- setImageLayout
- loop
- vkCmdSetViewport
- vkCmdBeginRenderPass
- vkCmdPushConstants
- vkCmdBindPipeline
- vkCmdBindDescriptorSets
- draw
- vkCmdEndRenderPass
- setImageLayout
- vkCmdCopyImage
- setImageLayout
- setImageLayout
- flushCommandBuffer
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkFreeMemory
- vkDestroyImageView
- vkDestroyImage
- vkDestroyDescriptorPool
- vkDestroyDescriptorSetLayout
- vkDestroyPipeline
- vkDestroyPipelineLayout
- prepareUniformBuffers
- createBuffer
- updateUniformBuffers
- updateParams:灯光
- setupDescriptors
- vkCreateDescriptorSetLayout
- Descriptor sets
- vkUpdateDescriptorSets: 模型,包括材质的Descriptor
- vkUpdateDescriptorSets: Sky box
- preparePipelines:
- vkCreatePipelineLayout
- vkCreateGraphicsPipelines: Skybox pipeline
- vkCreateGraphicsPipelines: PBR pipeline
- buildCommandBuffers
- 正常操作
- 常量在这里输入
render
- draw
- updateUniformBuffers
shader
- shader: IBL资源渲染算法以及PBR材质渲染相关算法
小结
本节主要讲PBR材质在IBL下的渲染方法, 与上一节相比,只是增加了材质信息(只有shader 发生变化).