bonjorno7 / SourceOps

A more convenient alternative to Blender Source Tools.
GNU General Public License v3.0
138 stars 14 forks source link

Paint alpha from texture #54

Open 9yz opened 3 years ago

9yz commented 3 years ago

Hey, here's a suggestion. The very old DispGen has a feature where you can give it an alpha mask and it paints blend alpha onto each vert. Since DispGen crashes when you use this, a sops version would be great.

For example, say you make some terrain in WorldMachine and export a heightmap and a mask, where black is grass and white is rock. You feed these in, and the result is a mountain with a rock texture on the sides and grass on the top and bottom.

An even cooler version would support splatmaps and 4way blends, where you have an RGBA texture (the splatmap), where the value of each channel represents one texture in a 4way blend. You feed this in and get a mountain with dirt, rock, grass, and snow all blending together.

Give me a shout on discord at 9yz#5386 if you have any questions.

bonjorno7 commented 3 years ago

I thought you wanted vertex painting but by the looks of it you want automatic image -> vertex color conversion. Not a bad idea, and could be used to overcome the fact that multires doesn't support vertex painting. I could probably just grab the values from the image at a given vert's UV coords (maybe average a block of pixels, will have to see if it's necessary).

9yz commented 3 years ago

Yeah, that's what I'm thinking. From my very inexperienced view, it doesn't seem too complicated, as both the image and the vertex alpha are both 0-255, so you can just plonk it in.

bonjorno7 commented 3 years ago

bpy.ops.just_plonk(it)

McGravel commented 2 years ago

Had a quick bit of web searching, and it looks like there might be a Blender modifier or something like that to potentially do this. Not sure, but I might look into it on a branch sometime.