9 part texture
Script for stretching texture with saving size and quality of borders.
It’s usefull for frames and shadows.
Theory
Imagine, you need to create nice looking shadows for plane. You are just create a texture faking shadows effect. If you know size in advance — all is ok. But what to do if you are creating some customizable effect? You can’t know what size the rectangle will have. 9 part texture rescue you!
1. Lets start from painting square texture of shadow effect.
2. Understand how to slice it.
Center is too big. Actually it can be 1x1 pixel. I leave this non optimal version for clarity.
3. How it sctreched?
Simple one rectangle take this result:
If we are applied “9 part” concept, we can get this:
We just change size only three parts. It’s central row.
This way you can create glow, shadow and frame effects, etc:
Practice
I wrote the script for provide solution “9 part texture” in vizrt.How to use it:
- Drop script to some container
- Click “Create base planes” for creating nine sub-containers.
- Drop texture to all nine sub-conaitners.
- Set “Source of size”, position…
- Set “Border” parameter correspondently to texture style:
There is issue when central row or column is too small. This is texture filtering. The issue can be solved by setup maximum Anisotropic Filter on all nine textures:
Try it yourself
I’ve prepared some textures for you ;)
I use white color for easy changing color in vizrt. Just add a material ;) If you want black color on a shadows, add black material on the master container:
Glow/shadow
Frames
Download 9partTextureExample.via and try it yourself.
Source code
Show source code (latest version)
loading script from bitbucket...