Ideas request for a specific raytracing application

Practical and theoretical implementation discussion.
mrluzeiro
Posts: 28
Joined: Tue May 26, 2015 2:27 pm

Re: Ideas request for a specific raytracing application

Postby mrluzeiro » Thu Jun 25, 2015 8:09 pm

szellmann wrote:I would take the BVH code from somewhere else. It's tricky to get it right (and fast).
As a library developer, of course I recommend using my own library, Visionaray ;)
Embree is the state of the art, but no GPU code unfortunately. Very cool for incoherent rays because of a special BVH type.
Aila and Laine's BVH kernels from 2009 are the GPGPU state of the art I think.


Another issue / condition (however I didn't discuss this with anyone in the project) is that would be nice if it can keep the compatibility with old machines.
So I must consider the case "no SSE", "no GPU shaders". I heard that there are still people using very old machines with this tool..

I have in mind to try some ideas on "sparse grids" ? (multi-level grid) and then I will keep the things flexible to try BVH.

What is appleseed? And how can it help me?

Mario

szellmann
Posts: 50
Joined: Fri Oct 10, 2014 9:15 am
Contact:

Re: Ideas request for a specific raytracing application

Postby szellmann » Thu Jun 25, 2015 8:37 pm

What is appleseed? And how can it help me?


A production renderer. It's MIT-licensed. https://github.com/appleseedhq/appleseed. Whenever I stumbled upon code from them, I found it admirably clean.

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: Ideas request for a specific raytracing application

Postby koiava » Sun Jun 28, 2015 10:03 am

As this is very specific case, when you have PCB board, you can increase efficiency of different parts of your renderer. Most of performance goes on determining Visibility, To increase performance of evaluating visibility you definitely need good acceleration structure.
1. Geometry will be static in most cases, so I think and best choice of acceleration structure will be SBVH because primitives in PCB may have different sizes and alignments.
With SBVH you need to implement spatial splitting for your primitives, As you have different types of primitives it may be more difficult to implement or you can use fullSAH BVH with early split clipping instead of SBVH.
2. PCB components are mostly not rounded and are Axis aligned, this will greatly improve efficiency of bounding boxes.
3. As you mentioned it above, PCB is plane with components on it. In this case packet tracing for primary rays will give you huge speedup. you can use packets for shadow rays to if you will have small area lights.
4. I think mostly used illumination type will be Environment illumination. Global Illuminations means that you calculate all the light paths with all the different lengths. In case of PCB, when board is viewed under some Environment illumination(outdoor scene) I think most of paths will have lower length. In most cases there will be less then 5% above 4 hits. So it will converge fast.
5. Most relevant for real-time rendering is unidirectional path tracing, but as PCB has different metallic parts on it it will create some caustic paths. So you can use more robust integrator to get clear, converged final images.
If you will render only board then generating light paths will be efficient. You can use VCM as it's publicly available, but it has much more startup time and as you need real-time rendering you need to deliver first images fast. You can generate first image from light path to show something and then replace it with final delivery.
Colibri Renderer

mrluzeiro
Posts: 28
Joined: Tue May 26, 2015 2:27 pm

Re: Ideas request for a specific raytracing application

Postby mrluzeiro » Wed Jul 01, 2015 10:40 pm

Hi koiava,

thanks for your valuable suggestions!
would you please elaborate more the 4 and 5? regarding "Environment illumination"? Any papers?
Right now, I dont plan to go for something so advance as the path tracing Another aspect is that in my scenario application I dont have easy way to setup the materials (or in other words: the file models of the components usually dont have material information) so there is not much to gain using advanced illumination models.

Mario

koiava wrote:...

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: Ideas request for a specific raytracing application

Postby koiava » Thu Jul 02, 2015 8:28 am

Environment Illumination is really great for such type of CAE applications.
As the final shading result is dependent on 2 factors, brdf and light, variance coming from both parts will effect on final result.
Brdf sampling is really easy, you generate some reflected directions proportional to your BRDF(distribution might be not exact but near to BRDF, in such case you need to weight them proparly).
So, when you generate samples proportional to BRDF you are importance sampling material but as I said final shading result is dependent on both: brdf and light, so you may sample some area of environment and another area may have big effect on final result(bright sun light on environment for example). You definitely need both sampling strategies, brdf sampling and light sampling. As the variance comes from low probability of sampling important paths you can calculate sampling probabilities for both strategies and combine results with MIS. there is also great technique called RIS, you can use it as addition.
Note: any light sampling technique is some sort of importance sampling, importance sampling might be both good and bad. It may increase variance, when prediction is not valid. Importance Sampling of incoming lights doesn't take care about visibility so if bright(important) light areas is occluded you will spent your performance on sampling those occluded directions and it will increase variance.
There is some interesting paper called "Correlated Visibility Sampling for Direct Illumination", It might be good if you will look at.


mrluzeiro wrote: in my scenario application I dont have easy way to setup the materials (or in other words: the file models of the components usually don't have material information)

I worked in such type of application once, those model components, PCB parts, must have some physical parameters and I think you can get physically based material properties from that(It might be not enough but you can add some parameters with some heuristically).
Colibri Renderer

mrluzeiro
Posts: 28
Joined: Tue May 26, 2015 2:27 pm

Re: Ideas request for a specific raytracing application

Postby mrluzeiro » Tue Sep 01, 2015 8:40 am

Hello all,
Just show you the progress of my humble raytracing that I am working for KiCad (an opensource PCB EDA tool)
I almost finish to convert a board into raytracing shapes (i.e: polygons, triangles, cylinders, round segments, rings, disks, CSG, etc..)
Still no shading, the attached images are colored with normals.
No statistics yet, but a board like the one in the image can have around 100K objects.

I used a lot of opensource code pieces in the source, they are all credited.
Thanks also for this group forum and your inspiration!
Attachments
Kicad-3dviewer-hackrf-one_raytraced_02.png
Kicad-3dviewer-hackrf-one_raytraced_02.png (10.06 KiB) Viewed 6615 times
Kicad-3dviewer-hackrf-one_raytraced_01.png
Kicad-3dviewer-hackrf-one_raytraced_01.png (118.02 KiB) Viewed 6615 times

franz
Posts: 12
Joined: Thu Dec 29, 2011 5:38 pm

Re: Ideas request for a specific raytracing application

Postby franz » Mon Sep 14, 2015 8:56 am

Hi,

I was randomly browsing the forum when I stumbled upon this thread. Very interesting use case of raytracing.

Since I'm the founder and one of the core developers of appleseed, I thought I could chime in. Yes, appleseed is first and foremost a (shared) raytracing library. There are complete C++ and Python 2/3 APIs. The tools we ship (appleseed.cli, the command line batch renderer, and appleseed.studio, the graphical user interface for visualization and lookdev) use the same public C++ API as any other third party integration.

If you're interested in giving appleseed a try, please feel free to join our development mailing list and initiate a dialog there. We'll be happy to assist with the integration.

Best,
Franz

mrluzeiro
Posts: 28
Joined: Tue May 26, 2015 2:27 pm

Re: Ideas request for a specific raytracing application

Postby mrluzeiro » Mon Sep 14, 2015 2:56 pm

franz wrote:Hi,

I was randomly browsing the forum when I stumbled upon this thread. Very interesting use case of raytracing.

Since I'm the founder and one of the core developers of appleseed, I thought I could chime in. Yes, appleseed is first and foremost a (shared) raytracing library. There are complete C++ and Python 2/3 APIs. The tools we ship (appleseed.cli, the command line batch renderer, and appleseed.studio, the graphical user interface for visualization and lookdev) use the same public C++ API as any other third party integration.

If you're interested in giving appleseed a try, please feel free to join our development mailing list and initiate a dialog there. We'll be happy to assist with the integration.

Best,
Franz


Hi Franz.
Thanks for your appreciation!
People here in the forum already pointed me appleseed as a reference.

I am just an occasional contributor on KiCad project and this experiences I am doing are in a separate branch. Still don't know if they will ever be merged or accepted one day. Hope so.
It means that, as far as I know KiCad project, there is an issue with KiCad currently that may block the addition of new libraries for the project: it is not based on plugins.
There is some plan to start remove some huge libraries already from the source code of the project (ex: boost) and some people start to thinking in some plugin types.
So the idea is not add much library overhead to the project. That why I am also a bit afraid because my experiments are already getting huge. So I hope that they come with some kind of plugins.

If KiCad would come with a good plugin system, someone could start a parallel project and use appleseed independent of the main kicad development.

Does appleseed supports different types of objects (spheres/cylinders, etc?) or just triangles?
Another possibility would be to generate / export to appleseed format and render in any other 3rd part application.

In any cases, I cannot do it alone or plan to engage alone in such type of new experiments. Maybe I can try to spread more this ideas and get more people in the project so something nice can be tried with appleseed!

mrluzeiro
Posts: 28
Joined: Tue May 26, 2015 2:27 pm

Re: Ideas request for a specific raytracing application

Postby mrluzeiro » Tue Oct 27, 2015 11:06 pm

Hello all,

Here are some screenshots of the progress that I am working in a raytracing for the Kicad (PCB EDA tool)
https://meocloud.pt/link/aaf06e3f-e308- ... 3d-viewer/
(please download the image file if you want the full resolution)

I implemented an adaptive tracing to get some fast / draft while moving the board (so I can have some interactive rates)
For the final render I added a (CPU) screen space ambient occlusion shader to add a little more realism.
It takes some seconds (1..2.. 3s) to render (the quality version) in my 8 cpu laptop. It performs a (low quality) AA, some refractions and the shaders (SSAO and 5x5 blur to AO) that take a good part of the final rendering time.
It is OOP, no SIMD implementation, but there are other nice things such as BVH (from PBRT book), BVH frustum "ranged [packet] traversal", morton codes..etc

Attached is a example that clear shows the effect of the SSAO shader.

If anyone interested in the sourcecode, have a look at:
https://code.launchpad.net/~mrluzeiro/k ... w3d-viewer

Mario
Attachments
hackrf-one-copper.png
hackrf-one-copper.png (826.15 KiB) Viewed 6164 times


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 7 guests