Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 16874

Raytracing in DX12/DXR - ray generated in single direction

$
0
0

Hey,

I have problem with DXR HLSL code. I am trying to create simplest possible world-space shader, using ray-tracing DirectX12/DXR. I tried to achieve (as you can see in closest hit shader) flat shading of model. However, here is the result:

https://puu.sh/GekqF/7f4eb92767.png

Which indicates, that every pixel is hitting geometry, which shouldn't be true.

https://puu.sh/Gekrq/ea35ae21a4.png

As geometry I am using simple sphere presented above.

struct Vertex
{
	float3 position;
	float3 normal;
	float3 tangent;
	float3 binormal;
	float2 uv;
};

struct RayPayload
{
	float4 color;
};

struct Attributes 
{
	float2 bary;
};

struct SceneConstantBuffer
{
	matrix projectionToWorld;
	float4 cameraPosition;
	float4 lightPosition;
	float4 lightAmbientColor;
	float4 lightDiffuseColor;
};

ConstantBuffer<SceneConstantBuffer> g_sceneCB : register(b0 …

Viewing all articles
Browse latest Browse all 16874

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>