Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411539 Posts in 69383 Topics- by 58439 Members - Latest Member: isabel.adojo

May 02, 2024, 02:25:29 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Wings3d vertex coloring
Pages: [1]
Print
Author Topic: Wings3d vertex coloring  (Read 1980 times)
PlayMeTape
Guest
« on: February 20, 2010, 07:23:41 AM »

Does anyone know if it is possible to get your vertex coloring from wings3d into Unity when you export your model?

I've been struggling with this for a while with no success. Sad
Logged
PlayMeTape
Guest
« Reply #1 on: February 20, 2010, 08:09:38 PM »

Tihi, silly me. Thought it could actually bake that into the model somehow.

Don't laugh at me I'm new at this!
Logged
Zaphos
Guest
« Reply #2 on: February 20, 2010, 08:51:08 PM »

Er, are you saying you concluded it was impossible?  How were you trying to do it?

IIRC some file formats (notably obj) do not support vertex colors so wings3d will just ignore the colors if you export to those.  But other file formats do (like ... wrl apparently) so it's a matter of (A) exporting with a format that supports vertex colors, (B) making sure you can import that format correctly and (C) making sure unity uses the vertex colors while rendering.  I don't use unity so I can't speak to B or C, but quickly googling about it seems like rendering with vertex colors in unity is possible, and I imagine it should be possible to write your own importer if needed.
Logged
nihilocrat
Level 10
*****


Full of stars.


View Profile WWW
« Reply #3 on: February 20, 2010, 09:45:30 PM »

Awhile back I stopped using vertex colors and instead opted to use a super-simple texture because I had issues importing vertex colors into various engines, or in some cases, I had trouble changing vertex colors correctly at runtime to represent team colors. The textures are just large blocks of color, and I UV unwrap polygons that I want to be certain colors and cram them into the color block I want them to be. I don't really have to worry about properly unwrapping them as if I were drawing a real textue, so it's not very hard to do.

If you don't care about draw call count, you can also vertex color up your model and pick "convert vertex colors to materials", one of the right-click options in 'face' mode, I think. This gets you what are basically vertex colors using the FBX exporter, but models require a draw call for every material if I'm correct, so it's not particularly efficient.

edit: I did some googling and re-discovered a very useful Unify wiki page:
http://www.unifycommunity.com/wiki/index.php?title=Shader_Archive

I tried out this one... uh... hell... let me just post the source:
Code:
Shader "Vertex Colored" {

Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _SpecColor ("Spec Color", Color) = (1,1,1,1)
    _Emission ("Emmisive Color", Color) = (0,0,0,0)
    _Shininess ("Shininess", Range (0.01, 1)) = 0.7
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

SubShader {
    Pass {
        Material {
            Shininess [_Shininess]
            Specular [_SpecColor]
            Emission [_Emission]   
        }
        ColorMaterial AmbientAndDiffuse
        Lighting On
        SeperateSpecular On
        SetTexture [_MainTex] {
            Combine texture * primary, texture * primary
        }
        SetTexture [_MainTex] {
            constantColor [_Color]
            Combine previous * constant DOUBLE, previous * constant
        }
    }
}

Fallback " VertexLit", 1
}

Just create a .shader file in your assets and paste this into it. Export your vertex-colored model from Wings3D as FBX, and assign this shader to the material used for the model.

I think I'll stick to my texture solution for now, but I'm tempted to see if there's an easy way to change vertex colors on the fly so I could pretty much replace my current method if I wanted to.
« Last Edit: February 20, 2010, 10:00:21 PM by nihilocrat » Logged

PlayMeTape
Guest
« Reply #4 on: February 21, 2010, 04:57:02 AM »

Wow, thanks nihilocrat! Before I posted the other time I had discovered I could get it to draw the face colors to any texture I created when I was UV-mapping. So I actually just used the texture instead Tongue.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic