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
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.
Your answer
Follow this Question
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