What exactly are the differences between the two?
I know exactly what Gouraud shading is, and even though Vertex colour seems to be a more contemporary term, it seems to be more or less the same thing - per Vertex lighting information, rather than pixel level.
Cheers,
RumbleSushi
Replies
Vertex colour = way of storing colour information on a per vertex level.
Goraud Shading = way of assigning lighting data to verts and interpolating between those values to give a smooth result
Vertex colors work in a similar way but without the real time math. Instead the values are saved in each vert permanitly.
This has a few advantages. First, its really efficient provided your using it in stead of real-time lighting, and second it gives you total control over the colors being used.
Some shader/physics systems can use vertex color values to control other things. Like how rigid or soft a mesh is at a particular location, or what texture gets used when a shader is applied to particular polygons.
So if you bake lighting info into vertex colors, then show just the vertex colors, it ends up looking just like Gouraud. Kinda cool.
The only difference then is that Vertex colour stores colour rather than just light information, obviously
jocose - that's interesting actually, sounds like an efficient way of handling physics data, even though it isn't intended for that purpose.
Do you guys know exactly how a 3D engine interprets Vertex colour and uses it in the rendering pipeline?
If used on textured polygons (which of course it would be) - presumably it would be used as a second render pass with a blend mode?
I'm pretty sure there is no second pass, that sounds excessive. vertex colour tinting has been around since forever. more than likely the colour is just multiplied over the diffuse colour
so texturecolour * lighting * vertex colour
someone with shader writing experience should probably confirm that but it seems the most likely answer
Not having pixel level control in my engine is pretty annoying. I'm contemplating adding Vertex Colour, but it's going to be too expensive, like Gouraud Shading. Both involve rendering the polygon twice, one with diffuse, and the second with the lighting data/vertex colour with a blend mode. I'll have to stick to baked textures, annoying, but the rendering is more of a bottleneck than RAM in my environment.
If you've written a textured polygon drawing function then why not integrate your vertex colour into that? your using a barycentic coord to sample your texture so why not use it to work out the vertex colour factor it in when you draw your pixel.
Some OpenGL code I found after a quick search, might help you...
http://www.cs.hs-rm.de/~panitz/hopengl/skript.html#LineAttributes
fletch - usually you'd be right
The thing is, my engine is not a scanline renderer. It's built in Flash, and you don't have pixel level control. So I have 2 ways of rendering polygons.
After the vertices are transformed etc, and the polygons checked for visibility, you can either use flash's 2D drawing API to draw a triangle, with moveTo(), lineTo() etc with a texure fill and transformation matrix, or you can use the draw triangles function, which you feed a list of transformed Vertex coordinates and a texture, and it draws triangles in batches for you.
Either way, it's only polygon level control, rather than pixel level. So to apply lighting data or vertex colour, you'd need to render a seperate batch of polygons with just that data, plus a blendmode (which is expensive) on top of the textured polygons.
That results in about 25% of the normal performance, which is obviously not acceptable, especially when we're talking super low polycounts anyway.
That's why I'm pretty much going to just use baked textures