Skip to Content
GPU Pro 5
book

GPU Pro 5

by Wolfgang Engel
May 2014
Intermediate to advanced
522 pages
16h 1m
English
A K Peters/CRC Press
Content preview from GPU Pro 5
174 II Lighting and Shading
4.5.3 Ray-Tracing Pass
The implementation in Listing 4.5 is the Hi-Z ray-tracing code in Microsoft HLSL.
The code snippet is heavily commented and should be easy to follow once the
algorithm presented in Section 4.4.3 is clear.
float3 hiZTrace( float3 p , float3 v )
{
const float rootLevel = mipCount 1.0f ; // Convert to 0
// based indexing
float level = HIZ_START_LEVEL ; // HIZ START LEVEL was
// set to 2 in the demo
float iterations =0.0f ;
// Get the cell cross direction and a small offset to enter
// the next cell when doing cell crossing.
float2 crossStep , crossOffset ;
crossStep . x =( v . x >=0 ) ? 1.f : 1.f ;
crossStep ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

GPU Pro 4

GPU Pro 4

Wolfgang Engel
GPU Pro 7

GPU Pro 7

Wolfgang Engel
GPU Pro 6

GPU Pro 6

Wolfgang Engel
GPU PRO 3

GPU PRO 3

Wolfgang Engel

Publisher Resources

ISBN: 9781482208641