Ideas request for a specific raytracing application back

Board: Home Board index Raytracing General Development

(L) [2015/06/24] [ost by mrluzeiro] [Ideas request for a specific raytracing application] Wayback!

hi all,

I am developing a raytracing for a very specific application (i.e: not a general raytracing). It will render electronic PCB boards (hopefully in) realtime.
I have already identified and implemented a set of specific primitives for this application (ex: round segments, rings, discs, etc..)

Now I am looking for ideas related with shading / illumination part.
This specific application, as you can see above, normally you have to render a plane with some objects on top and on bottom.
So I am planning to use some kind of global illumination and maybe direction lights to add some realism to the rendering.

[IMG #1 Image]
Edit, note: This is a rasterisation image, just as a sample scenario.

As this is a fixed scenario, what do you think that are the best options to try and keep the things "real time".?
Are there any papers related with fast global illumination fast, on CPU?
I can consider here fake approaches, like the SSAO used on GPUs..

Thanks!
Mario
[IMG #1]:[IMG:#0]
(L) [2015/06/24] [ost by raider] [Ideas request for a specific raytracing application] Wayback!

Hm... why to ratrace the PCBs at all? who needs that? Sorry for that kind of question, but that's really exotic application of RT. Just curious.
(L) [2015/06/24] [ost by mrluzeiro] [Ideas request for a specific raytracing application] Wayback!

I think at this time I am also still trying to figure out why [SMILEY :)]
- this is an opensource project (KiCAD) and I have time to play with this ideas.
- user are requesting more render quality and functionalities to the renders (marketing proposes and technical analysis)
- they[ ref?] say that raytracing is the future! [SMILEY :)]

One big issue that I will try to solve is the per-process time that our current implementation take to load and convert the board to polygons:
- On complex boards (like the one in the picture) there are a lots of holes (drills)...thousands.
- Also, a PCB board have lots of layers (copper layers, technical layers, text layers... and so on) (min ~12, max ~70 layers)
- The copper layers, have thousands of rounded tracks segments (you dont see it in the picture, they are ~10mils thickness but they are all converted to triangles)
- Some of the technical layers, are compositions (CSG) of other layers (subtraction) (adds tesselation complexity == +triangles)

So, for every possible layer, it must be tessellated to triangles and then, the holes (polygons and round holes tesselated) must be removed (subtraction) and everything must be re-triangulated/tessellated. (ie. what you see in the image in the board is not a texture.. all that pixels are rendered from the polygons..)
All this layers have thickness, to it must be duplicated and it must be added a contour to it( to it will at least duplicated the nr of triangles and the computation to remove the holes)
Then, all that holes, must be created (as cylinders and discs).

This process will take a lot of time (seconds.. to minutes.. depending on the board)
So every time you change something in your design and want to render again it will take a lot of time.

Also, in order to keep the computation low, the holes are "low detailed" with just a few triangles, it means that if you zoom to see a lot of detail and inspect your work, you will see a low polygon ugly image.

OK, you maybe be able to improve the creation of polygons and also maybe do something on GPU..etc
but the render technique I know best is raytracing [SMILEY :)]
So I will try to use it in order to solve with one solution all this issues.

I guess do it properly, with good results with normal rasterization it will take the same effort and it will be tricky as well.

ps: the top rendering part of the picture was actually developed by myself using old openGL stlye approach.

Mario
(L) [2015/06/25] [ost by straaljager] [Ideas request for a specific raytracing application] Wayback!

Take a look at this video for realtime PCB rendering with Octane:

[LINK https://www.youtube.com/watch?v=52YE5wUYLKA] (start at the 5:00 mark)

The video is from 2010 and was rendered with a GTX260, it should be about 8x faster on a GTX Titan X.
(L) [2015/06/25] [ost by szellmann] [Ideas request for a specific raytracing application] Wayback!

>> Some of the technical layers, are compositions (CSG) of other layers (subtraction) (adds tesselation complexity == +triangles)
Independent of shading, but if you can make sure all primitives can somehow be described by quadrics, you can just do away with tesselation completely and ray trace the CSG directly. But this is what you probably already have in mind [SMILEY :)]

Best, Stefan
(L) [2015/06/25] [ost by mrluzeiro] [Ideas request for a specific raytracing application] Wayback!

@szellmann
Ya, that's what I meant. So I will have +better quality details of the (quadrics) objects and solve at the same time the CSG problem.
This would be possible to do also with rasterisation, but I found it very tricky (using stencils .. or maybe shaders).

@straaljager
That is a nice example of an extremely complex board. However, note that in that video, they are using a texture based PCB board (somewhere in the video they show/ talk about bumpmapping..etc and show the textures of the board).
In my situation the most important thing will be the board it self, then, the components and modules.
But, if a module have components/modules that are in the scale of cm .. cm3 .. a track in a copper layer have a thickness of 35µm and widths of less than 0.254 mm
I have similar ideas that are in that video regarding the way you move the camera while you are adjust the orientation.. so it will render less accurate while moving and after you release the mouse will make a proper render.


Anyway, any suggestions about fast ambient occlusion (or fast global illumination) for raytracing?
(L) [2015/06/25] [ost by szellmann] [Ideas request for a specific raytracing application] Wayback!

Ray traced AO should be doable in real-time - 32 ray queries may probably suffice. You'll benefit from anyhit (rather than closest), and the memory accesses will also be (cache) friendly (because occluders will be clustered).

I experimented with SSAO a few years ago (just for the fun of it) - I found it extremely hard to work around the aliasing issues and had to tweak parameters for certain scenes. That might probably be ok with you, because you can make certain assumptions (e.g. metric system and your boards all having a length of a few centimeters or so). Anyhow, I find the technique rather awkward.

Another way to go could be to combine rasterization and ray tracing: rasterization for direct light, ray tracing for AO, and then combine the two via blending and depth compositing (here you can find an example of how to combine an OpenGL depth buffer and a custom one: [LINK https://github.com/szellmann/visionaray/blob/master/include/visionaray/gl/compositing.h]).

If you decide to go for rasterization, maybe you'd like to consider doing the tessellation in a geometry shader, or,if they provide enough control to you, in a tessellation shader.

Considering that PCB boards may have some kind of (reflective) coating, you'd anyhow maybe be better of with a rendering method that easily integrates with arbitrary BRDFs, so this maybe should also influence your decision.

For the CSG part, you'd probably like to support both quadrics and bounding boxes? Then you circumvent problems with some quadrics (e.g. cylinders) having an infinite extent - and you can use the boxes to build a hierarchy.

Sounds like an interesting project, please keep us updated [SMILEY :)]

Best, Stefan
(L) [2015/06/25] [ost by szellmann] [Ideas request for a specific raytracing application] Wayback!

Out of interest, I just compiled a very simplistic ray trace'd AO example. Wanted to try this, anyway [SMILEY :)]

If you'd like to you can play around with it: [LINK https://github.com/szellmann/visionaray/tree/master/src/examples]

I use an SSE 4.1 binned SAH BVH. You can try .obj models (1st cmd line argument). Epsilon, AO radius, num samples and such are hardcoded. Code for that is in main.cpp:116 - main.cpp:179.

I use a "jittered_blend_type" sampler, i.e. frames are blended and converge after a while. Performance is quite ok on my quad core Mac Book Pro CPU. With simple adaptations this also works with CUDA.

Best, Stefan
(L) [2015/06/25] [ost by mrluzeiro] [Ideas request for a specific raytracing application] Wayback!

Thanks I will have a look in more detail.
Why are you calculate a direction vector with w,u,v ? why not just use the normal (as direction) and the hit point to trace the hemisphere?

 >> For the CSG part, you'd probably like to support both quadrics and bounding boxes? Then you circumvent problems with some quadrics (e.g. cylinders) having an infinite extent - and you can use the boxes to build a hierarchy.
I am still working on that, but so far, the PCB can be represented by circles, round segments (== two circles + rectangle), and polygons for areas.
I can provide more detail later, but in face I have this 2D simple objects that I use to combine and construct the more complex CSG combinations. (All CSG operations are in the form (object A - object B) intersection object C, .. they can be really objects or can be 1 or 0, so, no intersection or always intersect ).. and so on.
Then I have a special 3d object, that will render a 2d object in 3d with a thickness (since all this layer objects are in the same Z perpendicular plane, only the Z start Z end changes to make the thickness).

Mario
(L) [2015/06/25] [ost by szellmann] [Ideas request for a specific raytracing application] Wayback!

>> Why are you calculate a direction vector with w,u,v ? why not just use the normal (as direction) and the hit point to trace the hemisphere?
I build an orthonormal basis with the normal being an axis - the cosine_sample_hemisphere() function (which just happens to be already there) assumes that the hemisphere is above the x/z plane. PBRT guys do it similarly (I believe), but doing it in object space would also be ok.

back