Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/shaders/common_hair_lib.glsl
| /** | /** | ||||
| * Library to create hairs dynamically from control points. | * Library to create hairs dynamically from control points. | ||||
| * This is less bandwidth intensive than fetching the vertex attributes | * This is less bandwidth intensive than fetching the vertex attributes | ||||
| * but does more ALU work per vertex. This also reduces the amount | * but does more ALU work per vertex. This also reduces the amount | ||||
| * of data the CPU has to precompute and transfer for each update. | * of data the CPU has to precompute and transfer for each update. | ||||
| */ | */ | ||||
| /* TODO(fclem): Keep documentation but remove the uniform declaration. */ | |||||
| #ifndef USE_GPU_SHADER_CREATE_INFO | |||||
| /** | /** | ||||
| * hairStrandsRes: Number of points per hair strand. | * hairStrandsRes: Number of points per hair strand. | ||||
| * 2 - no subdivision | * 2 - no subdivision | ||||
| * 3+ - 1 or more interpolated points per hair. | * 3+ - 1 or more interpolated points per hair. | ||||
| */ | */ | ||||
| uniform int hairStrandsRes = 8; | uniform int hairStrandsRes = 8; | ||||
| /** | /** | ||||
| Show All 12 Lines | |||||
| uniform vec4 hairDupliMatrix[4]; | uniform vec4 hairDupliMatrix[4]; | ||||
| /* Strand batch offset when used in compute shaders. */ | /* Strand batch offset when used in compute shaders. */ | ||||
| uniform int hairStrandOffset = 0; | uniform int hairStrandOffset = 0; | ||||
| /* -- Per control points -- */ | /* -- Per control points -- */ | ||||
| uniform samplerBuffer hairPointBuffer; /* RGBA32F */ | uniform samplerBuffer hairPointBuffer; /* RGBA32F */ | ||||
| #define point_position xyz | |||||
| #define point_time w /* Position along the hair length */ | |||||
| /* -- Per strands data -- */ | /* -- Per strands data -- */ | ||||
| uniform usamplerBuffer hairStrandBuffer; /* R32UI */ | uniform usamplerBuffer hairStrandBuffer; /* R32UI */ | ||||
| uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */ | uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */ | ||||
| /* Not used, use one buffer per uv layer */ | /* Not used, use one buffer per uv layer */ | ||||
| // uniform samplerBuffer hairUVBuffer; /* RG32F */ | // uniform samplerBuffer hairUVBuffer; /* RG32F */ | ||||
| // uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */ | // uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */ | ||||
| #endif | |||||
| #define point_position xyz | |||||
| #define point_time w /* Position along the hair length */ | |||||
| /* -- Subdivision stage -- */ | /* -- Subdivision stage -- */ | ||||
| /** | /** | ||||
| * We use a transform feedback or compute shader to preprocess the strands and add more subdivision | * We use a transform feedback or compute shader to preprocess the strands and add more subdivision | ||||
| * to it. For the moment these are simple smooth interpolation but one could hope to see the full | * to it. For the moment these are simple smooth interpolation but one could hope to see the full | ||||
| * children particle modifiers being evaluated at this stage. | * children particle modifiers being evaluated at this stage. | ||||
| * | * | ||||
| * If no more subdivision is needed, we can skip this step. | * If no more subdivision is needed, we can skip this step. | ||||
| ▲ Show 20 Lines • Show All 252 Lines • Show Last 20 Lines | |||||