Open k-bobin opened 1 year ago
Hi, I faced the similar problem, and here is how I solve it. Hope this will work for you.
This code snippet is located at simple-3dvis/renderables/textured_mesh.py line 155 and line 162
// fix colors based on the textures
if (has_texture) {
vec4 texColor = texture2D(texture, v_uv); <= remove this line
vec4 texColor = texture(texture, v_uv); <= update by this line
l_ambient = l_ambient * texColor.rgb;
l_diffuse = l_diffuse * texColor.rgb;
}
// fix normal based on the bump map
if (has_bump_map) {
vec3 bump_normal = texture2D(bump_map, v_uv).rgb; <= remove this line
vec3 bump_normal = texture(bump_map, v_uv).rgb;<= update by this line
l_norm += (dot(v_norm, v_norm) - 1) * bump_normal;
}
Does anyone face the same problem as I did?
I'm running preprocess.py exactly like below:
PATH_TO_SCENES="/tmp/threed_front.pkl" python3 preprocess_data.py path_to_output_dir /Users/bobinkim/ATISS/dataset/3D-FRONT /Users/bobinkim/ATISS/dataset/3D-FUTURE-model /Users/bobinkim/ATISS/dataset/3D-FUTURE-model/model_info.json /Users/bobinkim/ATISS/demo/floor_plan_texture_images --dataset_filtering threed_front_bedroom
A few seconds later, a folder is created under path_to_output_dir. The folder has boxes.npz and room_mask.png. However immediately an error pops up in terminal. It says (base) bobinkim@Bobinui-MacbookAir scripts % PATH_TO_SCENES="/tmp/threed_front.pkl" python3 preprocess_data.py path_to_output_dir /Users/bobinkim/ATISS/dataset/3D-FRONT /Users/bobinkim/ATISS/dataset/3D-FUTURE-model /Users/bobinkim/ATISS/dataset/3D-FUTURE-model/model_info.json /Users/bobinkim/ATISS/demo/floor_plan_texture_images --dataset_filtering threed_front_bedroom No GUI library found. Simple-3dviz will be running headless only. Applying threed_front_bedroom filtering Loading dataset with 1630 rooms Saving training statistics for dataset with bounds: {'translations': (array([-2.69074161, 0.0844895 , -2.75275 ]), array([2.75929532, 3.6248396 , 2.67008333])), 'sizes': (array([0.043739 , 0.02000002, 0.01548735]), array([2.8682 , 1.4 , 1.698315])), 'angles': (array([-3.14159265]), array([3.14159265]))} to path_to_output_dir/dataset_stats.txt Applying threed_front_bedroom filtering {'translations': (array([-2.69074161, 0.0844895 , -2.75275 ]), array([2.75929532, 3.6248396 , 2.67008333])), 'sizes': (array([0.043739 , 0.02000002, 0.01548735]), array([2.8682 , 1.4 , 1.698315])), 'angles': (array([-3.14159265]), array([3.14159265]))} Loading dataset with 1694 rooms 11it [00:02, 3.94it/s] Traceback (most recent call last): File "/Users/bobinkim/ATISS/scripts/preprocess_data.py", line 271, in
main(sys.argv[1:])
File "/Users/bobinkim/ATISS/scripts/preprocess_data.py", line 261, in main
render(
File "/Users/bobinkim/ATISS/scripts/utils.py", line 178, in render
scene.add(r)
File "/Users/bobinkim/anaconda3/lib/python3.11/site-packages/simple_3dviz/scenes.py", line 60, in add
renderable.init(self._ctx)
File "/Users/bobinkim/anaconda3/lib/python3.11/site-packages/simple_3dviz/renderables/textured_mesh.py", line 46, in init
self._prog = ctx.program(
^^^^^^^^^^^^
File "/Users/bobinkim/anaconda3/lib/python3.11/site-packages/moderngl/init.py", line 1939, in program
res.mglo, res._members, res._subroutines, res._geom, res._glo = self.mglo.program(
^^^^^^^^^^^^^^^^^^
_moderngl.Error: GLSL Compiler failed
fragment_shader
ERROR: 0:38: Invalid call of undeclared identifier 'texture2D' ERROR: 0:39: Use of undeclared identifier 'texColor' ERROR: 0:40: Use of undeclared identifier 'texColor' ERROR: 0:45: Invalid call of undeclared identifier 'texture2D' ERROR: 0:46: Use of undeclared identifier 'bump_normal'
I think it is regarding mac os (ps. I'm using mac m1) but I don't know exactly what causes the issue and how to resolve this.
If there is anyone who runs into the same problem or has any opinion on this, please leave a comment. It would help me a lot