Vulkan icon indicating copy to clipboard operation
Vulkan copied to clipboard

ndc coord -1 to 1 in cascaded shadowmap

Open coldgemini opened this issue 4 years ago • 2 comments

glm::vec3 frustumCorners[8] = {
			glm::vec3(-1.0f,  1.0f, -1.0f),
			glm::vec3( 1.0f,  1.0f, -1.0f),
			glm::vec3( 1.0f, -1.0f, -1.0f),
			glm::vec3(-1.0f, -1.0f, -1.0f),
			glm::vec3(-1.0f,  1.0f,  1.0f),
			glm::vec3( 1.0f,  1.0f,  1.0f),
			glm::vec3( 1.0f, -1.0f,  1.0f),
			glm::vec3(-1.0f, -1.0f,  1.0f),
		};

I observe you were using ndc z coord range of [-1, 1], while the vulkan ndc is really from [0,1]. using [-1,1] translates to a frustum centered at the camera and from the back of the camera. How is this issue solved by the rest of your code?

Thanks.

coldgemini avatar Nov 26 '20 03:11 coldgemini

The base class defines GLM_FORCE_DEPTH_ZERO_TO_ONE.

SaschaWillems avatar Nov 27 '20 16:11 SaschaWillems

isn't this exactly why ndc coord range should be [0,1] ? since forward conversion is world coord to ndc [0,1] then backward conversion should be ndc[0,1] to world coord?

coldgemini avatar Nov 30 '20 05:11 coldgemini