Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion on use of textureQueryLod #1

Open
D-K-E opened this issue Jun 27, 2020 · 0 comments
Open

Suggestion on use of textureQueryLod #1

D-K-E opened this issue Jun 27, 2020 · 0 comments

Comments

@D-K-E
Copy link

D-K-E commented Jun 27, 2020

Hi felicitations on your thesis.
Small suggestion for further improvement:
you might want to change the below

vec4 vol_sample(float diameter, vec3 location) {
	float vlevel = log2(diameter * vox_size); // Current mipmap level
	vlevel = min( MIPMAP_HARDCAP, vlevel );

	vec3 pos_texturespace = (location + vec3(1.0f)) * 0.5f; // [-1,1] Coordinates to [0,1]

	return textureLod(tex3D, pos_texturespace, vlevel);	// Sample
}

to this

vec4 getVoxelSample(vec3 hit_point) {
  vec3 hit_point_tex_space = (hit_point + 1.0) * 0.5; // [-1,1]->[0,1]

  float mipmapLevel = textureQueryLod(voxelMap, hit_point_tex_space).x;
  return textureLod(voxelMap, hit_point_tex_space, mipmapLevel);
}

This would get rid of MIPMAP... preprocessor variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant