I want to render the vertex colors of a mesh in Gh with V-Ray.
I found this article in Chaos Group page about rendering vertex colors…
It is not clear to me how to achieve this. First of all, what is that component used to color the mesh?
Second, what has the “V-Ray Material form File” to do with vertex colors?
Third, what material are they using?
Fourth, Why does the texture has a green color that gets ignored in the render?
The UVW texture is procedural texture. The preview you see in the asset editor is just color representation of a UV space [0,1], [0,1], but it is all false color, because it is generalized preview. You put a real color data via the gradient component, which obviously lacks a green color. How it works ? First grasshopper assings a color to each mesh vertex, based on the gradient and the object mapping. Then V-Ray converts the vertex color data into a regular UV map channel, just like you’ve assigned a planar or box mapping. V-Ray cannot render vertex color data directly. It needs a material (shader). Then, you create a material with a UVW texture for the diffuse slot. That texture simply interprets the UV data for that mesh directly as color. The crucial moment here is thd mapping channel. You have to specify the channel where the vertex color UV data is. That is channel 2 (hardcoded).That changed to channel 0 in version 4.
I agree that is very complex workflow, but that is simply how shader graphs work. If you had to make ghat in 3ds Max it would have look like very similar, but a bit more visual. So… In 4.20 we introdused the Bitmap texture component. It has a “mode” parameter, that can be set to Vertex Color. It does thd very same job behind the scenes, but much easier to set up. The whole setup now happens in GH. Assign vertex colors the mesh, put the mesh in a VGeo, put a simple material in the VGeo, put a Bitmap texture in the material’s diffuse parameter and select Vertex Color mode for that texture.
Thank you Nikolay for the explanation. I managed to do it and it worked!
To clarify for beginners (me).
Create a Generic Material in Asset Editor.
In the material settings > Diffuse > add a texture and scroll to UWV
It should look like this:
Now go to the texture settings and set the channel to UV channel to 0
Save your material with Righ Click > Save As
Use the component V-Ray Material from File to browse and select your recently saved material.
Use this set up inside GH
BTW the component originally used in the Chaos Group article is called Mesh Spray and it is native GH.
But you don’t really need it, it works just fine with Construct Mesh or Mesh Colours
Okay I finally completed my understanding of your response @Nikolay, it took me some steps
It can all be done inside GH like this:
Also, it seems like the channel’s number does not affect the result, I suppose that is because as the ‘Mode’ is set to ‘Vertex Colors’ it overrides the channel number and picks 0 behind de scenes.