 }
 
 //Gabor noise based on Lagae, Lefebvre, Drettakis, Dutre 2011
-  float eval_cell(const vec2 cpos, const ivec2 gpos, const ivec2 dnbr, const gnoise_params params, const gnoise_im_params im_params){
-	float u = seed(bound_grid(gpos+dnbr)); //deterministic seed for nbr cell
+  float eval_cell(const vec2 cpos, const vec2 gpos, const vec2 dnbr, const gnoise_params params, const gnoise_im_params im_params){
+	float u = seed(gpos+dnbr); //deterministic seed for nbr cell
 	int impulses = poisson(u, params.density*(1./PI)); //number of impulses in nbr cell
 	vec4 h = params.sector; //annular sector
 	float a = params.a; //bandwidth
 	float aps = im_params.a_prime_square; //intermediate calculations for filtering
-	float filt_scale = aps*im_params.ainv*im_params.ainv;
-	vec2 fpos = cpos - vec2(dnbr);//fragment position in cell space
+	float filt_scale = im_params.filt_scale; //aps*im_params.ainv*im_params.ainv;
+	vec2 fpos = cpos - dnbr;//fragment position in cell space
 	
 	float acc = 0.;
 	//for impulses

	im_params.filter = sigma_fg * sigma_g_inv;	
	im_params.sigma_f_plus_g_inv = inv2x2(sigma_f + sigma_g);
	im_params.a_prime_square = 2.*PI*sqrt(det2x2(sigma_fg));

	float value = 
		eval_cell(cpos, gpos, ivec2(-1, -1), params, im_params) +
		eval_cell(cpos, gpos, ivec2(-1,  0), params, im_params) +
		eval_cell(cpos, gpos, ivec2(-1,  1), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 0, -1), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 0,  0), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 0,  1), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 1, -1), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 1,  0), params, im_params) +
		eval_cell(cpos, gpos, ivec2( 1,  1), params, im_params);
	
	
	//ad hoc attempt to normalize
	value*=.5*pow(params.density+1., -.5);
	float octexp = pow(2., params.sector.y);
	value*= (1.+params.sector.y)*octexp/(2.*octexp-1.);
	
	return value;
}
 


#define PI 3.1415926535897932384626
#define IMPULSE_CAP 128

struct gnoise_params{ //struct for input params to gabor noise
	float a, density, filterSigma, octaves;
