We are using ray tracing to model the path of light through a stack of different materials with wavelength dependent light refraction. Our current code is not for rendering but it would be nice to enable that in the future.
I have run through a few of the tutorials and one of the sticking points I have is modelling our textures on the front surface. We have a very small randomly repeating pyramid pattern on the front material. Each pyramid is about 7e-6 metres and the surface that is textured is about 1.5e-1 metres squared. So in total there are about 500 billion pyramids in our default configuration.
We are currently getting decent performance in our current codebase with a form of lazy geometry but I am exploring the possibility of using Embree to gain higher performance.
I experimented with using the displacement function provided in one of your tutorials, and adjusting the edge level until I was able to get about 500 billion features. I guess it will be no surprise to you, that this was extremely slow to commit the scene, but interestingly once committed the ray tracing performance was very good. So if we wait for the initial startup and then ray trace for a few seconds, we are already a long way ahead of our current code base in terms of performance.
Our program is interactive though, so I really need some results within the first second. I can see that I might be able to create instances of a smaller tiled geometry and maybe even use lazy initialisation of those to achieve my goal. The problem is that what I really need is for my texture to be applied to a variety of geometry types. In general they will be applied to one side of a rectangular prism or one planar surface of a cylinder but it would great to be able to support other geometric shapes too.
I imagine, the ideal scenario would be some sort of tiled displacement map I could apply that would be lazily evaluated but I am curious to hear if there is some other approach that might help us a fast time to trace the first ray even if it means sacrificing ray tracing performance for a while until the geometry is cached.
It's worth making the point that the repeating surface texture can't be a simple baked image map. It needs to adjust both the height of the base geometry and the normals so that light bounces correctly when interacting with the texture.
Thanks for any suggestions in advance.