export mesh colour in c4d - Grasshopper2024-03-29T06:40:52Zhttps://www.grasshopper3d.com/forum/topics/export-mesh-colour-in-c4d?id=2985220%3ATopic%3A636828&%3Bpage=2&feed=yes&xn_auth=noI just installed Cinema 4D to…tag:www.grasshopper3d.com,2013-11-14:2985220:Comment:9579602013-11-14T17:04:28.842ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853747?profile=original" target="_self"></a><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853933?profile=original" target="_self"></a>I just installed Cinema 4D to test it and it seems to work perfectly fine. I exported the mesh as a .obj file.</p>
<p></p>
<p>Rhino displaying the mesh vertex colors (no material with texture):…</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853747?profile=original" target="_self"></a><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853933?profile=original" target="_self"></a>I just installed Cinema 4D to test it and it seems to work perfectly fine. I exported the mesh as a .obj file.</p>
<p></p>
<p>Rhino displaying the mesh vertex colors (no material with texture):</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853747?profile=original" target="_self"><img width="721" class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2768853747?profile=RESIZE_1024x1024"/></a></p>
<p>Cinema 4D render in viewport, object has assigned a material with the texture from the script in the color slot:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768853933?profile=original" target="_self"><img width="721" class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2768853933?profile=RESIZE_1024x1024"/></a></p>
<p></p> sorry guys i just saw the dis…tag:www.grasshopper3d.com,2013-11-13:2985220:Comment:9568052013-11-13T01:59:51.950ZChristian Schmidtshttps://www.grasshopper3d.com/profile/ChristianSchmidts
<p>sorry guys i just saw the discussion today,</p>
<p></p>
<p>thank you for the tool Vicente, it works fine as long i stay in rhino but cinema is getting th order of the "colour points" confused. which mapping has to be applied or which mapping does rhino do by default?</p>
<p>what are these "<span>texture coordinate information". do you have a suggestion which format i should export?</span></p>
<p></p>
<p><span>best, c</span></p>
<p>sorry guys i just saw the discussion today,</p>
<p></p>
<p>thank you for the tool Vicente, it works fine as long i stay in rhino but cinema is getting th order of the "colour points" confused. which mapping has to be applied or which mapping does rhino do by default?</p>
<p>what are these "<span>texture coordinate information". do you have a suggestion which format i should export?</span></p>
<p></p>
<p><span>best, c</span></p> It shouldn't matter if the me…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9558912013-11-11T12:50:38.634ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p>It shouldn't matter if the mesh that you are applying the texture has vertex colors or not.</p>
<p>It shouldn't matter if the mesh that you are applying the texture has vertex colors or not.</p> To understand how it works tr…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9558892013-11-11T12:49:38.523ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p>To understand how it works try to bing some info about texture mapping, but it's very simple:</p>
<p>Each mesh vertex, just like it can contain color information, it can contain texture mapping information. This is just a 2d point that points into a position of an image (these points are normalized, if you want to point to the center of the image the point would be {0.5,0.5}.</p>
<p>The renderer will map into each face the part of the image that falls inside the region generated by the…</p>
<p>To understand how it works try to bing some info about texture mapping, but it's very simple:</p>
<p>Each mesh vertex, just like it can contain color information, it can contain texture mapping information. This is just a 2d point that points into a position of an image (these points are normalized, if you want to point to the center of the image the point would be {0.5,0.5}.</p>
<p>The renderer will map into each face the part of the image that falls inside the region generated by the texture coordinates of the vertices of that face.</p>
<p></p>
<p>As I understand it each face should be able to have different texture coordinates on shared vertices, but Rhinocommon's mesh asked for a list as long as the number of vertices, that's why I had to unweld the mesh in the script. It's very possible I overlooked something and it's not a Rhinocommon limitation.</p> The baked mesh has vertex col…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9558842013-11-11T12:32:36.116ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p>The baked mesh has vertex colors but that is not important, the important part is that it also has texture coordinate information. You just have to export the baked mesh into another software, assign to it a material and place the texture created with the script in the diffuse color slot of the material (or any other channel depending on what you want to do with it).</p>
<p>The baked mesh has vertex colors but that is not important, the important part is that it also has texture coordinate information. You just have to export the baked mesh into another software, assign to it a material and place the texture created with the script in the diffuse color slot of the material (or any other channel depending on what you want to do with it).</p> OK I think I figured it out.…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9556082013-11-11T12:28:47.700ZJesus Galvezhttps://www.grasshopper3d.com/profile/JesusGalvez
<p>OK I think I figured it out. I was applying the texture over a mesh which already had vertex colors. Bellow, the left one is with the texture applied over a mesh which already has vertex colors. The right one is with the texture applied over a mesh with no vertex colors. </p>
<p></p>
<p>It exports and imports nicely, at least into Rhino. Haven't tried on the other program yet, but I can't test that yet. I have no idea what how it maps onto the mesh (I didn't touch any mapping settings, nor…</p>
<p>OK I think I figured it out. I was applying the texture over a mesh which already had vertex colors. Bellow, the left one is with the texture applied over a mesh which already has vertex colors. The right one is with the texture applied over a mesh with no vertex colors. </p>
<p></p>
<p>It exports and imports nicely, at least into Rhino. Haven't tried on the other program yet, but I can't test that yet. I have no idea what how it maps onto the mesh (I didn't touch any mapping settings, nor do there appear to be any set), but at least it works :D</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768850608?profile=original" target="_self"><img width="480" src="http://storage.ning.com/topology/rest/1.0/file/get/2768850608?profile=RESIZE_1024x1024" width="480" class="align-full"/></a></p> Unfortunately since this way…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9556032013-11-11T12:11:20.353ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p>Unfortunately since this way of doing it is a bit cutre, the mapped texture doesn't look as smooth as the vertex coordinates. You can subdivide the mesh with weaverbird to add more mesh vertices so it looks smoother (you can use subdiv algorithms that smooth out the shape or just add vertices without changing the shape as long as they interpolate mesh colors).</p>
<p></p>
<p>Bellow is your example mesh rendered in Brazil. The first one is your original mesh rendered using the Brazil vertex…</p>
<p>Unfortunately since this way of doing it is a bit cutre, the mapped texture doesn't look as smooth as the vertex coordinates. You can subdivide the mesh with weaverbird to add more mesh vertices so it looks smoother (you can use subdiv algorithms that smooth out the shape or just add vertices without changing the shape as long as they interpolate mesh colors).</p>
<p></p>
<p>Bellow is your example mesh rendered in Brazil. The first one is your original mesh rendered using the Brazil vertex colors shader. The second mesh is the mesh generated from the script mapped with the bitmap texture generated from the script (you'll notice it's not as smooth). The third is also a mesh mapped with a bitmap generated from the script, but the input mesh is your original mesh with loop subdivision applied on it.<img width="640" class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2768850441?profile=original"/></p> Hi Vicente,
I don't get it.…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9558732013-11-11T12:05:30.747ZJesus Galvezhttps://www.grasshopper3d.com/profile/JesusGalvez
<p>Hi Vicente, </p>
<p></p>
<p>I don't get it. What I am looking to do is export a mesh with vertex colors into another program. I think the only way of doing this is exporting it as VRML 2.0 with vertex colors included. The problem is the program I am exporting to does not support VRML 2.0. So I thought of using your script to create a texture (bitmap) associated with the mesh, export the mesh (only its geometry) and combine the texture with the geometry in the other…</p>
<p>Hi Vicente, </p>
<p></p>
<p>I don't get it. What I am looking to do is export a mesh with vertex colors into another program. I think the only way of doing this is exporting it as VRML 2.0 with vertex colors included. The problem is the program I am exporting to does not support VRML 2.0. So I thought of using your script to create a texture (bitmap) associated with the mesh, export the mesh (only its geometry) and combine the texture with the geometry in the other program. </p>
<p></p>
<p>Your script creates a texture, but the mesh created in "bake mesh" has vertex colors, not the texture, associated with it. I could already accomplish this with the [Mesh Colours] component. </p>
<p></p>
<p>Is it possible to combine the texture with the mesh via mapping?</p> Hi Jesus,
You have to bake t…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9558072013-11-11T11:40:42.405ZVicente Solerhttps://www.grasshopper3d.com/profile/VicenteSoler
<p>Hi Jesus,</p>
<p></p>
<p>You have to bake the mesh where it says "bake mesh" and render that new mesh. It should look exactly like the mesh you referenced but will have added information about texture coordinates. You don't need to change the mapping type, you can leave it as default.</p>
<p>(The mesh will also be unwelded now (larger file size, memory), but still uses the normals from the welded mesh so it won't look more faceted).</p>
<p></p>
<p>Yes, the image contains more pixels than…</p>
<p>Hi Jesus,</p>
<p></p>
<p>You have to bake the mesh where it says "bake mesh" and render that new mesh. It should look exactly like the mesh you referenced but will have added information about texture coordinates. You don't need to change the mapping type, you can leave it as default.</p>
<p>(The mesh will also be unwelded now (larger file size, memory), but still uses the normals from the welded mesh so it won't look more faceted).</p>
<p></p>
<p>Yes, the image contains more pixels than mesh vertices. I think it creates 4 pixels for every vertex. This was to avoid color bleeding due to the nature of how texture mapping works.</p>
<p></p>
<p>I'm sure there's a better way to do all this, but it just worked so I left it like this :P</p> Hello Vicente,
Ok I made the…tag:www.grasshopper3d.com,2013-11-11:2985220:Comment:9557922013-11-11T09:44:26.698ZJesus Galvezhttps://www.grasshopper3d.com/profile/JesusGalvez
<p>Hello Vicente,</p>
<p></p>
<p>Ok I made the texture from the mesh vertex colors. My mesh is more or less square with 32x32 triangles, yet somehow the texture is an 88x88 pixel bitmap. I don't understand why...</p>
<p></p>
<p>But anyway, how do I remap the texture onto the mesh, so that it matches the original vertex colors? I tried all the mapping types.</p>
<p></p>
<p>Thanks again.</p>
<p>Hello Vicente,</p>
<p></p>
<p>Ok I made the texture from the mesh vertex colors. My mesh is more or less square with 32x32 triangles, yet somehow the texture is an 88x88 pixel bitmap. I don't understand why...</p>
<p></p>
<p>But anyway, how do I remap the texture onto the mesh, so that it matches the original vertex colors? I tried all the mapping types.</p>
<p></p>
<p>Thanks again.</p>