-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shader chunk system can exceed 8 varyings #71
Comments
I see. Is there any elegant solution to this? When developing new shaders I used an unfinished "layer" system for a moment, where each layer could have only 1 UV set, and we could have all kinds of maps assigned to one layer. I also wanted to make an ability to add multiple layers with different blends over each other. But it would break old mapTransforms in old projects.
|
Actually, since we recompile & cache on any serious material change, the best option for now would be to check transform equality of different maps, and recompile if it's changed. |
Here's another suggestion: if you run out of varyings, disable normal mapping and print a warning to the JS console. At least you are then almost certain to have enough varyings since you can drop the binormal and tangent. And at least the program will link and the mesh will render (albeit not quite as prettily). I'm not saying I like this option, but it's better than what we have currently.
What did you have in mind?
It depends on the interface. I can't quite visualize what it would look like.
Yeah, this is probably the way to go for now. By the way....I did just look at the GLSL generated for the floor plane in the project. It has 9 varyings:
It looks like vUv0 isn't needed. You could use a temporary instead. I guess at the moment, the linker isn't able to drop vUv0 because it's kind of being used. |
OK, I'll fix it. So the total list of stuff to add is:
|
I would say it would be best to remove uUv0/1 where possible first (as the top priority because it's easy to fix). Ultimately, it's a question of the engine doing something sensible in every case when there are only 8 varyings possible. A failed program link must always be avoided. |
I just ran into this recently on an iPad 2 (pretty old at this point). Shader results in too many varyings. If you look at base.frag, you guys recently commented out vVertexColor. Could you also comment out the other varyings not being used? Specifically vUv1 and vNormalV. There's a comment at the top about the compiler removing unneeded stuff, but I don't think this always applies to varyings. |
@guycalledfrank I just wanted to completely understand the current status of this in the engine. Am I right in saying this is still technically an issue? What are the circumstances where the number of generated varyings can still exceed 8? |
@guycalledfrank is this still an issue, or have been addressed? This ticket been stalled, and shall be at least updated or requires a closure. |
Closing due to age. I have not seen any shader compilation/linking issues relating to a lack of varying in the last few years. |
Check out this project:
https://playcanvas.com/will/physicsperformance
The shader on the ground plane's material creates a varying for each of the 4 maps (diffuse, normal, specular, opacity). This takes the number of varyings over 8 and the program fails to link on an iPhone, for example, that can support no more than 8 varyings.
The text was updated successfully, but these errors were encountered: