<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13403" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-03-22T21:48:53+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13403</id>

		<entry>
		<author><name><![CDATA[zhsh]]></name></author>
		<updated>2022-03-22T21:07:48+00:00</updated>

		<published>2022-03-22T21:07:48+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43950#p43950</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43950#p43950"/>
		<title type="html"><![CDATA[Re: Loading mesh with vertex colors]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43950#p43950"><![CDATA[
Ok found a way to bypass this. It's true that pybullet currently can't represent meshes with vertex colors, so I had to automatically generate a UV map and transfer vertex colors to a texture on the UV map. I was able to do this using MeshLab (pymeshlab) with the following (I actually have the vertices and faces as arrays, but if you just have the obj file you can load the mesh instead):<br><div class="codebox"><p>Code: </p><pre><code>                m = pymeshlab.Mesh(verts_xyz, faces, v_color_matrix=colrs)                ms = pymeshlab.MeshSet()                ms.add_mesh(m, "level_set")                # UV map and turn vertex coloring into a texture                base_name = f"{datetime.now().strftime('%Y_%m_%d_%H_%M_%S')}_{t}"                ms.compute_texcoord_parametrization_triangle_trivial_per_wedge()                ms.compute_texmap_from_color(textname=f"tex_{base_name}")                ms.save_current_mesh(fn)                visId = p.createVisualShape(p.GEOM_MESH, fileName=fn)                meshId = p.createMultiBody(0, baseVisualShapeIndex=visId, basePosition=[0, 0, 0])</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13049">zhsh</a> — Tue Mar 22, 2022 9:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zhsh]]></name></author>
		<updated>2022-03-22T21:48:53+00:00</updated>

		<published>2022-03-15T23:59:15+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43943#p43943</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43943#p43943"/>
		<title type="html"><![CDATA[(Solved) Loading mesh with vertex colors]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43943#p43943"><![CDATA[
I'm trying to load a mesh created in open3d saved in the usual `.obj` format with vertex information into pybullet. The mesh vertices load fine, but don't have any color (resulting mesh in pybullet looks the same regardless if when saving write_vertex_colors=False or not).<br><br>I am loading the mesh in pybullet via<div class="codebox"><p>Code: </p><pre><code>                visId = p.createVisualShape(p.GEOM_MESH, fileName=fn)                meshId = p.createMultiBody(0, baseVisualShapeIndex=visId, basePosition=[0, 0, 0])</code></pre></div>First few lines of the saved mesh:<div class="codebox"><p>Code: </p><pre><code># Created by Open3D # object name: test_mesh_2022_03_15_19_28_06_50# number of vertices: 4700# number of triangles: 9424v -0.055 0.0346259 0.36 0.120638 0.625828 0.533488v -0.055 0.035 0.358984 0.119699 0.61849 0.536347v -0.0552418 0.035 0.36 0.120081 0.622161 0.534946v -0.0564281 0.035 0.37 0.132268 0.655014 0.519661v 0.095 0.065 0.311799 0.276022 0.044167 0.370164v 0.095 0.0663959 0.22 0.252194 0.269783 0.531579</code></pre></div>Does pybullet not support colored vertex obj convention (<a href="http://paulbourke.net/dataformats/obj/colour.html" class="postlink">http://paulbourke.net/dataformats/obj/colour.html</a>)?<br>Is there a way to get colored meshes working (converting to texture somehow and applying texture)?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13049">zhsh</a> — Tue Mar 15, 2022 11:59 pm</p><hr />
]]></content>
	</entry>
	</feed>
