After reading this impressive article: Introducing Physically Based Rendering with VTK. I created a couple of examples (both in C++ and Python) that (I hope) capture most of what has been written in the articles.
In the examples you can select different surfaces to visualise: Boy’s Surface (default), Mobius Strip, Torus, Sphere and Cube. The non-orientable surfaces are interesting e.g. in the case of Boy’s Surface on the left side you see reflections of the sky even though the surface is angled to the ground at that point.
You can also select different skyboxes, the images are found in VTKExamples/Testing/Data/skyboxes/. Try different skyboxes! For texturing the images are found in VTKExamples/Testing/Data/
Here are the C++ examples, links to the corresponding Python examples can be found on these pages:
Awesome, thank you @amaclean !
I would be very happy to have your feedback regarding PBR. Did you have difficulty using it? Is the documentation sufficient? Is everything clear in the blog article?
@Michael, in relation to the first example, the documentation was pretty clear and straightforward. I must admit, I was pretty pleased when it all worked and the results looked so beautiful.
In relation to the texturing example I had to feel my way a bit, I searched the VTK repository to find the textures used in the picture in the article. I was also unfamiliar with the terminology. My biggest problem was finding an emissive texture so I used Photoshop to modify the VTK logo and convert it to a black background. You will see I kept the bars around the letters as they gave me an indication of the lighting colour when setting the emissive factor.
With respect to the sources used, it was interesting to do uv-texturing on the parametric surfaces. Once I figured this out, the texturing of these surfaces was easy! For debugging texturing I found your files: tex_debug.jpg and vtk_Base_Color.png useful.
I learned a lot from your well written article.
One other big bonus from the work you guys have done is that it was really simple to convert the C++ code to Python as you can see in the examples.
Thank you for this example!
Is it possible to use data arrays to steer the PBR parameters similar to the ActiveScalars for pointsets?
This could then be another helpful example for data that does not come with texture coordinates but has per vertex attributes.
@Michael Thanks for the quick response. What I meant was to assign per vertex values for the metallic and roughness parameters as well. I want to avoid the textures but still have spatially varying PBR parameters.
Thanks for your answer. Do you think it is worth trying to find a workaround? (something like trying to map the data array manually to the shader inputs in the PolyDataMapper)
Yes, you can hack something easily if you have enough shader development skill.
Send your arrays to the shader inputs and modify the fragment shader code to get interpolated value from your custom vertex attributes to set roughness/metallic. You will need to modify the vertex shader as well to transfer your attribute to the fragment shader.
It makes more sense logically and also for testing. Also you can now read in HDR skyboxes to produce nice hi-res images. There are some nice ones here Poly Haven.
I hope to have an anisotropic texturing example done real soon, it wil be called … wait for it … PBR_Skybox_Anisotropy, thanks to @Lfx_Paul for the anisotropic textures.
Looks cool, how do you zoom-out the cubemap? In the rendering it appears zoomed-in and low resolution compared to the original. Colors also look a bit different.
You can only zoom in/out of objects that you place in the scene. The skybox is essentially at infinity.
That 4k image is quite blurry, this is not a VTK issue, try other ones. I also verified this using ParaView.
I will be updating these examples later today, introducing tone mapping into them, among other things. With tone mapping you will be able to control exposure and contrast.