Forums WoW Modding Support Archives WoWModding Support Archives [DiscordArchive] by "dynamic descriptor indexing", do you mean having like one big descriptor set with array of all t

[DiscordArchive] by "dynamic descriptor indexing", do you mean having like one big descriptor set with array of all t

[DiscordArchive] by "dynamic descriptor indexing", do you mean having like one big descriptor set with array of all t

Pages (3): 1 2 3 Next
rektbyfaith
Administrator
0
07-06-2023, 11:41 AM
#1
Archived author: bandysc • Posted: 2023-07-06T11:41:07.284000+00:00
Original source

by "dynamic descriptor indexing", do you mean having like one big descriptor set with array of all textures and passing an index to each draw i.e. via push constant?
rektbyfaith
07-06-2023, 11:41 AM #1

Archived author: bandysc • Posted: 2023-07-06T11:41:07.284000+00:00
Original source

by "dynamic descriptor indexing", do you mean having like one big descriptor set with array of all textures and passing an index to each draw i.e. via push constant?

rektbyfaith
Administrator
0
07-06-2023, 11:42 AM
#2
Archived author: Deamon • Posted: 2023-07-06T11:42:51.801000+00:00
Original source

First part is right, but second part is not. The index to textures through push constant would not be very efficient, cause this way you can't do indirect rendering.
The index into texture array can be taken from UBO or SSBO
rektbyfaith
07-06-2023, 11:42 AM #2

Archived author: Deamon • Posted: 2023-07-06T11:42:51.801000+00:00
Original source

First part is right, but second part is not. The index to textures through push constant would not be very efficient, cause this way you can't do indirect rendering.
The index into texture array can be taken from UBO or SSBO

rektbyfaith
Administrator
0
07-06-2023, 11:44 AM
#3
Archived author: Deamon • Posted: 2023-07-06T11:44:01.971000+00:00
Original source

indirect Buffer -> instanceIndex -> Instance UBO -> index into textures array in descriptor set
rektbyfaith
07-06-2023, 11:44 AM #3

Archived author: Deamon • Posted: 2023-07-06T11:44:01.971000+00:00
Original source

indirect Buffer -> instanceIndex -> Instance UBO -> index into textures array in descriptor set

rektbyfaith
Administrator
0
07-06-2023, 11:44 AM
#4
Archived author: Deamon • Posted: 2023-07-06T11:44:08.757000+00:00
Original source

at least that's how I imagine it
rektbyfaith
07-06-2023, 11:44 AM #4

Archived author: Deamon • Posted: 2023-07-06T11:44:08.757000+00:00
Original source

at least that's how I imagine it

rektbyfaith
Administrator
0
07-06-2023, 11:46 AM
#5
Archived author: Nix • Posted: 2023-07-06T11:46:30.840000+00:00
Original source

Yeah, you definitely don't pass it through push constant
rektbyfaith
07-06-2023, 11:46 AM #5

Archived author: Nix • Posted: 2023-07-06T11:46:30.840000+00:00
Original source

Yeah, you definitely don't pass it through push constant

rektbyfaith
Administrator
0
07-06-2023, 11:47 AM
#6
Archived author: bandysc • Posted: 2023-07-06T11:47:44.981000+00:00
Original source

indirect rendering is yet another optimization, right, like you can fill the buffer with vertices/indices ranges, instance index as you say, but if I understand it correctly, this optimization only makes sense if you have like at least few meshes combined in one vertex/index buffer or whatever it is called in vulkan. I mean, there is no point using indirect rendering if one is rendering only one object anyway, right?
rektbyfaith
07-06-2023, 11:47 AM #6

Archived author: bandysc • Posted: 2023-07-06T11:47:44.981000+00:00
Original source

indirect rendering is yet another optimization, right, like you can fill the buffer with vertices/indices ranges, instance index as you say, but if I understand it correctly, this optimization only makes sense if you have like at least few meshes combined in one vertex/index buffer or whatever it is called in vulkan. I mean, there is no point using indirect rendering if one is rendering only one object anyway, right?

rektbyfaith
Administrator
0
07-06-2023, 11:48 AM
#7
Archived author: Nix • Posted: 2023-07-06T11:48:41.440000+00:00
Original source

```cpp
float4 ShadeTerrain(const uint2 pixelPos, const float2 screenUV, const VisibilityBuffer vBuffer)
{
InstanceData cellInstance = _instanceDatas[vBuffer.drawID];
uint globalCellID = cellInstance.globalCellID;

// Terrain code
uint globalVertexOffset = globalCellID * NUM_VERTICES_PER_CELL;
uint3 localVertexIDs = GetLocalTerrainVertexIDs(vBuffer.triangleID);

const uint cellID = cellInstance.packedChunkCellID & 0xFFFF;
const uint chunkID = cellInstance.packedChunkCellID >> 16;

// Get CellData and ChunkData
const CellData cellData = LoadCellData(globalCellID);

const uint globalChunkID = globalCellID / NUM_CELLS_PER_CHUNK;
const ChunkData chunkData = _chunkData[globalChunkID];

// We have 4 uints per chunk for our diffuseIDs, this gives us a size and alignment of 16 bytes which is exactly what GPUs want
// However, we need a fifth uint for alphaID, so we decided to pack it into the LAST diffuseID, which gets split into two uint16s
// This is what it looks like
// [1111] diffuseIDs.x
// [2222] diffuseIDs.y
// [3333] diffuseIDs.z
// [AA44] diffuseIDs.w Alpha is read from the most significant bits, the fourth diffuseID read from the least
uint diffuse0ID = cellData.diffuseIDs.x;
uint diffuse1ID = cellData.diffuseIDs.y;
uint diffuse2ID = cellData.diffuseIDs.z;
uint diffuse3ID = cellData.diffuseIDs.w;
uint alphaID = chunkData.alphaID;

float3 alpha = _terrainAlphaTextures[NonUniformResourceIndex(alphaID)].SampleGrad(_alphaSampler, pixelAlphaUV, pixelUV.ddx, pixelUV.ddy).rgb;
float minusAlphaBlendSum = (1.0 - clamp(alpha.x + alpha.y + alpha.z, 0.0, 1.0));
float4 weightsVector = float4(minusAlphaBlendSum, alpha);

float4 color = float4(0, 0, 0, 1);

float3 diffuse0 = _terrainColorTextures[NonUniformResourceIndex(diffuse0ID)].SampleGrad(_sampler, pixelUV.value, pixelUV.ddx, pixelUV.ddy).xyz * weightsVector.x;
color.rgb += diffuse0;
}
```
rektbyfaith
07-06-2023, 11:48 AM #7

Archived author: Nix • Posted: 2023-07-06T11:48:41.440000+00:00
Original source

```cpp
float4 ShadeTerrain(const uint2 pixelPos, const float2 screenUV, const VisibilityBuffer vBuffer)
{
InstanceData cellInstance = _instanceDatas[vBuffer.drawID];
uint globalCellID = cellInstance.globalCellID;

// Terrain code
uint globalVertexOffset = globalCellID * NUM_VERTICES_PER_CELL;
uint3 localVertexIDs = GetLocalTerrainVertexIDs(vBuffer.triangleID);

const uint cellID = cellInstance.packedChunkCellID & 0xFFFF;
const uint chunkID = cellInstance.packedChunkCellID >> 16;

// Get CellData and ChunkData
const CellData cellData = LoadCellData(globalCellID);

const uint globalChunkID = globalCellID / NUM_CELLS_PER_CHUNK;
const ChunkData chunkData = _chunkData[globalChunkID];

// We have 4 uints per chunk for our diffuseIDs, this gives us a size and alignment of 16 bytes which is exactly what GPUs want
// However, we need a fifth uint for alphaID, so we decided to pack it into the LAST diffuseID, which gets split into two uint16s
// This is what it looks like
// [1111] diffuseIDs.x
// [2222] diffuseIDs.y
// [3333] diffuseIDs.z
// [AA44] diffuseIDs.w Alpha is read from the most significant bits, the fourth diffuseID read from the least
uint diffuse0ID = cellData.diffuseIDs.x;
uint diffuse1ID = cellData.diffuseIDs.y;
uint diffuse2ID = cellData.diffuseIDs.z;
uint diffuse3ID = cellData.diffuseIDs.w;
uint alphaID = chunkData.alphaID;

float3 alpha = _terrainAlphaTextures[NonUniformResourceIndex(alphaID)].SampleGrad(_alphaSampler, pixelAlphaUV, pixelUV.ddx, pixelUV.ddy).rgb;
float minusAlphaBlendSum = (1.0 - clamp(alpha.x + alpha.y + alpha.z, 0.0, 1.0));
float4 weightsVector = float4(minusAlphaBlendSum, alpha);

float4 color = float4(0, 0, 0, 1);

float3 diffuse0 = _terrainColorTextures[NonUniformResourceIndex(diffuse0ID)].SampleGrad(_sampler, pixelUV.value, pixelUV.ddx, pixelUV.ddy).xyz * weightsVector.x;
color.rgb += diffuse0;
}
```

rektbyfaith
Administrator
0
07-06-2023, 11:48 AM
#8
Archived author: Deamon • Posted: 2023-07-06T11:48:48.766000+00:00
Original source

Yes. But I'm trying to render a map here Btw, I already has functinality in place, where all M2 vertexes are combined into one VkBuffer
rektbyfaith
07-06-2023, 11:48 AM #8

Archived author: Deamon • Posted: 2023-07-06T11:48:48.766000+00:00
Original source

Yes. But I'm trying to render a map here Btw, I already has functinality in place, where all M2 vertexes are combined into one VkBuffer

rektbyfaith
Administrator
0
07-06-2023, 11:48 AM
#9
Archived author: Nix • Posted: 2023-07-06T11:48:54.205000+00:00
Original source

This is our ShadeTerrain function, but with a lot of unneeded code for this example removed
rektbyfaith
07-06-2023, 11:48 AM #9

Archived author: Nix • Posted: 2023-07-06T11:48:54.205000+00:00
Original source

This is our ShadeTerrain function, but with a lot of unneeded code for this example removed

rektbyfaith
Administrator
0
07-06-2023, 11:48 AM
#10
Archived author: bandysc • Posted: 2023-07-06T11:48:54.960000+00:00
Original source

ah I see
rektbyfaith
07-06-2023, 11:48 AM #10

Archived author: bandysc • Posted: 2023-07-06T11:48:54.960000+00:00
Original source

ah I see

Pages (3): 1 2 3 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)