Skip to Content
GPU Pro 6
book

GPU Pro 6

by Wolfgang Engel
July 2015
Intermediate to advanced
586 pages
17h 21m
English
A K Peters/CRC Press
Content preview from GPU Pro 6
1. Practical Screen-Space Soft Shadows 307
//input : float value in range [0 . . . 1 ]
uint float_to_r8 ( float val )
{
const uint bits =8;
uint precision_scaler = uint( pow( uint (2) , bits )) uint(1) ;
return uint( floor ( precision_scaler val ));
}
uint rgba8_to_uint ( vec4 val )
{
uint res = float_to_r8 ( val . x ) << 24;
res |= float_to_r8 ( val . y ) << 16;
res |= float_to_r8 ( val . z ) << 8;
res |= float_to_r8 ( val . w ) << 0;
return res ;
}
Listing 1.2. A function to pack an RGBA8 value into an R32F float.
float threshold =0.25;
float filter_size =
// account for li g h t si z e ( af fe ct s penumbra s i z e )
light_size
//anisotropic term, varies w
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 5

GPU Pro 5

Wolfgang Engel
GPU Pro 7

GPU Pro 7

Wolfgang Engel
GPU PRO 3

GPU PRO 3

Wolfgang Engel

Publisher Resources

ISBN: 9781482264623