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

Issue with sampling input radial or equirectangular map #11

Open
remcohuijser opened this issue Nov 8, 2018 · 4 comments
Open

Issue with sampling input radial or equirectangular map #11

remcohuijser opened this issue Nov 8, 2018 · 4 comments

Comments

@remcohuijser
Copy link

Very nice tool Matt!

I just wanted to point out something I found. Not sure if you find this valuable.

When using a radial or equirectangular map the result did not look right as can be seen below:

image

After replacing the function texSpherical in IblEnvironmentSphereSpherical.fx and IblSinglePassSphericalEnvironment.fx with "proper" sampling code the results looked much better :)

float4 texSpherical(float3 dir, float lod)
{
	float3 normalizedDir = normalize(dir);

	float lon = atan2(-normalizedDir.z, normalizedDir.x);
	float lat = acos(normalizedDir.y);
	
	float2 radians = float2(1.0 / (3.141592 * 2.0), 1.0 / 3.141592);
	
	float2 uv = float2(lon, lat) * radians;
	
	return environmentMap.SampleLevel(anisotropicSampler, uv, lod);
}

image

@remcohuijser remcohuijser changed the title Issue with sampling input spherical maps Issue with sampling input radial or equirectangular map Nov 8, 2018
@derkreature
Copy link
Owner

Can you make a pull request. Looks good!

@remcohuijser
Copy link
Author

I am very short on time right now but will try to get something done soon :)

@derkreature
Copy link
Owner

No problem, I’ll test and modify.

@derkreature
Copy link
Owner

I am getting to this.

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

2 participants