V6 (and V5) Once a Mesh has Vertex Color Data it wont display any Texture that is applied to it in the viewport. Once i rebuild the Mesh without Colors (in code) the Texture shows up again.
It would be nice if the Shader multiplies the Texture Color with the Vertex Colors…
In V5 if i have a mesh with vertex color and assign a texture to the mesh material, the texture wins and is drawn on top of the vertex colors. If the texture has transparent areas, i can see the vertex colors in these areas. To me this is correct behaviour. I can “mix” the texture with vertex colors if i change the texture percent eg. to 50%.
In V6 if the mesh has vertex colors and a texture is applied, the texture is not shown at all which looks buggy to me. (Also using the partial transparent areas, i see no texture, just vertex colors). As soon as i clear the vertex colors using _RebuildMesh, the texture shows up. Maybe @jeff can clean this up. I’ve tested with default “Rendered” display mode.
i guess you are right about v5 - didn’t spend too much time there…
as for v6: Mixing would be an option, but multiplying would be more consistent, as most software packages use vertex colors as a multiplier in shading (or weight map)
Side question - is the shader part of the display pipeline exposed? I know about the Display Conduits - but can i implement custom glsl shaders in a plugin?
Sorry i have no idea. But you might open a new thread with this question. I hope this thread gets some attention and the display problem in V6 i mentioned above gets adressed.
I see this here as well… indeed seems buggy. I’ll try tuning this up right now since I’m currently looking at it.
That’s exactly what Rhino does… The “diffuse” color is mixed with the texture based on the texture’s “amount” value (spinner control to the right of the texture setting). Vertex color are simply a diffuse color override, so this should work correctly and as you expected once I fix the problem Clement mentions above.
So…here’s what needs to be said… Objects with vertex colors by default do not shade…meaning, no lighting calculations are applied… So things like specular highlights and bump maps will not show up by default. There is a setting in the display mode panel “Shade vertex colors” which needs to be checked in order to get the latter and the results in all of the images above… Without it this is what you get:
Sorry to ask again - but this is not multiplying but some other blend operation.
It should be white * red = red
why i ask: with the current math (if i understand it right) you cant tint a texture, only mix Vertex Colors with Texture Colors - basically get an average. If it would multiply you can control the full ‘range’ of colors.
Even better would be a blend based on middle gray… don’t remember what that was called in opengl…
You’re right, it’s not a direct multiply…it’s a lerp of the two colors. There is no direct way to say “multiply diffuse channel by some texture channel” in Rhino at the moment. Doing so by default would somewhat produce the opposite problem in this thread… “I can’t get 100% of my texture if/when vertex colors exist”… For single diffuse values, we would just say “Set your diffuse color to white”. But if/when the diffuse color varies across the surface (i.e. vertex colors), there would be no way to work around that, and I’d be stuck with something like this (using the example above):
Without some additional control(s) and/or setting(s) added to the UI, I currently can’t think of a way to get you there, At this point in the V6 development cycle, I can’t add UI, sorry.
Textures in Rhino by default are setup as “blended” channels…with the exception of the Environment Map channel…I believe it’s setup as a “modulated” channel (which is what you want)…however, that channel also has a predefined, canned mapping…so it won’t help you here.
That being said, I may be able to add a test command and plugin to get you what you need…let me think about it.
@pascal, ok great. I will investigate further once this fix is out.
Currently if i use the “Shade vertex colors” option in V6 using Rendered display mode, it looks like in V5, but not using Shaded display mode. It seems to have some strange over lightning then which does not happen in Rendered. (No texture involved at all).
Oh I see…this is Shaded mode… Hmmm… Looks like the canned env map in Shaded mode, along with the 3 light sources, is getting applied “incorrectly” for some reason… Oh wait…
Duh… This is because of the new vertex shader I added in SR6… Dang. You can work around this for now by CHECKing “Advanced GPU lighting” in Shaded mode’s settings.