Files
XCEngine/Res/Shader/volume.hlsl

50 lines
1.1 KiB
HLSL
Raw Normal View History

#define PNANOVDB_HLSL
#define PNANOVDB_ADDRESS_64
#include "PNanoVDB.hlsl"
cbuffer CB0 : register(b1)
{
float4x4 _ViewProjection;
float3 _CameraPos;
float _DensityScale;
};
StructuredBuffer<uint> buf : register(t1);
struct VSInput
{
float3 position : POSITION;
};
struct PSInput
{
float4 position : SV_POSITION;
float3 worldPos : TEXCOORD0;
};
PSInput MainVS(VSInput input)
{
PSInput output;
output.position = mul(_ViewProjection, float4(input.position, 1.0));
output.worldPos = input.position;
return output;
}
float4 MainPS(PSInput input) : SV_TARGET
{
pnanovdb_grid_handle_t grid;
grid.address.byte_offset = 0;
float3 worldBboxMin = float3(
(float)pnanovdb_grid_get_world_bbox(buf, grid, 0),
(float)pnanovdb_grid_get_world_bbox(buf, grid, 1),
(float)pnanovdb_grid_get_world_bbox(buf, grid, 2)
);
float3 worldBboxMax = float3(
(float)pnanovdb_grid_get_world_bbox(buf, grid, 3),
(float)pnanovdb_grid_get_world_bbox(buf, grid, 4),
(float)pnanovdb_grid_get_world_bbox(buf, grid, 5)
);
return float4(0.0, 1.0, 0.0, 1.0);
}