Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 radwan92 · Sep 12, 2014 at 10:25 AM · texturemeshtilevertex

Texture layers on single mesh

I have a little tile editor with procedurally generated mesh. Everything works fine with single texture, but i would like to be able to paint multiple layers on each tile. What it should look like:

I paint a grass on a tile by applying grass uv. Next I paint some flowers (as a second layer) on this grass, which I would like to paint from different texture. Then on another tile I paint the very same grass, but as a second layer now I can add, let's say, tree, which is located in the same texture as flowers. I want be able to remove these layers independently, so they can't be "hard painted" with texture SetColors.

I was wondering how is something like this achieved? First idea that came to my mind was creating meshes that would be offset by some small value (so every next layer would be on top of the previous one), but this doesn't seem like a good solution. I've seen similar effect in vertex painting (but I'm quite sure that my case is way way easier than vertex painting). Any ideas appreciated.

Offtopic: As I'm constantly learning all that graphics stuff, I was thinking about messing around with that vertex painting, but couldn't find any good source of knowledge on this topic. Does anyone know good one? Or could point me in right direction?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by VesuvianPrime · Sep 12, 2014 at 11:20 AM

Hey Radwan92

This question may help you: http://answers.unity3d.com/questions/22961/multiple-textures-layered-in-a-single-mesh.html

I think your best bet is going to be writing a shader that takes multiple texture inputs and masks each one. I know this can be done very easily in ShaderForge, though this is not an inexpensive solution:

https://www.youtube.com/watch?v=2ZNJ_KytrE4

Comment
Add comment · Show 4 · 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 radwan92 · Sep 12, 2014 at 11:31 AM 0
Share

I've been there already, and, either it's not what I'm looking for or I do not understand it. The only thing you can control in your submesh are triangles (which hold verts indices). From my understanding in this situation you cannot have different regions of one texture applied on top of another, because you do not control uv. What it means is you can have flower on top of the grass or tree, but never both (one tile grass with flower, next one grass with tree). Or am I wrong?

avatar image VesuvianPrime · Sep 12, 2014 at 12:00 PM 1
Share

You can do some really interesting things with shaders.

In the youtube video the author demonstrates how you can use the color channels of painted verts to control how different textures blend together. This behavior very much allows you to have multiple textures occupying the same space.

This isn't at all limited to vertex colors. You could paint your own black and white mask to finely control how different layers combine (for example stamping flowers over grass).

Do you have access to anything like $$anonymous$$aya or 3DS$$anonymous$$ax? Node-based shader editors are a lot of fun to play with, and you'll learn a ton about rendering.

avatar image radwan92 · Sep 12, 2014 at 12:14 PM 0
Share

Looks like I'll have to learn alot (shaders) before moving on. I have $$anonymous$$aya, but I didn't know I can make some shaders with it. Thank you very much sir.

avatar image VesuvianPrime · Sep 12, 2014 at 12:33 PM 1
Share

Take a look at the hypershade! http://www.3dtutorialzone.com/tutorial?id=66

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.

Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Repeating Images From an Atlas 0 Answers

How do I use many different tile textures for one mesh? 2D Tile based game. 2 Answers

Calculate UV coordinates of 3D point on plane of mesh's triangle 1 Answer

Repeat Texture instead of Stretching it all over? 4 Answers

Simple mesh deformation : Mesh.vertices or vertex shader with displacement texture ? 1 Answer


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