I have this error whit my shader:
Number of Fragment Texture Image Units exceeds HW limits.
and here is the shader code:
shader_type spatial;
render_mode blend_mix;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform sampler2D grassTex : hint_albedo;
uniform sampler2D grass2Tex : hint_albedo;
uniform sampler2D grass3Tex : hint_albedo;
uniform sampler2D grass4Tex : hint_albedo;
uniform sampler2D cliffTex : hint_albedo;
uniform sampler2D cliff2Tex : hint_albedo;
uniform sampler2D cliff3Tex : hint_albedo;
uniform sampler2D cliff4Tex : hint_albedo;
uniform sampler2D sandTex : hint_albedo;
uniform sampler2D sand2Tex : hint_albedo;
uniform sampler2D sand3Tex : hint_albedo;
uniform sampler2D sand4Tex : hint_albedo;
uniform float offset : hint_range(5,35);
vec3 splating(vec2 uv,float channel,sampler2D tex1,sampler2D tex2, sampler2D tex3, sampler2D tex4)
{
vec3 result;
if (channel == 100.0)
{
result = texture(tex1,uv).rgb * channel;
}
else if (channel == 50.0)
{
result = texture(tex2,uv).rgb * channel;
}
else if (channel == 25.0)
{
result = texture(tex3,uv).rgb * channel;
}
else if (channel == 12.0)
{
result = texture(tex4,uv).rgb * channel;
}
else
{
result = texture(tex1,uv).rgb * channel;
}
return result;
}
void fragment() {
float redchannel = texture(texture_albedo,UV).r;
float greenchannel = texture(texture_albedo,UV).g;
float bluechannel = texture(texture_albedo,UV).b;
float alphachannel = texture(texture_albedo,UV).a;
vec3 red_level = splating(UV*offset,redchannel,cliffTex,cliff2Tex,cliff3Tex,cliff4Tex);
vec3 green_level = splating(UV*offset,greenchannel,grassTex,grass2Tex,grass3Tex,grass4Tex);
vec3 blue_level = splating(UV*offset,bluechannel,sandTex,sand2Tex,sand3Tex,sand4Tex);
vec3 result = red_level + green_level + blue_level;
ALBEDO = albedo.rgb * result;
}
Shader Problem
- Edited
To start with whats you hardware stats and driver versions?
BTW gpuinfo.org can be a useful resource for finding out hardware info for variety of devices.
Well my pc is an all in one My video card is an Intel (R) HD Graphics Supports up to OpenGL 4.0 My processor is Intel Celeron CPU J1800 at 2.41GHz
Well, I can confirm it's not the shader. I copied and pasted the code into a fresh project, and it doesn't throw any errors for me.
It seems your graphics card is a Intel HD 4000, if this article is anything to go by. I searched up your processor (Intel Celeron CPU J1800) and added "graphics" and found that article.
After some searching it seems your GPU has 16 texture processing units. Not sure what that means, but for comparison my Nvidia Geforce 660ti has 80. I imagine the texture units are how many textures your GPU can have loaded/processed at once, but that's just a guess on my part.
I'd try removing textures one by one from your shader and see how many you can get. It is likely the problem is because your shader uses 13 textures, and since Godot probably uses a few texture units for its stuff (graphics for the editor, for example), your graphics card probably just cannot process that many textures at once.
Granted, I know little about graphics cards, textures, shaders, and all that good stuff. I'm just making some slightly educated guesses based on what little I know about all this kind of stuff :smile:
@TwistedTwigleg said: Well, I can confirm it's not the shader. I copied and pasted the code into a fresh project, and it doesn't throw any errors for me.
It seems your graphics card is a Intel HD 4000, if this article is anything to go by. I searched up your processor (Intel Celeron CPU J1800) and added "graphics" and found that article.
After some searching it seems your GPU has 16 texture processing units. Not sure what that means, but for comparison my Nvidia Geforce 660ti has 80. I imagine the texture units are how many textures your GPU can have loaded/processed at once, but that's just a guess on my part.
I'd try removing textures one by one from your shader and see how many you can get. It is likely the problem is because your shader uses 13 textures, and since Godot probably uses a few texture units for its stuff (graphics for the editor, for example), your graphics card probably just cannot process that many textures at once.
Granted, I know little about graphics cards, textures, shaders, and all that good stuff. I'm just making some slightly educated guesses based on what little I know about all this kind of stuff :smile:
well maybe it's time to buy a new pc :(
@Trinketos said: well maybe it's time to buy a new pc :(
Well, maybe. However it's always good to have a lower end machine to test with too so it's not a bad idea to keep the Intel HD graphics system around as well.