             locations.push loc
 
         if (loc = gl.getUniformLocation program, 'unfplanarvec')?
-            if not has_probe++
-                code.push var_probe
-            code.push """if(probe){
+            probe_code.push """
                 v=probe.normal;
-                gl.uniform3f(locations[#{locations.length}], v.x, v.y, v.z);}"""
+                gl.uniform3f(locations[#{locations.length}], v.x, v.y, v.z);"""
             locations.push loc
 
         if (loc = gl.getUniformLocation program, 'unfplanarreflectmat')?
-            if not has_probe++
-                code.push var_probe
-            code.push """if(probe){
+            probe_code.push """
                 gl.uniformMatrix4fv(locations[#{locations.length}], false,
-                probe.planarreflectmat.toJSON());}"""
+                probe.planarreflectmat.toJSON());"""
             locations.push loc
 
         if (loc = gl.getUniformLocation program, 'unf_clipping_plane')?

            locations.push loc

        if (loc = gl.getUniformLocation program, 'unflodfactor')?
            if not has_probe++
                code.push var_probe
            code.push "gl.uniform1f(locations[#{locations.length}],
                probe&&probe.lodfactor);"
            locations.push loc


                gl.uniform4f(locations[#{locations.length}],
                v.x, v.y, v.z, v.w);"
            locations.push loc

        if probe_code.length != 0
            code.push \
                'var probe = ob.probe||scene.background_probe;',
                'if(probe){',
                probe_code...,
                '}'

        # detect presence of any of all the unhandled uniforms in the shader
        @unfs = {}
