output normal NormalOut = N)
{
/* Abuse texture call with special @bevel token. */
- NormalOut = (normal)(color)texture("@bevel", samples, Radius);
+ vector bevel_N = (normal)(color)texture("@bevel", samples, Radius);
/* Preserve input normal. */
- NormalOut = normalize(N + (NormalOut - NormalIn));
+ NormalOut = normalize(NormalIn + (bevel_N - N));
}
if(stack_valid(normal_offset)) {
/* Preserve input normal. */
float3 ref_N = stack_load_float3(stack, normal_offset);
- bevel_N = normalize(sd->N + (bevel_N - ref_N));
+ bevel_N = normalize(ref_N + (bevel_N - sd->N));;
}
stack_store_float3(stack, out_offset, bevel_N);