Is it possible to use grayscale (black/white) bump map instead of normal map?
Hi, welcome to the community!
No, afraid not. You need a tangent-space normal map for bump mapping. A grayscale bump map can only be used for parallax mapping. You will need to convert it. I believe there are tools for this.
You could perhaps write a shader that makes use of a bump-map–but I doubt that it would be as effective as a normal map, and might be less efficient.
(Converting your bump-map to a normal-map, as suggested by rdb, is likely the better option. I believe that GIMP can do this, for one.)
You certainly could write such a shader; you would need to sample the neighbouring texels of the bump map and calculate the normals based on the difference in height. This would be quite a bit less efficient and put more strain on the texturing pipeline.
Yes, something like this, copied from stackoverflow.
const vec2 size = vec2(2.0,0.0); const ivec3 off = ivec3(-1,0,1); vec4 wave = texture(p3d_Texture0, texcoord); float s11 = wave.x; float s01 = textureOffset(p3d_Texture0, texcoord, off.xy).x; float s21 = textureOffset(p3d_Texture0, texcoord, off.zy).x; float s10 = textureOffset(p3d_Texture0, texcoord, off.yx).x; float s12 = textureOffset(p3d_Texture0, texcoord, off.yz).x; vec3 va = normalize(vec3(size.xy,s21-s01)); vec3 vb = normalize(vec3(size.yx,s12-s10)); vec4 bump = vec4( cross(va,vb), s11 );