Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Geoxion · Mar 07, 2016 at 12:18 PM · shadershaderssurface shadersurfaceshader

Surface shader, too many samplers workaround

Hey there everyone,

I've got a bit of a problem with the amount of sampler2D's I want to use in a surface shader of mine. So far I'm pretty happy with how it looks.

I'm working on my game that takes place in a mine. The shader is for the walls of the mine. They are tesselated, which might make things more difficult.

Now I want to add resource visuals for in the walls (Gold, Iron and crystal patches). For each of those resources I need albedo, normal and metallic textures. In total I need 15 sampler2D's.

But Unity/DirectX doesn't like that. It says you can only use 16. Now, I'm using 15, but I guess Unity needs some as well...

My question, how do I get around this in a deferred lighted scene?

What I've tried so far:

Have two surface shaders in one:

 Properties
 Tags
 CGPROGRAM
 //Shader part one
 ENDCG
 
 Tags
 CGPROGRAM
 //Shader part two
 ENDCG
 

But this only worked in forward rendering. Not an option.

Then I tried to completely seperate the shaders, make two materials and give the wall renderer those two materials. At first this worked, but when I zoomed out, there was a lot of Z fighting. Also not good.

As you might notice, I'm not the best with shaders. Only just picked them up.

I know I can combine textures, and have already done so with textures that sort of go together. But if I were to combine more, then that would result in pretty weird combinations. (like a heightmap and albedo stitched together)

Thank you for reading! I hope there's a good solution to this.

Dion Dokter

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
0
Best Answer

Answer by Geoxion · Mar 07, 2016 at 05:47 PM

Ok, fixed it.

Did it with my own solution: stiching two unrelated textures to eachother.

I really don't like it, so if someone knows another solution, then I'd gladly hear it.

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

67 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 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 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

Help with a NURBS / B-Spline / Bezier patch shader. 0 Answers

Creating a shader for trees... Please help with everything involving shaders! 1 Answer

Modifying shader requires restarting application 0 Answers

How to make the Shader combines two alpha textures ? 0 Answers

Getting Color Generated from Shader to Script to Shader 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