Add outline/transparency to multiple meshes as a whole
Posted: Sun Feb 03, 2019 10:16 pm
I recently got Amplify Shader Editor as I'm not that familiar with shaders and want to experiment with a node-based framework. I am trying to add tint, transparency (or more advanced effects such as dissolving, etc.) to a model.
The problem is I want to treat the model as a whole, even if it has some weapon equipped. Here is a preview of what I tried:
Opaque is fine, tinted is almost ok (this is just an emission added), but transparent is obviously not what it needs to be.
Now I do understand that the model is not a single mesh. There are things behind the foremost faces which are visible. Maybe if it was a single mesh that would not be a problem.
But let's say he can equip a weapon in front of his chest. Obviously the weapon can't be a part of the mesh of the player (given that weapons can be switched). Tint, transparency or dissolve need to treat the player and the equipped weapon as a whole.
Let's see a Brawl Stars screenshot:
The player's skin AND his weapon have transparency and outline. But both treat the two separate objects as a whole.
I did some research and saw that this could be achieved with additional render textures and/or manipulate the resulting 2D image. While this approach is clear to me, it doesn't suit my use case and it sounds too complex so I suggest there is an easier way, just with shaders.
My knowledge in shaders is limited but my wild guess would be writing the model and the weapon in a depth buffer and then do a secondary render pass over that buffer and treat the resulting pixels, but I am not sure.
Please assist with any suggestions. Thank you!
P.S. Also the player and the weapon may be animated, i.e. SkinnedMeshRenderers
The problem is I want to treat the model as a whole, even if it has some weapon equipped. Here is a preview of what I tried:
Opaque is fine, tinted is almost ok (this is just an emission added), but transparent is obviously not what it needs to be.
Now I do understand that the model is not a single mesh. There are things behind the foremost faces which are visible. Maybe if it was a single mesh that would not be a problem.
But let's say he can equip a weapon in front of his chest. Obviously the weapon can't be a part of the mesh of the player (given that weapons can be switched). Tint, transparency or dissolve need to treat the player and the equipped weapon as a whole.
Let's see a Brawl Stars screenshot:
The player's skin AND his weapon have transparency and outline. But both treat the two separate objects as a whole.
I did some research and saw that this could be achieved with additional render textures and/or manipulate the resulting 2D image. While this approach is clear to me, it doesn't suit my use case and it sounds too complex so I suggest there is an easier way, just with shaders.
My knowledge in shaders is limited but my wild guess would be writing the model and the weapon in a depth buffer and then do a secondary render pass over that buffer and treat the resulting pixels, but I am not sure.
Please assist with any suggestions. Thank you!
P.S. Also the player and the weapon may be animated, i.e. SkinnedMeshRenderers