[OpenSCAD] Light source and default camera position different on command line

Hans L thehans at gmail.com
Wed Sep 19 16:02:01 EDT 2018


This was something I added a while ago when working on the ability to
support transparent backgrounds, which I never completely finished.

The purpose of the test is to verify that the test framework is paying
attention to the alpha channel.
In order to do this, it compares an "expected" image *with* transparency(I
believe I manually generated this image from transparent branch I was
working on), against the actual image which is not expected to have
transparency.
I know it is rather confusing, but the image comparison is expected to
fail, which means it passed the test.

set_property(TEST openscad-colorscheme-cornfield-alphafail_logo PROPERTY
WILL_FAIL TRUE)
See the "WILL_FAIL TRUE" in the test CMakeLists.txt

To keep things simple I would say we can safely comment out this test until
the transparent background work is actually completed.

Hope that makes sense

Hans

On Wed, Sep 19, 2018 at 7:53 AM nop head <nop.head at gmail.com> wrote:

> Now I am totally confused. Why would an image generated with the default
> Cornfield colorscheme be expected to have a transparent background?
>
> Why, when I changed the expected background to be not transparent, did it
> not make the test pass anyway?
>
> On 19 September 2018 at 13:38, nop head <nop.head at gmail.com> wrote:
>
>> Looking at the difference on Github here:
>> https://github.com/nophead/openscad/commit/a75d9596ac85d6730a9d1658e76efa4871fa47ec?short_path=d08cf42#diff-7a2e4b520807a0b305be99f2fcb77915
>> I can see that the original expected result had alpha in it but the file I
>> have generated does not.
>>
>>
>>
>> On 19 September 2018 at 12:37, nop head <nop.head at gmail.com> wrote:
>>
>>> I regenerated the test images for the corrected lighting with
>>> TEST_GENERATE=1 and it works for all the tests except this one:
>>>
>>> Image tests
>>> openscad-colorscheme-cornfield-alphafail_logo
>>> Expected image Actual image
>>>
>>>
>>>
>>> 1090/1124 Testing: openscad-colorscheme-cornfield-alphafail_logo
>>> 1090/1124 Test: openscad-colorscheme-cornfield-alphafail_logo
>>> Command: "C:/msys64/mingw64/bin/python.exe" "C:/msys64/home/ChrisP/openscad/tests/test_cmdline_tool.py" "--comparator=" "-c" "C:/msys64/mingw64/bin/convert.exe" "-s" "png" "-t" "openscad-colorscheme-cornfield-alphafail" "-f" "logo" "C:/msys64/home/ChrisP/openscad/tests/../Release/openscad.exe" "C:/msys64/home/ChrisP/openscad/tests/../examples/Basics/logo.scad" "--colorscheme=Cornfield" "-o"
>>> Directory: C:/msys64/home/ChrisP/openscad/tests
>>> "openscad-colorscheme-cornfield-alphafail_logo" start time: Sep 19 12:29 GMT Daylight Time
>>> Output:
>>> ----------------------------------------------------------
>>> logo
>>> run_test() cmdline: ['C:/msys64/home/ChrisP/openscad/tests/../Release/openscad.exe', 'C:/msys64/home/ChrisP/openscad/tests/../examples/Basics/logo.scad', '--colorscheme=Cornfield', '-o', '/home/ChrisP/openscad/tests/openscad-colorscheme-cornfield-alphafail-output/logo-actual.png']
>>> using font directory: C:/msys64/home/ChrisP/openscad/tests/../testdata/ttf
>>> stderr output: ECHO: version = [2018, 8, 22]
>>> Compiling design (CSG Products normalization)...
>>> Normalized CSG tree has 4 elements
>>> Compiling highlights (1 CSG Trees)...
>>>
>>> Image comparison cmdline:
>>> ["C:/msys64/mingw64/bin/convert.exe"],['C:/msys64/home/ChrisP/openscad/tests/regression/openscad-colorscheme-cornfield-alphafail/logo-expected.png', '/home/ChrisP/openscad/tests/openscad-colorscheme-cornfield-alphafail-output/logo-actual.png', '-alpha', 'On', '-compose', 'difference', '-composite', '-threshold', '10%', '-morphology', 'Erode', 'Square', '-format', '%[fx:w*h*mean]', 'info:']
>>>  actual image: /home/ChrisP/openscad/tests/openscad-colorscheme-cornfield-alphafail-output/logo-actual.png
>>>
>>>  expected image: C:/msys64/home/ChrisP/openscad/tests/regression/openscad-colorscheme-cornfield-alphafail/logo-expected.png
>>>
>>> Image comparison return: 0 output: b'0'
>>>
>>> Test time =   0.62 sec
>>> ----------------------------------------------------------
>>> Test Failed.
>>> "openscad-colorscheme-cornfield-alphafail_logo" end time: Sep 19 12:29 GMT Daylight Time
>>> "openscad-colorscheme-cornfield-alphafail_logo" time elapsed: 00:00:00
>>> I have copied the file manually as well and compared the files. The files are identical but the test still fails.
>>>
>>>
>>> On 18 September 2018 at 08:27, nop head <nop.head at gmail.com> wrote:
>>>
>>>> Unifying the camera modes has revealed another bug. This test now fails
>>>> but the actual image is correct in my opinion.
>>>>
>>>> openscad-camtrans-viewall_camera-tests
>>>> Expected image Actual image
>>>>
>>>>
>>>>
>>>> It tests the gimbal camera with viewall without auto center, something that only can happen with the command line. The camera is translated a long way from the object's center (which is on the origin), mainly in the X direction and it is looking down the X axis, so most of of that offset is not apparent.
>>>> The viewall logic is that the object should remain visible with any camera rotation so it needs to view from quiet far away.
>>>> It doesn't work with the old code because it uses Camera::center, which is not set in the gimbal camera unless auto centre is also set (it always is in the GUI). I.e. that was the bug I fixed recently, but it only fixed it when auto center is set.
>>>>
>>>> I hacked the GUI to not set autocentre and you can see the distance is appropriate when the camera is rotated so that the X translation is visible.
>>>>
>>>>
>>>>
>>>>
>>>> On 17 September 2018 at 08:40, nop head <nop.head at gmail.com> wrote:
>>>>
>>>>> Yes it is a bug. The gimbal camera was lit from above and the vector
>>>>> camera from below. I will submit a PR soon.
>>>>>
>>>>> On 17 September 2018 at 03:52, Jordan Brown <
>>>>> openscad at jordan.maileater.net> wrote:
>>>>>
>>>>>> On 9/15/2018 5:34 AM, nop head wrote:
>>>>>>
>>>>>> An unfortunate side effect of the GUI lighting position is that two
>>>>>> faces of cubes in a lot of tests are the same shade. It looks a lot less
>>>>>> contrasty.
>>>>>>
>>>>>>
>>>>>> Lit from below sure seems wrong.
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 11017 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 4309 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27896 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27896 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 58989 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180919/8d8d1964/attachment-0004.png>


More information about the Discuss mailing list