MasterpieceVR
คะแนนไม่เพียงพอ
Converting Vertex Color to a Texture With Blender
โดย Morganicism
Here's how you can convert your vertex colored model to a textured model.
   
รางวัล
ชื่นชอบ
ชื่นชอบแล้ว
เลิกชื่นชอบ
Overview
In order to convert your vertex colors to a texture, we are going to first unwrap the UVs of our model in Blender[www.blender.org], and then we'll be able to transfer our vertex colors to a texture using MeshLab[www.meshlab.net].
Cleaning Up Your Model
You'll need to first export your model as an OBJ from MasterpieceVR. After you've done that, you can import your model into Blender.

It's a good idea to remove duplicate vertices and decimate the mesh.
To remove duplicate vertices: Right click your model, then press Tab to ender edit mode. Press the A key to select all. After that, press the "Remove Doubles" button on the bottom of the left bar.

































To decimate the model: Press Tab to exit edit mode. On the right side of the screen there is a row of icons. Select the blue wrench. Select the "Decimate" option from the "Add Modifier" dropdown.



Once you have done that, you begin reducing the complexity of your model. There should be a bar labelled "Ratio". Change this value until it is as low as it can go without ruining your model.




UV Unwrapping
Right click your model and then press Tab to enter edit mode. Press the A key to select all.

After that, press the U key to bring up the UV Mapping menu. Select "Smart UV Project". Lowering the angle limit is a good idea. It should look something like this:



There! The model is unwrapped!
Transferring Vertex Colors to a Texture in MeshLab
If you would like to use Blender for this step, please skip this section and go to "Transferring Vertex Colors to a Texture in Blender"

Export your model as an OBJ from Blender.

It's time to open MeshLab. You'll need to import two models into MeshLab. First import the OBJ that you exported from MasterpieceVR, then import the OBJ that you exported from Blender.

Next you need to select "Transfer: Vertex Attributes to Texture" from The "Filters" dropdown.

After that, you need to select the MasterpieceVR model as the source, and the Blender model as the target. Click "Apply". The texture should appear in the same location as the models you used. (If this produces an error and there is no texture on your desktop, you may need to use MeshLab 1.3.3)

Now you can now apply that texture to the unwrapped model in your preferred application!
Transferring Vertex Colors to a Texture in Blender (Alternative to MeshLab)
First, you'll need to follow this guide to get your model into Blender with vertex colors: http://steamcommunity.com/sharedfiles/filedetails/?id=1146563778
Don't forget to unwrap your model again with Smart UV Project!

Modifying your Material
At the end of that guide you should have created a material using nodes. We'll need to modify that material.

Add an Emission shader node. Delete the Diffuse BSDF node, and replace it with the Emission node that you just added.

You'll need to create an image for your texture. Go to the UV/Image Editor.


At the bottom of that area, you should see New and Open buttons. Click New to create a new image, type in a name and a size.

Similarly to how you switched to the UV/Image Editor, you need to switch back to the Node Editor to modify your material again.

Add an Image Texture node, but make sure it is not connected to any other nodes. Select the image that you just created from the dropdown on that node.

Baking your Texture
Now we get to actually put the vertex colors on a texture.
Make sure the Image Texture node is selected.
Make sure your sculpture is also selected.

On the right side of your window, click the camera icon to view the Render settings. Scroll down to the bottom of these settings to the Bake section. Expand the Bake section, and click the big Bake button.

Your texture is being created, you should see a progress bar at the top of your screen.
You can preview your texture by changing your display method in your 3D View to Texture

If you are not satisfied with the result (black/incorrect triangles) you can modify the Margin value under the Bake settings, or try UV -> Pack Islands in the UV/Image Editor.

Saving your Texture
Go back to the UV/Image Editor again. Click Image at the bottom of that area. Select Save As Image.
10 ความเห็น
Morganicism  [ผู้สร้าง] 23 มี.ค. 2018 @ 8: 08am 
I had a look at your files. It seems like the issue is the black on the edges of your UV islands. This can be fixed by baking your texture in Blender, but it's a little more complex. I've added a new part to this guide, which should help. (Also, if your dolphin is only one color, you can use a texture that is just a solid color, and that will eliminate all of the issues.) Please let me know if you need help with anything else.
gary_gorby 22 มี.ค. 2018 @ 8: 20pm 
I tried a new Smart UV Project in Blender with half the angle (16.5) and double the island margin (0.8), but I did not see any impact. Here is a link to the OBJ, MTL, and 2 image files: https://1drv.ms/f/s!Ao3ef13lCZzksFFITObOmGMezbzL
Morganicism  [ผู้สร้าง] 19 มี.ค. 2018 @ 6: 04am 
I'm glad you were able to get the .mtl working. None of your texture map patches should be intersecting. You should try doing another "Smart UV Project" in Blender, but decrease the angle limit, and increase the island margin. I don't know what values would work best for you, but you can try cutting the angle limit in half and doubling the margin.
gary_gorby 18 มี.ค. 2018 @ 8: 20pm 
Okay, figured out that the .mtl file was missing some map statements referencing the texture map. When I open the model in Tiltbrush there are visible black lines where the texture map patches intersect. Also, from certain angles portions of the model look transparent. Using a larger texture map helped some (8192 x 8192). Any suggestions to fix this?
gary_gorby 18 มี.ค. 2018 @ 2: 12pm 
I've followed these instructions. I had to use version 1.3.3 of Meshlab otherwise the new version crashed. I was able to generate a .png texture map. However, I still can't seem to get the texture map to show up when I open the final exported .obj that is generated in Meshlab. I believe the .mtl file is the problem, as it did not seem to have the image reference. I edited it in notepad, but even with a new material reference and texture file references with the same name as the unwrapped .obj file, it still didn't work. In the step where the vertex attributes are transferred to the texture from the original .obj file to the unwrapped mesh from Blender, only the fill texture radio button is checked by default. Do I need to check assign texture too? What else am I missing? I'm not sure why the .mtl file is not being generated properly, either....
Morganicism  [ผู้สร้าง] 16 ม.ค. 2018 @ 4: 32pm 
I'll do that, thanks!
IceXuick 16 ม.ค. 2018 @ 2: 19pm 
It works perfectly now! Great stuff, and thanks for the guide! You should also add that Meshlab 1.3.3. is a solution for those who have problems with the latest build as well.
IceXuick 16 ม.ค. 2018 @ 1: 10pm 
Found the problem! The newest version of Meshlab has problems. Use version 1.3.3. instead, and the vertex to texture works!!! I'll continue tryong to create some awesome stuff!
Morganicism  [ผู้สร้าง] 16 ม.ค. 2018 @ 12: 48pm 
In the image I have on the guide, my mouse is hovering over the incorrect item. Try the one directly below it, "Transfer: Vertex Attributes to Texture". I'm going to fix the image now. Sorry!
IceXuick 16 ม.ค. 2018 @ 11: 54am 
It gives an error: Failure of filter: Transfer Texture to Vertex Color (1 or 2 meshes) / Source mesh doesn't have Per Wedge Texture Coordinates