Changes to the vertex function (different than the suggested changes)
Closed this issue · 1 comments
I'm using Unity 2021.3.20f1, the Built-In Render Pipeline, and standard shader files and absolutely could not get the baker to work properly at first using the directions as provided. It would render a very small portion of the center of the model until I changed the section of the vertex function as follows:
// in vertex function :
#ifdef _BAKESHADER
float2 remappedUV = v.uv.xy * 2 - 1;
float3 bakeShaderPos = float3(remappedUV.x, remappedUV.y * _ProjectionParams.x, 0);
output.vertex = float4( bakeShaderPos, 1 );
#else
output.vertex = UnityObjectToClipPos(v.position);
#endif
return output;
The biggest difference being that I do not pass the bakeShaderPos value through UnityObjectToClipPos when the _BAKESHADER keyword is enabled.
I'm not sure that this is completely correct in every respect, but it now works for every model that I've tried it with for my particular shaders, and I'm quite happy with the results.
I hope this is helpful for someone!
Oops yeah, the readme code was wrong - have fixed it, thanks!