Vertex Color Tools

User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Vertex Color Tools

Post by clintonman »

VertAnimTest2.gif
This should be animated...
Click the image to see the animation.

I've been working on some vertex color painting tools. Above is a test of using them in an animated material. The wire frame shows the true geometry and the deform is from the material vertex shader. No vertex colors are shown. Just the values are used to deform the mesh.

PaintVertexAnimation.jpg

The result above is chunky because of the low fidelity mesh and also because the brush has a flat profile. So a brush profile input will need to be added so it can paint with smooth transitions.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Vertex Color Tools

Post by clintonman »

VertexColorsUsed.jpg

Here's a picture with the vertex colors showing. The plane was painted with progressively lighter colors from left to right. The lighter colors drive the animation to move more.

Also of note in the original post image is that the normals of the plane don't change. Even when deformed it displays as if it was a flat plane. There is no practical way to get the normals to deform with the mesh using the older directx material system. I think that ability came out with directx 10 or 11, geometry shaders.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Vertex Color Tools

Post by trueBlue »

I have no idea how you are animating this or what is required.
With regards to Normal Maps, take a look at the Water shader in the Materials - DX9 library.
Example Scene
viewtopic.php?p=8598#p8598
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Vertex Color Tools

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 17:43 I have no idea how you are animating this or what is required.
With regards to Normal Maps, take a look at the Water shader in the Materials - DX9 library.
Example Scene
viewtopic.php?p=8598#p8598
The normalmaps live on top of the geometry normals. The vertex shader is missing the geometry normal changes.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Vertex Color Tools

Post by clintonman »

VertexPaintProfile.jpg
I was able to add a profile "curve" for the vertex paint brush. The sliders from left to right define the strength of the brush from center to the outside radius. This works pretty well.

VertexPaintSplotchyAdd.jpg
While testing the add brush mode I got this crazy pattern. It should be a smooth color. I was racking my brain and I think I finally figured out why. The add mode will add to the existing color, but I think it is adding color and then adding to the added color. I need to store the original colors in a separate location and use that as the basis for adding, then update all colors at once.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Vertex Color Tools

Post by trueBlue »

The plane I posted in the other thread was first painted red to all of the vertices, then I added 3 or 4 colors on top of that
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Vertex Color Tools

Post by clintonman »

VertexPaintSmoothFix.jpg

Splotchy paint and other design flaws are fixed and made the profile editor more intuitive.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5214
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Vertex Color Tools

Post by trueBlue »

:superbanana:
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Vertex Color Tools

Post by clintonman »

VertTextureAnimTest.gif
click to see the animation


Animation test of vertex displacements driven by vertex colors. The original morph animation is on the left and the vertex color driven animation is on the right. The vertex colors are setup to drive the displacement and color. Normally it would just drive the vertex positions.

VertexTextureAnim.jpg
The bitmap to drive the animation is created with the Vertex Texture Animation tool. It reads the vertex positions of the morph animation and creates 2 textures from it. The green texture is the animated vertex positions and the purple is the animated geometry normals. The normals aren't used because of a trueSpace limitation. That is the reason the vertex color animation has a smooth surface. The textures and mesh can be exported from tS to be used in a game engine. The texture uses uv set #2 with special uv's it sets up in the mesh.

Far right is the script that drives the animation. Outside of trueSpace the animation would be driven purely by a vertex shader.
VertexTextureAnimShader.jpg
This is the vertex shader. The number values shown came from the Vertex Texture Animation tool, a scale and offsets for x, y, z. No X is shown because the offset was 0.
Not shown is the color shader that just uses the vertex colors.
Clinton Reese

http://clintons3d.com
Saul
Senior Chief Petty Officer
Posts: 296
Joined: 22 May 2009, 16:50

Re: Vertex Color Tools

Post by Saul »

Nice! is this something that could be used instead of animated phyS cloth?
Post Reply