This is a set of shaders for Unity3D. It maps worldspace position of a gameObject and draws to a
RenderTexture in relation to world bounds and remaps it back onto the world as a mask, allowing for various shader effects.
- Black and White to RGB texture reveal shader
- Transparent to Opaque RGB Texture reveal shader
- Displacement Tesselation shader
- Auto and Manual world bounds lookup
- Fading over time
- Adaptive RenderTexture aspect ratio
- Custom inpspector
The RenderTexture mask generation and re-projection happens separately from the surface shaders, so any combination of them is possible and adding new shaders is trivial without affecting the setup.
UnityPackage from Releases to get a clean import.
All code licensed under MIT License. Refer to License.md for full terms. Pull requests welcome.
Effects rely on object materials having a shader property
"_Splat" to assign the
RenderTexture and offset parameters. Objects without a compatible shader will be skipped.
.../A2RGB shaders on paintable objects.
Painter.cs to the scene.
- Auto will iterate through all the world objects to calculate bounds. Use this for quick preview.
- Manual will enable a box collider to set bounds manually. Use this for builds and complex scenes. BoxCollider will be turned off on start to disable physics.
- 32x - 2048x, more resolutions can be added in the
Use Relative enables non-power of two resolution for the
RenderTexture, based on world bounds to avoid overly stretched mask pixels. This will be calculated automatically, keeping the longest edge to selected resolution.
Fade Over Time allows for non-permanent mask drawing - stroke fades from oldest pixel.
Fade Speed will be available if selected.
Add a parent
gameObject containing all the paintable objects to
RevealRTX is plugged into the Render Texture Shader.
Brush is a gameObject that will ‘draw’ the mask onto
RenderTexture. Only XZ coordinates are considered.
Brush Size will change the size of the area drawn onto the
Brush Strength determines stroke opacity.
Splat Map Preview will display current
RenderTexture resolution and texture in play mode.