Lua Materials

Hey, I’m looking to make some materials via lua

meharryp posted some code that, if I understand it correctly, takes a screenshot of a 2d cam of the original texture, draws on itl, then makes it into a new texture by saving it to the disk and reloading it as a material

Is this the only way to do it? Is there a better way?

Ideally I’d like to draw arbitrarily over another material, if that makes a difference

I’d appreciate any help here

It all depends on what you want to do.

First of all you might want to take a look at this half-finished (or less) guide that I started writing before abandoning:

It’s important to understand what’s what, and understand what you actually need to do.

You can create a brand new texture or acquire an existing one with

GetRenderTarget, which you can then put into

render.PushRenderTarget to draw into it or modify it.

You can acquire an existing material with

Material or create a brand new one with

CreateMaterial, which you can then modify using the various material functions, most importantly


[editline]23rd July 2017[/editline]

You can open materials with this after you’ve written then to the data folder