Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint instance = 0;
- float4 result = TraceRayCompute(Rays[id], instance);
- float3 bary = float3(result.x, result.y, 1.0f - result.x - result.y);
- GeometryNode geom = Geometries[instance];
- MemoryNode vbo = VertexNodes[geom.VertexBufferNode];
- MemoryNode ibo = IndexNodes[geom.IndexBufferNode];
- uint indices[3] = { IndexData[ibo.Offset / 4 + asuint(result.w) + 0], IndexData[ibo.Offset / 4 + asuint(result.w) + 1], IndexData[ibo.Offset / 4 + asuint(result.w) + 2] };
- float2 tc[3] =
- {
- VertexData[(vbo.Offset / 64 + indices[0]) * 4 + 3].xy,
- VertexData[(vbo.Offset / 64 + indices[1]) * 4 + 3].xy,
- VertexData[(vbo.Offset / 64 + indices[2]) * 4 + 3].xy
- };
- float2 texCoord = tc[0] * bary.x + tc[1] * bary.y + tc[2] * bary.z;
- texCoord.x = frac(texCoord.x);
- texCoord.y = frac(texCoord.y);
- Output[DTid.xy] = float4(bary, 1.0f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement