Jump to content
Scott Richmond

Anyone successfully implemented model texturing using vert coloring?

Recommended Posts

I'm about to attempt to create a simple model in Maya 2013 and texture it using vertex coloring. What I want to do is be able to procedurally texture the model via code and a shader using vertex painting. In Maya I will define the color of the vertex's and then supply the textures in the shader at runtime.

 

For example a 2D plane model:

x = a vertex

x---x---x

| \ | / |

x---x---x

| / | \ |

x---x---x

 

I want each of the verts to have their own color that I can assign a texture to in runtime.

 

In this thread I'd like to ask if anyone has been able to do this successfully from Maya?

 

Any other advice?

Share this post


Link to post

Leadwerks supports vertex coloring. I imported once a vertex colored car and it looked quite decent without any textures. Not sure what formats Maya supports, but with UU3D you should be able to get it right into Leadwerks.

Share this post


Link to post

I appear to have been able to import a model with vertex coloring - The untextured model itself has the colors I specified.

Now I need to work out how to access these colors in a frag shader and apply blends between textures. Any ideas or resources to check out?

Share this post


Link to post

I appear to have been able to import a model with vertex coloring - The untextured model itself has the colors I specified.

Now I need to work out how to access these colors in a frag shader and apply blends between textures. Any ideas or resources to check out?

 

"fragcolor" is what you're looking for.

Share this post


Link to post

Are you trying to make a texture splatting shader from rgba vertex colors for terrain?

 

This

3drad2010081310261080.jpg

 

Translates to

3drad2010081310263041.jpg

Share this post


Link to post

Are you trying to make a texture splatting shader from rgba vertex colors for terrain?

 

This

3drad2010081310261080.jpg

 

Translates to

3drad2010081310263041.jpg

 

I think this is the way LE does terrain texturing.

Share this post


Link to post

Are you trying to make a texture splatting shader from rgba vertex colors for terrain?

More or less exactly that yes Shadmar. However I'll need more than 3 textures (pure R, B and G).

Share this post


Link to post

It's simple to do RGB plus A for the fourth, but if you need more than 4 it gets complicated since all colors consist of RGB.

You need to have layers of multiple RGBA maps blended with a mask. I don't think you can't have vertexcolors only then.

Share this post


Link to post

It's simple to do RGB plus A for the fourth, but if you need more than 4 it gets complicated since all colors consist of RGB.

You need to have layers of multiple RGBA maps blended with a mask. I don't think you can't have vertexcolors only then.

Ah I thought that was the case. What are my options Shadmar? What do the LE terrain shaders do to achieve 16 texture layers?

What about using UV channels?

Share this post


Link to post

I haven't studied the terrain shaders that comes with LE.

No lesdk on my phone (on vacation) :-)

Share this post


Link to post

I haven't studied the terrain shaders that comes with LE.

No lesdk on my phone (on vacation) :-)

haha no problems mate. Would love your advise once you're back from vacation though. :)

Share this post


Link to post

From what I can see the default LE terain shader uses 16 textures, but you can't use all those for different stuff like rock,grass,snow,sand etc..

 

So basic RGBA blend is used here too.. I would guess with accompanying bump textures, and base color texture.

 

These are the textures fetched in terrain.frag :

 

uniform sampler2D texture0;// texture0
uniform sampler2D texture1;// bumpmap0
uniform sampler2D texture2;// texture1
uniform sampler2D texture3;// bumpmap1
uniform sampler2D texture4;// texture2
uniform sampler2D texture5;// bumpmap2
uniform sampler2D texture6;// texture3
uniform sampler2D texture7;// bumpmap3
uniform sampler2D texture8;// texture4
uniform sampler2D texture9;// bumpmap4
uniform sampler2D texture10;// basetexture
uniform sampler2D texture11;// tilemap
uniform sampler2D texture12;// colormap
uniform sampler2D texture13;// alphatexture
uniform sampler2D texture14;// normaltexture
uniform sampler2D texture15;//heightmap

Share this post


Link to post

From what I can see the default LE terain shader uses 16 textures, but you can't use all those for different stuff like rock,grass,snow,sand etc..

 

So basic RGBA blend is used here too.. I would guess with accompanying bump textures, and base color texture.

 

These are the textures fetched in terrain.frag :

 

uniform sampler2D texture0;// texture0
uniform sampler2D texture1;// bumpmap0
uniform sampler2D texture2;// texture1
uniform sampler2D texture3;// bumpmap1
uniform sampler2D texture4;// texture2
uniform sampler2D texture5;// bumpmap2
uniform sampler2D texture6;// texture3
uniform sampler2D texture7;// bumpmap3
uniform sampler2D texture8;// texture4
uniform sampler2D texture9;// bumpmap4
uniform sampler2D texture10;// basetexture
uniform sampler2D texture11;// tilemap
uniform sampler2D texture12;// colormap
uniform sampler2D texture13;// alphatexture
uniform sampler2D texture14;// normaltexture
uniform sampler2D texture15;//heightmap

 

How is it able to use so many textures with RGBA texturing though? Can it be extended further?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...