diff --git a/examples/06-bump/fs_bump.sc b/examples/06-bump/fs_bump.sc index a27ed1b07..9f1c27c5f 100644 --- a/examples/06-bump/fs_bump.sc +++ b/examples/06-bump/fs_bump.sc @@ -48,7 +48,7 @@ vec3 calcLight(int _idx, mat3 _tbn, vec3 _wpos, vec3 _normal, vec3 _view) vec3 lightDir = mul(_tbn, normalize(lp) ); vec2 bln = blinn(lightDir, _normal, _view); vec4 lc = lit(bln.x, bln.y, 1.0); - vec3 rgb = u_lightRgbInnerR[_idx].xyz*max(0.0, saturate(lc.y) ) * attn; + vec3 rgb = u_lightRgbInnerR[_idx].xyz * saturate(lc.y) * attn; return rgb; } diff --git a/examples/12-lod/fs_tree.sc b/examples/12-lod/fs_tree.sc index b431da9a5..c7be20c97 100644 --- a/examples/12-lod/fs_tree.sc +++ b/examples/12-lod/fs_tree.sc @@ -23,16 +23,19 @@ void main() { vec2 viewport = (u_viewRect.zw - u_viewRect.xy) * vec2(1.0/8.0, 1.0/4.0); vec2 stippleUV = viewport*(v_pos.xy*0.5 + 0.5); - if ((u_stipple.x - texture2D(u_texStipple,stippleUV).r)*u_stipple.y > u_stipple.z) + vec4 color = texture2D(u_texColor, v_texcoord0); + if ((u_stipple.x - texture2D(u_texStipple,stippleUV).r)*u_stipple.y > u_stipple.z || color.w < 0.5) + { discard; + } vec3 lightDir = vec3(0.0, 0.0, -1.0); vec3 normal = normalize(v_normal); vec3 view = normalize(v_view); vec2 bln = blinn(lightDir, normal, view); - float l = max(0.0, saturate(bln.y) ); + float l = saturate(bln.y); - vec4 color = toLinear(abs(texture2D(u_texColor, v_texcoord0))*l); + color.xyz = toLinear(color.xyz)*l; gl_FragColor = toGamma(color); } diff --git a/examples/12-lod/lod.cpp b/examples/12-lod/lod.cpp index 9021c305d..4a9b750af 100644 --- a/examples/12-lod/lod.cpp +++ b/examples/12-lod/lod.cpp @@ -481,12 +481,12 @@ int _main_(int /*_argc*/, char** /*_argv*/) bgfx::setTexture(0, u_texColor, textureBark); bgfx::setTexture(1, u_texStipple, textureStipple); - bgfx::setUniform(u_stipple, stipple, 1); + bgfx::setUniform(u_stipple, stipple); mesh_trunk[mainLOD].submit(program, mtx, false); bgfx::setTexture(0, u_texColor, textureLeafs); bgfx::setTexture(1, u_texStipple, textureStipple); - bgfx::setUniform(u_stipple, stipple, 1); + bgfx::setUniform(u_stipple, stipple); mesh_top[mainLOD].submit(program, mtx, true); if (transitions @@ -494,12 +494,12 @@ int _main_(int /*_argc*/, char** /*_argv*/) { bgfx::setTexture(0, u_texColor, textureBark); bgfx::setTexture(1, u_texStipple, textureStipple); - bgfx::setUniform(u_stipple, stippleInv, 1); + bgfx::setUniform(u_stipple, stippleInv); mesh_trunk[targetLOD].submit(program, mtx, false); bgfx::setTexture(0, u_texColor, textureLeafs); bgfx::setTexture(1, u_texStipple, textureStipple); - bgfx::setUniform(u_stipple, stippleInv, 1); + bgfx::setUniform(u_stipple, stippleInv); mesh_top[targetLOD].submit(program, mtx, true); } diff --git a/examples/runtime/shaders/dx11/fs_tree.bin b/examples/runtime/shaders/dx11/fs_tree.bin index 1f92301ea..f7cdb6b32 100644 Binary files a/examples/runtime/shaders/dx11/fs_tree.bin and b/examples/runtime/shaders/dx11/fs_tree.bin differ diff --git a/examples/runtime/shaders/dx9/fs_tree.bin b/examples/runtime/shaders/dx9/fs_tree.bin index 839292829..a185a7cb7 100644 Binary files a/examples/runtime/shaders/dx9/fs_tree.bin and b/examples/runtime/shaders/dx9/fs_tree.bin differ diff --git a/examples/runtime/shaders/gles/fs_bump.bin b/examples/runtime/shaders/gles/fs_bump.bin index b1296e55f..7f6e14e1c 100644 Binary files a/examples/runtime/shaders/gles/fs_bump.bin and b/examples/runtime/shaders/gles/fs_bump.bin differ diff --git a/examples/runtime/shaders/gles/fs_tree.bin b/examples/runtime/shaders/gles/fs_tree.bin index edcc966ca..fd3cc1af1 100644 Binary files a/examples/runtime/shaders/gles/fs_tree.bin and b/examples/runtime/shaders/gles/fs_tree.bin differ diff --git a/examples/runtime/shaders/glsl/fs_bump.bin b/examples/runtime/shaders/glsl/fs_bump.bin index d7bc7adba..6bce30eca 100644 Binary files a/examples/runtime/shaders/glsl/fs_bump.bin and b/examples/runtime/shaders/glsl/fs_bump.bin differ diff --git a/examples/runtime/shaders/glsl/fs_tree.bin b/examples/runtime/shaders/glsl/fs_tree.bin index e9c759701..ed502b2da 100644 Binary files a/examples/runtime/shaders/glsl/fs_tree.bin and b/examples/runtime/shaders/glsl/fs_tree.bin differ