Hey to all,
I was wondering if there is a way to create a shader (real-time) and bake it down to your UV's in a package like Max?
If yes, how viable is it, and how would I be able to avoid baking certain things like say the Lambert term or Specular? Or is that dependent on the shader itself?
Cheers!
Replies
And yes shader creates typically just a single color, so you would have to modify the fragment/pixel shader to output whatever you want.
I'm not sure how you would render the view to a image though.
It also might need to be 1:1 ratio, or maybe not... Anyways, that's easily done by multiplying the output position Y by (screen width / screen height)
Cheers CB!
EDIT: Cheers Drew for the snippet
to grab the viewport, and then save that out to a bitmap (of specified size). If you're doing it this way, then you don't want to alter the aspect ratio to be square (since you're actually altering the aspect ratio of the viewport).
One caveat of this method is there's no straightforward way to get any padding around islands and alpha'd portions, so you'd need to do that in Photoshop. One of the things I did at work for when any sort of alpha was needed was basically have a bit where the script would turn the viewport background black, and replace the shader with a pure white unlit material, and write that into the alpha channel before saving it out.
Though I suppose you could also use the built in RTT.
Cheers!