Orthographic camera has some artifacts
oden3d opened this issue · comments
Hey Den, this is caused by some issues with the view direction. The line below helps to influence the strength of the depth buffer, by increasing the amount of depth required on sharp edges (see section 3. Resolving surface artifacts of the tutorial).
float NdotV = 1 - dot(viewNormal, -i.viewSpaceDir);
Unfortunately, in ortho mode, as the projection is parallel, viewSpaceDir does not correctly work. This can be resolved by replacing the line with
float NdotV = 1 - dot(viewNormal, float3(0,0,1));
Where the view direction to each vertex is directly forward.
There's still some missing edges, such as along the teapot's rim, but those could be fixed by tweaking the parameters I'd assume. The above is using the default settings, except Depth Threshold is set to 0.01.
Thank you for help!
Tried your solution but seems did not really work well for me. Still have missing edges on stairs and other.
Set Depth Threshold to 0.01 helps for better result.
Also found but did not tried yet other solution also based on normal map.
https://gamedev.stackexchange.com/questions/68401/how-can-i-draw-outlines-around-3d-models
Are you making sure to run the scene in Play mode? This ensures that the normals buffer is rendered out and is accessible.
Yes, run in Play mode.