- Home /
Other
Inverting A Texture
I am trying to implement a basic fog of war (i'm getting the 'light' spots by creating a 'vision' mesh around the player/light sources, all of this works fine). Currently i'm capturing this with a camera overlooking the map set to the vision layer which outputs to a texture (This outputs the vision objects as white and everything else as Alpha = 0/Invisible).
However I need the texture to be inverted (so that everything is black except the vision objects, which i want to be alpha = 0/Invisible) so I can directly put it into my DecalProjectorComponent (HDRP component that works similar to the projector).
Any ideas how I would invert the texture? Can the new Shader Graph output textures? if so how (since i can invert it there), if not can I do it with c#? (will it be efficient)
PS: This needs to be a Texture (renderTexture) since the Decal Projector only works with a Decal Shader.
Follow this Question
Related Questions
Using Texture2DArray as RenderTarget and passing data to fragment shader 2 Answers
How to save a RenderTexture as a 1-channel 8-bit grayscale PNG? 0 Answers
Flip a render texture? 2 Answers
Can a Texture2D be created at runtime from a snapshot of a RenderTexture? 3 Answers
Texture2D saves as PNG correctly but doesn't display properly in RawImage 1 Answer