I have not been very active here in a while but I had an idea. Basically instead of having textures I could have an svg file that gets rendered to a texture. Like a texture equivalent to sequenced music. This would massively save file size. Here is an example of my thought process:
This is an extremely simple 257 byte svg:
<svg viewBox="-50 -50 100 100" xmlns="http://www.w3.org/2000/svg"> <circle r="50" style="fill:#000000"/> <circle r="40" style="fill:#008000"/> <circle r="30" style="fill:#00ff00"/> <circle r="20" style="fill:#000000"/> <circle r="10" style="fill:#ffffff"/> </svg>
If I pre render this to a 256x256 png I get a 13.3 kb image

That does not seem so bad, but take this 459 byte svg:
<svg viewBox="-50 -50 100 100" xmlns="http://www.w3.org/2000/svg"> <defs> <radialGradient id="grad" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" stop-color="#ff0000" /> <stop offset="20%" stop-color="#ff8000"/> <stop offset="40%" stop-color="#ffff00"/> <stop offset="60%" stop-color="#00ff00"/> <stop offset="80%" stop-color="#0000ff"/> <stop offset="100%" stop-color="#ff00ff"/> </radialGradient> </defs> <circle r="50" style="fill:url(#grad)"/> </svg>
Rendering it to a 256x256 png results in a 32.9 kb image:

If I (the player) want a higher resolution, rendering at 1024x1024 it becomes 267 kb:
f I start with a low resolution texture, like the 13.9 kb 256x256 texture, yes it would have a small file size but it would only be as large as 256x256. If the player wants a higher resolution, too bad. But if I start with the 267 kb 1024x1024 texture It could be scaled down if the player selects a lower resolution to conserve ram, but in the files it would still occupy 267 kb forever. Multiply that with however many textures are in the game and that is a rather large occupation.
My working theory is if I create a texture as an svg and somehow rendered it to a texture during runtime I could save several kb per texture, although the rendered texture would occupy the same amount of ram as a premade texture.
With my svg method I can have both. The file size is extremely small, and it can have whatever arbitrary resolution needed for optimal ram usage depending on player system specifications. This would basically give me the ability to change the resolution of the textures infinitely upwards.
Lets explore a hypothetical real world example:
This is a gas mask filter texture from half life, 32x32 1.68 kb:
![]()
Very small file size, but if the player wants a higher resolution that is not possible.
Here I remade the image in svg, it is 1,181 bytes (I could optimize it more):
<svg viewBox="-50 -50 100 100" xmlns="http://www.w3.org/2000/svg"> <defs> <g id="HOLE"> <circle r="5" style="fill:#000000" transform="translate(-35 0)"/> <circle r="5" style="fill:#000000" transform="translate(35 0)"/> <circle r="5" style="fill:#000000" transform="translate(0 -35)"/> <circle r="5" style="fill:#000000" transform="translate(0 35)"/> </g> <g id="COICLE"> <circle r="50" style="fill:#000000"/> <circle r="45" style="fill:#304020"/> <polyline points="0,-49 0,49" style="stroke:#000000;stroke-width:5"/> <polyline points="-49,0 49,0" style="stroke:#000000;stroke-width:5"/> <polyline points="0,-49 0,49" style="stroke:#000000;stroke-width:5" transform="rotate(45)"/> <polyline points="0,-49 0,49" style="stroke:#000000;stroke-width:5" transform="rotate(-45)"/> <circle r="12.5" style="fill:#000000"/> <circle r="7.5" style="fill:#ffffff"/> <use href="#HOLE" transform="rotate(22.5)"/> <use href="#HOLE" transform="rotate(-22.5)"/> </g> </defs> <rect width="100" height="100" x="-50" y="-50" fill="#808080" /> <polyline points="0,0 -21.875,0" style="stroke:#304020;stroke-width:100" transform="translate(43.75 0)"/> <use href="#COICLE" transform="translate(-15.625 0) scale(0.5 0.75)"/> </svg>
The image is simpler and “flatter” because this was just a quick test. I could spend a much longer time perfecting it with gradients and noise if I wanted to.
Rendered to 32x32 to match the half life texture I get this, 1.03 kb:
![]()
But unlike the half life texture, I can rescale this to a 12.7 kb 256x256 texture:

And I could scale it at any resolution I wanted while the file only occupies 1,183 bytes. Multiply this by every texture in a game and this system would massively reduce file size.
So is there any way I could do this in playcanvas?
