f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.67k stars 188 forks source link

Missing colors with STEP file #271

Closed VictorLamoine closed 6 months ago

VictorLamoine commented 2 years ago

Describe the bug Colors from STEP files not represented

To Reproduce Steps to reproduce the behavior: Open the file

Screenshot_20220427_220832

The STEP file can be exported here: https://cad.onshape.com/documents/0e914e25b085e45c5ea9909d/w/0e60af9e7041cf3f62561d86/e/3a0581e7443351b7b7ca6a93?renderMode=0&uiState=6269a3d56959b541b9d18cb2

Expected behavior Screenshot_20220427_221022

System Information:

F3D Information

f3d 1.2.1

F3D - A fast and minimalist 3D viewer
Version: 1.2.1
Build date: 2021-12-13 23:27:53
System: Linux-5.11.0-1022-azure x86_64
Compiler: GNU 7.5.0
RayTracing module: OFF
Exodus module: ON
OpenCASCADE module: 7.6.0 (no metadata)
Assimp module: 5.1.0
VTK version: 9.1.20211124 (build 20211124)

Copyright (C) 2019-2021 Kitware SAS.
Copyright (C) 2021-2022 Michael Migliore, Mathieu Westphal.
License BSD-3-Clause.
Written by Michael Migliore, Mathieu Westphal and Joachim Pouderoux.
Meakk commented 2 years ago

Are you using the binaries from the Release page?

The package we are providing does not provide color support for CAD format.
You can see it with the (no metadata) in the information:

OpenCASCADE module: 7.6.0 (no metadata)

If you want full support, you will have to build your own f3d with an OpenCASCADE library supporting TKXDESTEP and TKXDEIGES modules.

For reference, here is the script we are using to generate the OpenCASCADE library for the f3d package. We are not including TKXDESTEP and TKXDEIGES modules because it requires additional dependencies if I remember correctly.

https://github.com/f3d-app/f3d/blob/8cb2fc5347b4518aa524239037bf3cfb98280a74/.github/actions/occt-install-dep/action.yml#L43

VictorLamoine commented 2 years ago

Yes I am using the binaries from the release page.

I have compiled/installed OpenCascade 1.6.0 with the additional toolkits:

 BUILD_ADDITIONAL_TOOLKITS        TKSTEP;TKIGES;TKMesh

Then compiled f3d enabling the OCCT and assimp (installed from the repositories) modules:

$ cmake ../src/ -DF3D_MODULE_OCCT=True -DF3D_MODULE_ASSIMP=True
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found GLEW: /usr/lib/x86_64-linux-gnu/libGLEW.so  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  found components: OpenGL GLX 
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/libmpi.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1") found components: C 
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7") found components: C HL 
-- Found NetCDF: /usr/include (found version "4.8.1") 
-- Found JsonCpp: /usr/lib/x86_64-linux-gnu/libjsoncpp.so (found suitable version "1.9.5", minimum required is "0.7.0") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37") 
-- Found Eigen3: /usr/include/eigen3 (found version "3.4.0") 
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.4.7") 
-- Found double-conversion: /usr/lib/x86_64-linux-gnu/libdouble-conversion.so  
-- Found LZ4: /usr/lib/x86_64-linux-gnu/liblz4.so (found version "1.9.3") 
-- Found LZMA: /usr/lib/x86_64-linux-gnu/liblzma.so (found version "5.2.5") 
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80") 
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.3.0")  
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.11.1") 
-- Found utf8cpp: /usr/include/utf8cpp  
-- Module: VTK ExodusII found
-- Module: assimp 5.2.0 found
CMake Warning at src/library/CMakeLists.txt:49 (message):
  Module: assimp: Animations are not working with assimp 5.1.0 and newer, use
  assimp 5.0.X for animation support with assimp formats.

-- Module: OpenCASCADE 7.6.0 found
CMake Warning (dev) at src/library/CMakeLists.txt:104 (set):
  implicitly converting 'list' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- 17 readers found.
-- Supported extensions: 3ds;gml;dcm;gltf;glb;mha;mhd;nrrd;nhdr;obj;ply;pts;stl;tiff;tif;wrl;vmrl;vtk;vtp;vtu;vtr;vti;vts;vtm;stp;step;igs;iges;fbx;dae;dxf;off;exo;ex2;e
-- Configuring done
-- Generating done
-- Build files have been written to: /home/victor/software/f3d/build

Yet after building it says OCCT is not enabled:

$ ./bin/f3d --version
f3d 1.2.1

F3D - A fast and minimalist 3D viewer
Version: 1.2.1
Build date: 2022-04-28 18:18:20
System: Linux x86_64
Compiler: GNU 11.2.0
Raytracing module: OFF
Exodus module: OFF
OpenCASCADE module: OFF
Assimp module: OFF
VTK version: 9.1.0 (build 0)

Copyright (C) 2019-2021 Kitware SAS.
Copyright (C) 2021-2022 Michael Migliore, Mathieu Westphal.
License BSD-3-Clause.
Written by Michael Migliore, Mathieu Westphal and Joachim Pouderoux.
Meakk commented 2 years ago

If you tried to build the master, the --version option is not working well, try to checkout v1.2.1 instead.

Meakk commented 2 years ago

Still, even if the --version is not displaying OCCT support, f3d should be able to open STP and IGS files.

Meakk commented 2 years ago

Fix for the master branch: https://github.com/f3d-app/f3d/pull/272

VictorLamoine commented 2 years ago

I am able to load the STEP file but still no colors (latest master)

$ ./bin/f3d --version
f3d 1.2.1

F3D - A fast and minimalist 3D viewer
Version: 1.2.1
Build date: 2022-05-03 06:17:14
System: Linux x86_64
Compiler: GNU 11.2.0
Raytracing module: OFF
Exodus module: ON
OpenCASCADE module: 7.6.0 (full support)
Assimp module: 5.2.0
Alembic module: OFF
VTK version: 9.1.0 (build 0)

Copyright (C) 2019-2021 Kitware SAS.
Copyright (C) 2021-2022 Michael Migliore, Mathieu Westphal.
License BSD-3-Clause.
Written by Michael Migliore, Mathieu Westphal and Joachim Pouderoux.
Meakk commented 2 years ago

Can you attach the step file here? It seems I cannot export the file without OnShape account

VictorLamoine commented 2 years ago

Yes of course :) Support téléphone.zip

Meakk commented 2 years ago

Sorry it took time but I had a quick look. It seems the file do not contain any color information on the curves nor the surfaces. I don't know if the issue is coming from the OpenCASCADE reader we are using or the OnShape STEP exporter.

VictorLamoine commented 2 years ago

The model contains colors and OpenCascade is capable or reading them because CAD Assistant loads and displays colors fine: image

mwestphal commented 1 year ago

Hi @VictorLamoine

I tested again with a colored step saved from freecad and cannot find any issue:

f3d.zip

f3d

It may be an opencascade issue or our own issue but without identifying what makes your file special, it's hard to move forward.

mwestphal commented 7 months ago

@VictorLamoine do you have other examples of files that fails the same way ?

VictorLamoine commented 7 months ago

I have created an other example but can't reproduce the issue with this new project: https://cad.onshape.com/documents/40aed6aac6d07380ae0eccef/w/f9de146d81b7733ba00e0d2a/e/77afd1673e070bbd56300323?renderMode=0&uiState=65ae4da2b657bd694137a618

The file from the first post still doesn't display colors, I have tried re-exporting from OnShape and the problems still remains.

Short answer: no I don't have an other file to reproduce the problem at the moment.

snoyer commented 7 months ago

I don't know what could be going on but FWIW Mayo sees the colors too Support téléphone step - Mayo

mwestphal commented 7 months ago

@snoyer do you know if Mayo rely on OCCT ?

snoyer commented 7 months ago

@snoyer do you know if Mayo rely on OCCT ?

I don't know the exact details but it does

https://github.com/fougue/mayo

3D CAD viewer and converter based on Qt + OpenCascade

Mayo is developed in modern C++ with Qt and OpenCascade

mwestphal commented 7 months ago

Then it may be our issue. Investigation needed.

snoyer commented 6 months ago

Then it may be our issue

confirmed, looks fixable occt-colors