Vulkan Skybox not filling entire faces

Here’s the situation.
It’s actually quite simple (not for me).
I have six different images that together compose a skybox.
I’ve successfully copied each of the six images to a six layer Image.
But the height of the skybox images are different from each other.
So when I render the skybox, there are black areas within them.
Also when creating the six image layer image I already tell vulkan the width and height of each layer( they are equal for all layers) . I thought that a sampler would clamp the image to edge. But that’s not really happening. How do I make sky box face image fill the entire six layered image I created?

Since the six layerd image is bigger than the images extent, How do I clamp the skybox images to the six layered images extent.

If I understand the situation correctly, you would just make them same size with vkCmdBlitImage.

1 Like

thank you it seems to be the case.

hmm.
Could please check my implementation that uses VkCmdBlitImage.
apparently the images are not being copied.

for (int i = 0; i < 6; i++) {

	tcreatetextureImage(imagesFile[i], &images[i].image, &images[i].imageMemory, format);
	images[i].imageView = tcreateImageView(images[i].image, format, VK_IMAGE_ASPECT_COLOR_BIT);

	//createHostVisibleImage(imagesFile[i], &buffers[i].buffer, &buffers[i].bufferMemory);

	transitionImageLayout(images[i].image,
		format,
		VK_IMAGE_LAYOUT_UNDEFINED,
		VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
		1,
		0);
	VkImageBlit blit = {};


	int width, height;
	getImageExtent(imagesFile[i], &width, &height);


	blit.srcOffsets[0].x = 0;
	blit.srcOffsets[1].x = width;

	blit.srcOffsets[0].y = 0;
	blit.srcOffsets[1].y = height;

	blit.srcOffsets[0].z = 0 ;
	blit.srcOffsets[1].z = 1;



	blit.dstOffsets[0].x = 0;
	blit.dstOffsets[1].x = 1600;

	blit.dstOffsets[0].y = 0;
	blit.dstOffsets[1].y = 1600;

	blit.dstOffsets[0].z = 0;
	blit.dstOffsets[1].z = 1;


	blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
	blit.dstSubresource.baseArrayLayer = i;
	blit.dstSubresource.mipLevel = 0;
	blit.dstSubresource.layerCount = 1;

	blit.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
	blit.srcSubresource.baseArrayLayer = 0;
	blit.srcSubresource.mipLevel = 0;
	blit.srcSubresource.layerCount = 1;






	

	transitionImageLayout(cubeMap->image,
		format,
		VK_IMAGE_LAYOUT_UNDEFINED,
		VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
		1,
		i);

	VkFilter filter = VK_FILTER_NEAREST;


	VkCommandBuffer cmd = beginSingleTimeCommandBuffer();
	
	vkCmdBlitImage(cmd,
		images[i].image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
		cubeMap->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
		1, &blit, filter);


		endCommandBuffer(cmd);
}

Possibly lacks synchronization.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.