Rendering normals

Hi i’am pretty new to Vulkan (never done OpenGL before) and got some questions.

I’ve got a working Vulkan setup where i can load and display a 3D model, turn it with the mouse and zoom in/out.
A vertex and fragment shader is applied doing some basic phong shading.

Now my question is, what is the proper way to render normals into the scene?

As i understand i have to setup a second render pass with pipeline, descriptor sets and so on + a geometry shader that
renders the normals. Am i right, or is there a much simpler approach? Maybe with subpasses?

The purpose of showing the normals is to fix the broken phong shading. I can see inside the model, which
seems not to be right in the first place. Maybe it’s a problem with flipped normals, or the right handed coordinate system
in conjunction with an left handed phong shading algorithm. Any suggestions would be appreciated.

Thanks in advance
Bernhard

Some Infos:
IDE: Qt
OS: Ubuntu
GPU:
apiVersion = 4194306
driverVersion = 1
vendorID = 0x8086
deviceID = 0x0162
deviceType = INTEGRATED_GPU
deviceName = Intel® Ivybridge Desktop

Subpasses can’t be used for something like that (unless you store normals as colors in an attachment that you want to sample from). If you want to visualize the normals as lines then go with the geometry shader route in a second pass with at least a separate pipeline (separate descriptor set is only required if it differs from your normal rendering setup). If you need a reference, there is an example that does exactly what you’re asking for at my repo (GitHub - SaschaWillems/Vulkan: Examples and demos for the new Vulkan API).

Thank you for the hint :slight_smile: