← Back to team overview

kicad-developers team mailing list archive

Re: Couple raytracer "problems"/questions

 

Hi Chris,

> 2) Any necessary reason why it's so grainy?


There are a lot of parameters on raytracing render that are hard coded,
maybe in future someone could implement a parameter UI for advance users to get their desired result.

As grainy I believe you talking about noise in the reflections and refraction?

Some things I noticed from your render:
- you are rendering it in "technical mode"
- you have no mask layers enabled
- your connector plastic is reflecting (as the pins and the capacitors)
- I am not sure if you have your main board enabled or how did you construct that background circuit.

(obscure) Things to know about the raytracing:

- As there was no way on the materials (eg: on VRML) to tell that a material is reflective, I implemented (based on my creative process :O ) a factor that will use the shininess value to apply reflection to the material.
i.e: if the Shininess value is > than some amount (0.16) the material will before reflective.
https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp#L1299

Note that Shininess value controls.. the shininess :)
http://learnopengl.com/img/lighting/basic_lighting_specular_shininess.png
and is related with specular factor.. all this parameters are used by the light equation and are "fake approximations" of the reality.
But since shininess and specular in reality is (could be) related how much the material is reflective, I decided to make this "mapping".

So you can go to your VRML material of that model, and reduce the shininess factor to something <= 0.15
so it will disable the reflection on that material.
(That plastic is not much reflective)


- Usually materials are not perfect mirrors, so for reflection I implemented a "vector noise displacement" to cause some noise turbulence.
https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp#L2105

That will be more noticeable as faraway the hit is.


- On refraction there should be no random on vectors (I checked that)
I am not sure from your render, looks you have board enabled with lots of layers?
I believe in that case it may be precision issues,? in the refraction of the board?
But is that is the case, I believe in your case that will be an improvement in the visuals :)


I am not also happy with some visuals I am getting, but I guess that would be a matter to add some (advance) options configuration
and not having so many hardcoded options.
We should provide some defaults to the user and then more advanced options for customization.

Mario


References