ShotgunNinja Posted May 14, 2016 Share Posted May 14, 2016 (edited) @DangerouslyDave This is an answer about your normal-map decals problem. As it became a big wall of text, I've hidden it. Spoiler For 'normal-map decals', you will need a deferred shading pipeline. And a full blown one too, one that store the tangent-space normals in the G-buffer (they usually store the screen-space ones). The reason is you need to blend the 'background' and 'decal' normals in tangent-space. This is also the reason you don't see normal-map decals in most games. You could get around that limitation by passing the object world matrix to the decal shader, maybe, that could work if the decal instance is meant to be applied only on a mesh instance. But that will lead to glitches if another mesh is caught in the projection area of the decal instance, so to speak. To solve that kind of things you will need an 'object-id' in the G-buffer. The problems don't ends here, unfortunately. When the layout of a G-buffer is designed, one of the major constrain is bandwidth both in reading and writing the attachments. Normals are usually stored as 2 components in the map, as you can recover the third if you store them in tangent space. In the gbuffer instead, they get 'encoded' in an innumerable number of creative ways: spherical mappings, hemi-octagonal, etc. They may well be impossible to blend using the hardware blending equation, as you are trying to blend non-linear encodings possibly. Not to mention the shader start to become quite complex, overcoming the speed gains you had by not having a normal map in the first place. Another problem: a G-buffer layer has usually 4 components, and you are going to apply the decals using blending. Blending assume the 4th component store 'alpha', and that is used in the blending equation. So you will have problems depending on what is actually stored in the 'w' component of the layer that store the normals. Disclaimer: I know nothing about what kind of G-buffer unity is using, or even if it has a deferred pipeline, or if it does have it but KSP is using a forward renderer. Edited May 14, 2016 by ShotgunNinja Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.