• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Rook3D · Oct 03, 2011 at 10:49 AM · textureshadersblendervertex color

Texture blending Shader using Vertex Coloring with Blender Model

Hi there, I'm trying to set up Texture blending using Vertex coloring with a Blender model ( to blend different texture edges ).

I have done some research on this and come across a few posts describing some of the solutions and some of the problems.

One of the problems seems to be Blender only exporting Vertex Colors using RGB, not RGBA ( if I have understood correctly ) - as mentioned by Jessy in this Post:

http://forum.unity3d.com/threads/15444-fbx-import-messes-up-vertex-colors?p=229027&viewfull=1#post229027

I've tried running that Python script without success, it's from 2009 though so...

I've also come across some shaders posted by Jessy here for blending Texture using Vertex colors :

http://forum.unity3d.com/threads/44749-Vertex-Paint

I've tried both RGB & RGBA versions - the RGB version seems to almost work, but not quite :

It seems to only get a part of the texture color, not the entire texture.

Jessy seems to be the expert on this, so maybe he's around? - if not maybe someone else has encountered this and worked it out.

It seems that the best approach is to convert Blender's exported RGB over to RGBA somehow, and use the better RGBA shader... but I'm no expert.

Also, while we're here, I have a few additional questions about this approach :

  • Are there any lighting or other graphical issues?

  • Is the performance comparable with just using - say a diffuse shader with 2 materials?

  • any other drawbacks / complications?

Thanks for any help.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Rook3D · Oct 14, 2011 at 12:32 AM

For anyone else interested in this :

Vertex Alpha for Texture Blending

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Rook3D · Oct 04, 2011 at 06:02 AM

So, with further research, I've manage to solve the first issue - which is how to get Blender to export a customizable Alpha value for the vertex colors.

This involves modifying the 'export_fbx.py' ( C:\Program Files (x86)\Blender\2.58\scripts\addons\io_scene_fbx\ ):

Replace the existing code block ( search on the first line ), with the one below ( please note - back up the 'export_fbx.py' file beforehand ):

             for col in colors:
                 fakeAlpha = (col[0]+col[1]+col[2]) / 3
                 if i == -1:
                     file.write('%.4f,%.4f,%.4f,%.4f' % (col[0],col[1],col[2],fakeAlpha))
                     i = 0
                 else:
                     if i == 7:
                         file.write('\n\t\t\t\t')
                         i = 0
                     file.write(',%.4f,%.4f,%.4f,%.4f' % (col[0],col[1],col[2],fakeAlpha))
                 i += 1
                 ii += 1  # One more Color


This just sets the Alpha value to an average of the RGB color intensities, so you can just use grayscale painting really.

( Nb: Blender invokes this export script, so it will work just by re-saving the .blend file )

BUT - now I'm back to same issue as I had with the RGB shader, in the using the RGBA shader, comes up with the same lack of texture - it only seems to use the FIRST color of each of the two textures to colorize the entire object.

I'm thinking maybe there is a texture import setting I don't know about...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Getting a detailed procedural texture in Blender to look the same in Unity 2 Answers

Shader: 1 Base Texture Overlaid by 1 Transparent Texture. 0 Answers

blender to unity 3 Answers

Importing blender model - no texture details 1 Answer

Assigning UV Map to model at runtime 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges