Grasshopper

algorithmic modeling for Rhino

Hi guys is possiple to export mesh colour like material in c4d??

Is very important any advice is big appreciated

thanks

Views: 5955

Replies to This Discussion

VRML supports meshes with per-vertex colours. It's also very easy to parse a VRML file so if Cinema4D doesn't support it you can write an importer using XPresso or C.O.F.F.E.E

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David i try with xpresso because i see that c4d don't support vrml file.

hello massimiliano,

did you succeed in importing vertex colours to c4d? if yes - would be nice if you could give me a hint!

c

Try the script I posted here:

http://www.grasshopper3d.com/forum/topics/how-to-render-mesh-colors

It will create a bitmap texture from the mesh colors and will add texture coordinates to the mesh object so that when you use the bitmap texture in a material in C4D it will render correctly.

Hello Vicente,

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...

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.

Thanks again.

Attachments:

Hi Jesus,

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.

(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).

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.

I'm sure there's a better way to do all this, but it just worked so I left it like this :P

Hi Vicente, 

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. 

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. 

Is it possible to combine the texture with the mesh via mapping?

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).

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).

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.

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. 

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

To understand how it works try to bing some info about texture mapping, but it's very simple:

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}.

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.

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.

It shouldn't matter if the mesh that you are applying the texture has vertex colors or not.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service