Wings 3D Development Forum
Cornell box comparison : PovRay vs. YafaRay vs. Kerkythea - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Interface & Usage (https://www.wings3d.com/forum/forumdisplay.php?fid=3)
+--- Thread: Cornell box comparison : PovRay vs. YafaRay vs. Kerkythea (/showthread.php?tid=2970)

Pages: 1 2


Cornell box comparison : PovRay vs. YafaRay vs. Kerkythea - sciroccorics - 10-06-2020

Hi everybody,

To better understand parameters involved in Global Illumination (caustics, photons, radiosity), I've played a bit with the standard Cornell Box model, which requires strong GI simulation to get photorealistic effects. Well, actually I created my own version of the Cornell box, starting from the one I found on oort's website (thanks to him), by adding rounded edges to the two rectangular boxes, in order to better show specular highlights.

Here is the Google Drive link to get the Wings file I built, as well as the rendering results.

The scene is composed of 5 planes made of diffuse materials (red, green or blue for the left, back and right walls respectively, white for the ceiling, light gray for the floor), two boxes with glossy grey material, one pure mirror sphere, one pure glass ellipsoid behaving like a lens, and a single square light at the ceiling. I also added an ambient light so as the OpenGL rendering would not be too dark, but this ambient light is set to black for the PovRay and YafaRay renderings, where I only want physically-based rendering.

I've tried to set material parameters on the PovRay plugin and the Yafaray plugin, to get simular visual effects when using both rendering engines. I attach 4 images of the results I obtained :

- Cornell_POV = Image by PovRay when setting quality mode as "Compute reflected, refracted and transmitted rays"
- Cornell_POV+GI = Image by PovRay when setting quality mode as "Compute media and radiosity" quality setting
- Cornell_YAF = Image by YafaRay when setting lighting mode as "Direct Illumination"
- Cornell_YAF+GI = Image by YafaRay when setting lighting mode as "Global Illumination - Photon Mapping"

As expected, without photons and radiosity, the scenes look very dark with pure black shadows for both rendering engines, while the GI option adds more light everywhere and very convincing color bleedings created by diffuse/glossy interreflections. However, despite my efforts, there are still some strong differences between the results obtained:

- I could not manage to get the area light visible as a white square in PovRay, as it can be done in YafaRay be defining an objet with "Light Material", so the ceiling is not very nicely rendered withPovRay
- The R/G/B color walls appear as very uniformly colored in PovRay, while there is some gradient in YafaRay which seems more correct. On the other hand, the color is a bit "saturated" in YafaRay and show a visible circle on each wall, which is not very realistic
- The glass lens looks much more convincing in YafaRay that in PovRay (altough I use the parameters of the "glass" material from the PovRay material library, and the same index of refraction for both plugins)
- Similarly, the boxes appears as more glossy in YafaRay images than in PovRay ones, though the same specular exponent (50) is used for both plugins
- A strange arfefact is visible in the PovRay images on the bottom corner of the horizontal box
- And finally (maybe the most important), on my computer PovRay computations are about 2 to 5 five times faster that the same image in YafaRay, while YafaRay is usually known to be a "fast" engine. So maybe am I wrong with some of my settings on both plugins.

As Micheus and oort have played a lot with PovRay and YafaRay, so I hope you may show me the parameters that could/should be changed to improve the results.


RE: Cornell box comparison between PovRay and YafaRay - micheus - 10-06-2020

Quote:- I could not manage to get the area light visible as a white square in PovRay, as it can be done in YafaRay be defining an objet with "Light Material", so the ceiling is not very nicely rendered with PovRay
POVRay doesn't render its lights.

Your ceiling light is the entire object and not only the bottom face. So, what we need to do in this case is to create a mesh light. We select the object we want to be turned into light and in the context menu choose Object to Area Light.

In some cases, if we want to put the light only on the bottom face we can use the plane light "replacing" that part of the light - like in this image bellow, from the old post at the plugin development.
The piece that should be used as light source received a material with emission set to 1.0 and the area light is put in front on it:
[Image: temp3tempmeshlightambie.th.png]
In that thread there is also a tip for SSS, size influencing shadows from area light and quality setting comparison.

I tweaked the exported files in order to change:
- 'gamma 1.8' and 'count 1000000' in global settings; [bug]
- Light area colour from 0.5 to 1.0, matrix light 20x20 and added 'orient';
- add the 'emission 1.0' to ceiling light material (panel object); [bug]
[Image: Cornell-area-mesh.png][Image: cornell-mesh-bottom-only.png]
Left: bottom and side faces of panel with the emitter material;
Right: only the bottom. The area light was placed just bellow the bottom face (not over).

[Image: Cornell-mesh.png]
The panel was turned in a area light.

Quote:- The R/G/B color walls appear as very uniformly colored in PovRay, while there is some gradient in YafaRay which seems more correct. On the other hand, the color is a bit "saturated" in YafaRay and show a visible circle on each wall, which is not very realistic
I agree about both observation.
But, by considering a flat light on ceiling I think it can be more natural to see a homogeneous lighting them a rounded one which looks like the source of light is a spot or point light.

However, I noticed some issues with the exported .POV file:
- Emission for material property isn't exported;
- The gamma settings has been exported with a constant value of 1.0 although the Render dialog show us 2.2 (a good value usually is around 1.8-2.2);

I will have to take a look on the exporter again. Dodgy

Quote:- The glass lens looks much more convincing in YafaRay that in PovRay (altough I use the parameters of the "glass" material from the PovRay material library, and the same index of refraction for both plugins)
Yeah. It looks like let it reflect full white isn't a good approach in this case. In the image I put above you may noticed it looks a little better. I disabled the Extended Interior settings (we most the time need to only set the IOR) and the reflection minimum colour to <178,178,178> (0.7).

Quote:- Similarly, the boxes appears as more glossy in YafaRay images than in PovRay ones, though the same specular exponent (50) is used for both plugins
Try to find the settings to make two different engines produce the same result is almost impossible. I already tried that. Smile

Quote:- A strange arfefact is visible in the PovRay images on the bottom corner of the horizontal box
Indeed. I could figured what is that. Would need to spend more time to understand what is that.

Quote:- And finally (maybe the most important), on my computer PovRay computations are about 2 to 5 five times faster that the same image in YafaRay, while YafaRay is usually known to be a "fast" engine. So maybe am I wrong with some of my settings on both plugins.
That is possible. Smile
You can slow it down if you increase photons count to 1000000; increase the area light matrix in order to get a smoother shadow;


I noticed you choose to render a squared image. In cases like this, where the screen we are working may not have the aspect ratio we are going to use for rendering its possible to use a camera feature which allow us to see on screen the area which will be render and then we can better arrange the camera in the scene. First you access the camera settings and choose the ratio. Then, in the View->Show menu enable the Camera Image Plane:
[Image: w3d-camera-image-plane.png]


RE: Cornell box comparison between PovRay and YafaRay - oort - 10-07-2020

I only had a little bit of time to play with this tonight...

YafaRay is fast compared to some other rendering software. Smile Area Lights in YafaRay have a big impact on render times when using lighting methods that use GI. I wish they could improve on that. If you hide the Area light you will see that the scene will render much faster.

You will also see that the Ambient light you added is not lighting the scene because Background/Environment is set to "None". To light the scene without the Area light, set it to "Constant" and the color to white. Set the power to at least 1.0 to light the scene. Enable "Enlight" and "Diffuse Photons". Set "Samples" in the Ambient light to a higher number (At least 8 ) to avoid a grainy render.

Not using an Area light probably does not give the proper results for a Cornell Box.... Sad

I will see if I can spend some more time on this tomorrow.

oort


RE: Cornell box comparison between PovRay and YafaRay - sciroccorics - 10-07-2020

Hi Micheus,

Nice trick what you propose to deal with area lights, your rendering of the ceiling is much closer to the result obtained by Yafaray. I'm going to try this on other scenes.

Quote:The gamma settings has been exported with a constant value of 1.0 although the Render dialog show us 2.2

Good idea to check the exported POV file to see if everything is correct, didn't thought about that. I found a bit strange that the exported gamma value used by Povray is 1.0 instead of 2.2, because the final Povray rendering in quite close in overall luminosity to the Yarafay rendering which uses this same 2.2 value for gamma. So I made some additional tests and discovered something really strange: in Yafaray when increasing the gamma value, the image look brighter (which is the usual behavior when performing the same action in image processing softwares), but when increasing the "assumed_gamma" parameter in the Pov-Ray file, the image looks more and more darker Shocked For instance, putting a gamma to 10 gives an almost black image in PovRay, and very overexposed picture in Yafaray.

So I checked PovRay documentation, and especially the "2.3.4 Gamma Handling" section of the reference manual. I didn't made all the calibration experiments suggested in that section, but I understand that the "assumed gamma" used in Povray is actually the gamma value that is expected for the visualization display, so PovRay tries to COMPENSATE the non-linearity provided by the device, which means that it darkens the image for high gamma and brightens the image for low gamma. So this is the opposite behavior done by Yafaray.

Hi oort,

Yes, the ambient light was set to zero both for Povray and Yafaray, I only put a non-zero value in Wings to avoid a very dark rendering by OpenGL. I did that on purpose, because the Cornell box is supposed to be only illuminated by the ceiling light, in order to check whether the interreflections are correctly computed.

I guess that the difference in speed that I observed between both renderers are coming from non-consistent parameter settings I did. For instance, PovRay allows one to control the number of specific photons used for caustics (so called "media photons"), in addition to the total number of photons, while Yafaray only provides a single global number. Also the number of samples used for area light sampling is fixed in Yafaray (on the "Yafaray" tab of the Light properties), while it is adaptative in PovRay, which may explain the speed difference that you have noticed when including area lights with Yarafay.

As I said in my first post, the images provided by Yafaray appear more realistic than the ones provided by Povray. I also find the Material and Light parameters more "intuitive" in Yafaray (well, it's still complicated to get expected effects without any experimental testing). But on the other hand, it's not clear how to choose between the "photon mapping", "path tracing", "bidirectional tracing" or "stochastic progressive photon mapping" options in the "Lighting" tab of the plugin window. Even if I understand (a little bit, at least) the algorithmic differences between these techniques, I'm not sure when one should favor one techniques instead of another for a specific scene to be rendered.


RE: Cornell box comparison between PovRay and YafaRay - micheus - 10-07-2020

sciroccorics Wrote:So I made some additional tests and discovered something really strange: in Yafaray when increasing the gamma value, the image look brighter (which is the usual behavior when performing the same action in image processing softwares), but when increasing the "assumed_gamma" parameter in the Pov-Ray file, the image looks more and more darker
Thanks for remember about that. Smile
Because of this behaviour the plugin is really making an adjustment so when we use a value like 2.2 or 1.8 (usual in most settings). We divide the 2.2 value by the assumed_gamma informed in the render dialog.


RE: Cornell box comparison between PovRay and YafaRay - oort - 10-08-2020

After looking at the settings for the Area Light I noticed that samples is set to 150. I changed that to 15 and that reduced render time to a little over 1 minute. I have not looked at why we are getting the circles on the walls yet.

Bidirectional and SPPM are in the very early stages of development and do not work as well as other lighting methods. I use either Photon Mapping or PathTracing for GI. I think that Photon Mapping is usually faster than PathTracing. I used Direct Light most of the time since I did not need GI for my scenes. It is the fastest and I have not focused on rendering outdoor scenes and indoor architectural scenes which look better with GI.

oort


RE: Cornell box comparison between PovRay and YafaRay - sciroccorics - 10-08-2020

Quote:I noticed that samples is set to 150

Well done ! I raised the value to 150 just to see whether it changes something about the smothness of shadows, then I forgot to put it down afterwards. As I set the light sampling grid to 6x6 in Povray, the fair comparison is obtained with 36 samples in Yafaray, and then Yafaray is a little bit faster than Povray, using similar quality settings. That clearly explains the strong speed difference I have observed !

By the way, it's still too bad that Yafaray doesn't have an adaptive mechanism for shadow rays : if you send, say, 5 shadow rays to an area light (1 at each corner + 1 at the center) and all 5 rays return the same value, it's pretty much sure that the whole source is visible from the corresponding location, so sending the remaining rays is more or less useless. Of course, there may be some exceptions (very small obstructing objects can be missed with an adaptive process) but the benefits are usually much higher than the drawbacks. Adaptive sampling can be unchecked in Povray, so you can choose between both options. I really would like to have something equivalent in Yafaray.

Just a word about the saturation circles that appear on the walls : I could remove them by reducing the "diffuse reflection" parameter from 0.5 to 0.25, so the illumination gradient is still present but without saturation. Anyway the "good" solution (I'm always too lazy to use it, though) to avoid such over-exposed and/or under-exposed areas in the final image, would be to generate the final image as an HDR or EXR image, and then perform an adaptive 8-bit tone mapping afterwards. The "Radiance" software provides some standalone tools for this step, and most recent image processing softwares (Photoshop, Gimp) also include such a tone mapping process. It might be interesting to investigate this option a bit more, for scenes with complex illumination scenarios.


RE: Cornell box comparison between PovRay and YafaRay - sciroccorics - 10-09-2020

To understand the visible artefact generated by PovRay on the bottom corner of the horizontal box, I've made a couple of images where the camera is zooming on the corresponding area. I've put the resulting images on the same Google drive folder (link in the OP above).

The results are pretty interesting : PovRay seems to have a heavy heavy bug on the normal interpolation when using quadrangular faces ! Look at the reflected image on the mirror sphere provided by PovRay (left hand side of the picture) and compare it with the same part on the YafaRay image. The reflected box visible on the sphere is totally deformed on the PovRay's sphere, while it is almost straight on the YafaRay's one. To prove that the problem comes from the interpolation on quadrangles, I've applied the "triangulate" operator on the spheres and the boxes. As a result, the reflected box is straightened and even the odd-looking triangular shadow on the box becomes much more natural (see "Cornell_POV+GI+Zoom+Tri.png" in the folder). Strange to find that a software as mature as PovRay contains such a strong bug that has never been discovered...

Even without that bug, I would still find the results obtained by Yafaray much more convincing. For instance, on the zoom image, the green color bleeding that appears on the front face of the vertical box is quite awesome as it corresponds to a double diffuse interreflection : the green wall illuminates the back face of the horizontal box, which in turn illuminates the front face of the vertical box. Very nice ! This complex phenomenon is not visible in the PovRay image...


RE: Cornell box comparison between PovRay and YafaRay - micheus - 10-09-2020

I already noticed that when used POV-Ray in the past. For closeups of glass or metal I used to subdivide the object before to export producing small squares then the result is better.
But, it was a good catch to check if would work for triangular faces.

That seems to be related to a more common observation: The Shadow Line Artifact

Notice that even in the Yafaray render we still can see a slight squared look.
I also prefer the ceiling reflection on the lens on the POV image. The Yararay one looks a little blurred/greyed.

Maybe this article about Radiosity in POV-Ray can be of your interest.


RE: Cornell box comparison between PovRay and YafaRay - oort - 10-09-2020

sciroccorics.

Glad changing the Area light samples setting helped the speed of YafaRay.

I don't know if the Advanced settings tab (Shadow Bias and Min Ray Distance) is anything that would help with Shadow Rays???

I don't know what those settings do.

I could send an email to the developer with any suggestions for updates you might have if you want me to. No guarantee he will make the changes. Smile There is a place for that on the YafaRay website but since the site is down you cannot do that now.

I get the feeling from your post that you know something about the science behind 3d rendering. I only know what YafaRay can do and like what I see when I render with it... Smile

oort