Problem with STEP files, colors and Ray Tracing WB
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 49
- Joined: Sun Nov 09, 2014 9:48 pm
Problem with STEP files, colors and Ray Tracing WB
Hi all,
Here's some undesirable behavior I've observed with colors in STEP files.
In a new document, I opened the Part WB and created a default cube. I then changed the color of the cube to red using the View tab, Select Color requestor. Then, I exported the cube as STEP with color. Close the document.
Open the STEP file just created; it shows a red cube. Note that the View tab for the cube show the color as the default grey.
Open the Raytracing WB. Insert a new POV Ray project into the document. Add the red cube. Set the camera to the current view.
Now Render - the rendering is in shades of gray as if POV Ray used the default grey instead of the red.
Second problem: Also note that the view in the ray trace is NOT the view FreeCAD shows - the ray trace view is zoomed in by at least a factor of 2.
Third problem (minor): The picture file produced by POV Ray has a file extension of .bmp.png. The save file dialog said it was .bmp with no other choices. The file appears to be a PNG file.
The gray ray trace also happens with STEP file object(s) which have faces of different colors.
I've attached the STEP file and the FreeCAD file with the POV Ray project. I suspect the problem is in how FreeCAD process the colors in the STEP file and then how the Raytracing WB outputs the colors.
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Here's some undesirable behavior I've observed with colors in STEP files.
In a new document, I opened the Part WB and created a default cube. I then changed the color of the cube to red using the View tab, Select Color requestor. Then, I exported the cube as STEP with color. Close the document.
Open the STEP file just created; it shows a red cube. Note that the View tab for the cube show the color as the default grey.
Open the Raytracing WB. Insert a new POV Ray project into the document. Add the red cube. Set the camera to the current view.
Now Render - the rendering is in shades of gray as if POV Ray used the default grey instead of the red.
Second problem: Also note that the view in the ray trace is NOT the view FreeCAD shows - the ray trace view is zoomed in by at least a factor of 2.
Third problem (minor): The picture file produced by POV Ray has a file extension of .bmp.png. The save file dialog said it was .bmp with no other choices. The file appears to be a PNG file.
The gray ray trace also happens with STEP file object(s) which have faces of different colors.
I've attached the STEP file and the FreeCAD file with the POV Ray project. I suspect the problem is in how FreeCAD process the colors in the STEP file and then how the Raytracing WB outputs the colors.
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
- Attachments
-
- StepCube.FCStd
- FreCAD project including POV Ray info.
- (5.03 KiB) Downloaded 96 times
-
- StepCube.step
- Step file of red cube
- (16.7 KiB) Downloaded 85 times
Re: Problem with STEP files, colors and Ray Tracing WB
It seems that the STEP color while displayed correctly when importing the STEP file, the color attribute is not picked up in FreeCAD's properties and it assigns the default color underneath. That default color assigned be FreeCAD is then the color assigned when generating the POV-Ray script. Whether this is something that can not be picked up by FreeCAD or it's an oversight or bug, I don't know. I'll leave that up to the devs to respond.
As for the zoom position, FreeCAD seems to of always been that way. You need to zoom out on your part before adding it to the render. It would be nice to have a "framing tool" of sort that could be toggled on and off to show the size and position of the raytrace window. Don't know how hard that would be to add, but might make for a nice feature request to get added in the 0.16 development cycle.
Mark
As for the zoom position, FreeCAD seems to of always been that way. You need to zoom out on your part before adding it to the render. It would be nice to have a "framing tool" of sort that could be toggled on and off to show the size and position of the raytrace window. Don't know how hard that would be to add, but might make for a nice feature request to get added in the 0.16 development cycle.
Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
Re: Problem with STEP files, colors and Ray Tracing WB
Currently a shape has two properties that keeps colour information. One holds the colour for the whole object and one for the individual faces -- there are historical reasons for this. For now this can be fixed by setting the first face colour as object colour but in the long-term we have to clean up the code and remove the shape colour property.Open the STEP file just created; it shows a red cube. Note that the View tab for the cube show the color as the default grey.
And in case you didn't notice you can change the colour of the Povray shape under the Data tab.
I cannot confirm this. The image shows the object in the exact same size as the GL viewer does.Second problem: Also note that the view in the ray trace is NOT the view FreeCAD shows - the ray trace view is zoomed in by at least a factor of 2.
Here it creates an image with the .bmp suffix only. There is no .png added.Third problem (minor): The picture file produced by POV Ray has a file extension of .bmp.png. The save file dialog said it was .bmp with no other choices. The file appears to be a PNG file.
I am using POV-Ray 3.6, I tried 3.7 but this doesn't work for me.
Re: Problem with STEP files, colors and Ray Tracing WB
The Raytrace camera view is tighter than the 3D view here, though not by a factor of 2.
.BMP.PNG? Must be a difference between the windows and Linux versions as my output graphic format is PNG. Or have you specified something in your POV-Ray output parameters that would cause this? My current output parameters are - +P +A0.1 +AM2 +R4 +J0.5 +UL +UV.
Mark
POV-Ray 3.7
OS: Kubuntu 14.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
.BMP.PNG? Must be a difference between the windows and Linux versions as my output graphic format is PNG. Or have you specified something in your POV-Ray output parameters that would cause this? My current output parameters are - +P +A0.1 +AM2 +R4 +J0.5 +UL +UV.
Mark
POV-Ray 3.7
OS: Kubuntu 14.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
This post made with 0.0% Micro$oft products - GOT LINUX?
Re: Problem with STEP files, colors and Ray Tracing WB
The behaviour of PovRay 3.7 is very weird. It already starts with the installation. When you try to install it wants to go to C:\Program Files\ but then doesn't query the admin password and stops with an error message. If you then start the installer with admin rights you can install it to its default location but when you try to use it tons of errors are reported because it doesn't find its .ini files.
To get it working you have to install it as normal user somewhere into your home directory (or another directory where you have write access). Only this way you get it working. The next problem then is when you want to use it from FreeCAD. It always stops with an IO error that it cannot write to the requested image file. However, when you start it manually and open a pov file creating the images works OK.
To get it working you have to install it as normal user somewhere into your home directory (or another directory where you have write access). Only this way you get it working. The next problem then is when you want to use it from FreeCAD. It always stops with an IO error that it cannot write to the requested image file. However, when you start it manually and open a pov file creating the images works OK.
On Windows for Povray 3.6 the output format is BMP while it PNG on Linux. See also: https://github.com/FreeCAD/FreeCAD_sf_m ... d.cpp#L634.BMP.PNG? Must be a difference between the windows and Linux versions as my output graphic format is PNG
Re: Problem with STEP files, colors and Ray Tracing WB
Apparently the output image in v3.7 is indeed PNG and it must be inside the same directory as where the .pov is loaded from. But still, the size of the object is the same, it's not zoomed at all.I wrote:It always stops with an IO error that it cannot write to the requested image file.
-
- Posts: 49
- Joined: Sun Nov 09, 2014 9:48 pm
Re: Problem with STEP files, colors and Ray Tracing WB
I'm also using POV-Ray 3.7. I have not changed the default parameters except for perhaps adjusting the image size:quick61 wrote:The Raytrace camera view is tighter than the 3D view here, though not by a factor of 2.
.BMP.PNG? Must be a difference between the windows and Linux versions as my output graphic format is PNG. Or have you specified something in your POV-Ray output parameters that would cause this? My current output parameters are - +P +A0.1 +AM2 +R4 +J0.5 +UL +UV.
Mark
POV-Ray 3.7
+P +A
image size: 800x600
Here's the image produced:
Thanks for looking MarK!
-
- Posts: 49
- Joined: Sun Nov 09, 2014 9:48 pm
Re: Problem with STEP files, colors and Ray Tracing WB
I didn't have any difficulty installing POV-Ray 3.7 on Windows.wmayer wrote:Apparently the output image in v3.7 is indeed PNG and it must be inside the same directory as where the .pov is loaded from. But still, the size of the object is the same, it's not zoomed at all.I wrote:It always stops with an IO error that it cannot write to the requested image file.
Running has a problem with the default IO restrictions setting (Options->Script IO restrictions). Set it to no restrictions.
Re: Problem with STEP files, colors and Ray Tracing WB
Thanks this did the trick.Running has a problem with the default IO restrictions setting (Options->Script IO restrictions). Set it to no restrictions.
Now that I get working 3.7 I can confirm the problems you reported. About the scaling I have found out the reason:
When loading your project file the currently set camera has these settings:
If you change the camera to perspective and back to orthographic the settings change to:OrthographicCamera {
viewportMapping ADJUST_CAMERA
position 6.9053712 5.1616583 14.571684
orientation -0.80729276 -0.51367694 -0.29054156 0.38135356
nearDistance 1.5600353
farDistance 15.774677
aspectRatio 1
focalDistance 8.6602545
height 31.560024
}
After applying the new camera settings to the Ray project the rendering output will be much better.OrthographicCamera {
viewportMapping ADJUST_CAMERA
position 1.7738109 14.321496 42.071617
orientation -0.80729276 -0.51367694 -0.29054156 0.38135356
nearDistance 30.966665
farDistance 45.240181
aspectRatio 1
focalDistance 38.096321
height 31.560026
}
-
- Posts: 49
- Joined: Sun Nov 09, 2014 9:48 pm
Re: Problem with STEP files, colors and Ray Tracing WB
Aha! That is a much better scaled view.wmayer wrote: If you change the camera to perspective and back to orthographic the settings change to:After applying the new camera settings to the Ray project the rendering output will be much better.OrthographicCamera {
viewportMapping ADJUST_CAMERA
position 1.7738109 14.321496 42.071617
orientation -0.80729276 -0.51367694 -0.29054156 0.38135356
nearDistance 30.966665
farDistance 45.240181
aspectRatio 1
focalDistance 38.096321
height 31.560026
}
Here's what I get now.
That doesn't look quite right to me ... the top of the cube is strange. It looks like the edge between the front (vertical) face and the top face is in the middle of the top face. Maybe that is an optical illusion.
Update: It looks much better using radiosity. Maybe the black line across the top is actually a small gap and behind it is a reflection?
To get the cube to render in red, I had to change the color in the View tab before adding it to the render project.