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
0
Question by creat327 · Sep 17, 2010 at 03:35 PM · texturematerialsmerge

Merging Textures

Hi

I have a building with 3 textures that bend one on top of the other to create the desired visual. I bought this building fbx file. I naively openned it up and tried to 'bake' the 3 textures into one using 3ds max but it did not work.

If I import the fbx into unity, it works just fine but it uses 3 drawcalls. This is for the iphone so it would be great if I could use 1.

Is there a way to merge the 3 textures using unity? otherwise, any other tool that would do the trick? 3ds max doesn't seem to bake this one correctly.

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

4 Replies

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

Answer by skovacs1 · Sep 17, 2010 at 04:14 PM

You seem to be concerned over your draw calls. Are you sure that the mapping is the cause of your draw calls? Do you have separate objects with separate materials? How many lights and what lighting mode are you using? Are you doing anything fancy with your camera renders? What kind of shaders and effects are you using? There are too many things that can up your draw calls. Please see this Unite presentation for some useful information.

Assuming that your materials are the issue, the real problem is that 3DS max materials are separate materials and even the blend/composite/Multi-SubObject materials only take in multiple separate materials, not separate maps.

If the only thing different about your materials is a map of some kind, then you can merge them into one map and apply them as one material, but if the material properties are actually different, then it becomes harder and you would either need separate draw calls or to generate merged maps of the material settings as well but that still may not reduce your draw calls.

Merging your maps

If your maps are blended in a fairly straightforward manner, you could author a simple 3 Blend shader in Unity that takes in 3 materials to do your blending and it would look kind of like this:

Shader "Example/3 Alpha Blended Textures" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _BlendTex ("Alpha Blended (RGBA)", 2D) = "white" {}
        _BlendTex2 ("Alpha Blended (RGBA) 2", 2D) = "white" {}
    }
    SubShader {
        Pass {
            // Apply base texture
            SetTexture [_MainTex] {
                combine texture
            }
            // Blend in the alpha texture using the lerp operator
            SetTexture [_BlendTex] {
                combine texture lerp (texture) previous
            }
            // Blend in the alpha texture using the lerp operator
            SetTexture [_BlendTex2] {
                combine texture lerp (texture) previous
            }
        }
    }
}

To reduce the memory and load though, it would be better if you just took the maps and merged them into one. You could use your image editor of choice, applying the appropriate deformation according to your UV's (which you can get with Unwrap UVW's if you need - look up UV unwrapping), or you could just bake the textures in 3DS max - RenderToTexture and add as output the map you want (diffuse for example)(see this tutorial if you're having trouble).

To make your life easier, with your shiny new merged map, in max, change the material on your object to one that applies your map. When you import into Unity, it should import only the one material with only the one map.

Separate material settings

You would generate one or more maps like the above for your material settings and then you would have to author a slightly more complex shader that applies the settings with the values you've input. Since I don't know the specifics of your materials, I can only guess at what settings would be different, but you could just look at the source for the built-in shaders for reference and adjust those.

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 squall_789 · Sep 17, 2010 at 04:05 PM

Why not just use Photoshop? Or GIMP...those are made for editing images, whereas MAX and Unity are not. Plus in Photoshop you can have Blend layers too so you can more easily tweek it, though you might want to export your UV map into photoshop in order to line it all up propperly, otherwise it will be ugly looking.

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 alexnode · Sep 17, 2010 at 04:05 PM

After baking to texture you should have one texture, did you combined the meshes ? there are some tools that can create atlas maps, search online it is exactly what you are trying to do...

The manual way is like that ...

In order to bake to texture you need to combine(attach) the three objects(automatically a multisubobject material will be created,) then you need to create a temporary 2nd Uv channel, where all the textures fit in one uv tile with unwrapp modifier. Just fit everything in the box (you could use automatic unwrapp but i really don't recommend it for such an optimized work required for an I-phone.)

After that in render to texture you should choose 2nd uv channel for baking . in practice you read the three materials and bake them in this new channel. After finishing rendering you should replace the 1st uvchannel with the baked 2nd uv channel, just make the first uvchannel 1st. collapse the mesh and then with the channel info tool delete the unesseccary 2nd uv . then create a new material that has only the baked texture in diffuse channel.

hope that helps...

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 PetrSevostianov · Feb 09, 2015 at 03:13 PM

You can try Unity utility CompositeMap: https://www.assetstore.unity3d.com/en/#!/content/28788

It works similar to CompositeMap map in 3ds Max or Layered Texture in Maya and allows to merge and customize textures using masks of materials.

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Textures are not tiling properly on my wall model! 3 Answers

Why are merged materials modified when Unity opens? 1 Answer

Setting up regions for different materials 1 Answer

Importing complex objects from Blender with colors 1 Answer

How to merge two textures of different size? 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