We had an event at work where we could work on anything for a day and my team tried to integrate luxrender into our company's 3D view. We only wanted one mesh (TIN), send camera and light (sun) direction. That main part went somewhat ok though it took us a very long time to figure things out. One part we absolutely could not figure out was how to use vertex colors. All our attempts failed and we could find no sample C++ code that did this. I tried to follow the source itself, but we were on a time limit. I was using matte material. I tried metal and some others, but nothing worked. Again, looked at the source code (and sample scenes) for properties to get vertex colors working to no avail. We tried both 2.1 and the most recent 2.2 beta.
I have a few questions.
1. How do you get vertex colors in DefineMesh() to work? Are they supposed to be diffuse colors?
2. Is there a list of all the properties documented somewhere? Wish the docs were a little clearer that there are almost no set methods. Those are all handled by properties.
3. What color space are the colors to DefineMesh()? I'm assuming RGB, but I saw a lot of XYZ or Spectrum data types that seemed to use the colors array.
4. Since each component of colors is float, what is the range? 0 to 1? 0 to 100? 0 to 255? Docs don't say.
Any help would be greatly appreciated.
BTW, the Windows SDK is missing the luxcore headers and library. Being new to luxcorerender, it took us a little while to realize that sdk could not be used.
Aside from the SDK and the colors issue, I was rather impressed with the library. I really like the Save() and Export() functionality for example.
How to use vertex colors?
Re: How to use vertex colors?
Unfortunately, we don't have the resources to write a good developer documentation (also because, up to now, there hasn't been a lot of requests). However, my suggestion is to just ask in this forum if you have a problem, you are likely to get an answer in a very short time.Cleo wrote: ↑Fri Jun 07, 2019 7:00 pm We had an event at work where we could work on anything for a day and my team tried to integrate luxrender into our company's 3D view. We only wanted one mesh (TIN), send camera and light (sun) direction. That main part went somewhat ok though it took us a very long time to figure things out. One part we absolutely could not figure out was how to use vertex colors. All our attempts failed and we could find no sample C++ code that did this. I tried to follow the source itself, but we were on a time limit. I was using matte material. I tried metal and some others, but nothing worked.
Yes, vertex colors can be a bit confusing at first but it a quite powerful tool.Cleo wrote: ↑Fri Jun 07, 2019 7:00 pm Again, looked at the source code (and sample scenes) for properties to get vertex colors working to no avail. We tried both 2.1 and the most recent 2.2 beta.
I have a few questions.
1. How do you get vertex colors in DefineMesh() to work? Are they supposed to be diffuse colors?
You define a color for each vertex in DefineMesh() (it is just an additional array of RGB floats). However it is not used by default, you have to use the "hitpointcolor" (https://wiki.luxcorerender.org/LuxCore_ ... pointcolor) texture to extract the information and use the result in a material.
You usually define a white matte material like:
Code: Select all
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = 0.7 0.7 0.7
Code: Select all
scene.textures.vertexcolor.type = hitpointcolor
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = vertexcolor
Here: https://wiki.luxcorerender.org/LuxCore_ ... nce_Manual2. Is there a list of all the properties documented somewhere? Wish the docs were a little clearer that there are almost no set methods. Those are all handled by properties.
RGB, you pass to DefineMesh() and array of "<vertex count> * 3" floats with an RGB value for each vertex.3. What color space are the colors to DefineMesh()? I'm assuming RGB, but I saw a lot of XYZ or Spectrum data types that seemed to use the colors array.
Always [0.0, 1.0].4. Since each component of colors is float, what is the range? 0 to 1? 0 to 100? 0 to 255? Docs don't say.
The problem should have been already fixed (but there hasn't been a new official release of the SDK since last stable release).BTW, the Windows SDK is missing the luxcore headers and library. Being new to luxcorerender, it took us a little while to realize that sdk could not be used.
Re: How to use vertex colors?
WOW! Thank you so much! We looked at the kd property repeatedly. We even searched the source code for hitpointcolor (based on another forum post) and found nothing. I must have entered a typo or something. We were so close. We had tried using uv's on a 1D texture (though still technically 2D) and it seemed to work, but we ran out of time. Now, we'll at least be able to finish our proof of concept and see a color output.
Thanks again!
Thanks again!
Re: How to use vertex colors?
It is a bit cryptic as idea but it can be quite powerful: you can associate RGB and A information to each vertex and than elaborate them as you like with textures and finally use them inside any texture-enabled material parameter.Cleo wrote: ↑Sat Jun 08, 2019 4:44 am WOW! Thank you so much! We looked at the kd property repeatedly. We even searched the source code for hitpointcolor (based on another forum post) and found nothing. I must have entered a typo or something. We were so close. We had tried using uv's on a 1D texture (though still technically 2D) and it seemed to work, but we ran out of time. Now, we'll at least be able to finish our proof of concept and see a color output.
The idea was originally developed for hairs/furs (Alpha is used for a progressive transparency from the root to the tip and RGB is used for some nice fur pattern).
Re: How to use vertex colors?
I haven't looked at hair or fur yet, but you can use vertex color with "mix" textures and mix them with other textures to use diffuse colors with other effects, correct? Oh, you can use it as parameters in other textures too? Interesting idea.
Re: How to use vertex colors?
Yes, it's basically four floats per vertex (RGBA) that you can fill with any data you'd like, and you can drive any texturable material/texture parameter with it.
For example, you could paint the "wetness" of a surface in the red channel and use it to mix with a mirror material, and paint the "dirtiness" into the green channel and use that to mix with a dirt material of some kind - a lot of possibilities.