🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Procedural Texturing in 3D Paint

Published October 06, 2016
Advertisement

This past week or two I've been adding a kind of procedural texturing to my paint app. One thing I'd noticed is that just using the standard brushes gave a rather smooth, non organic blend between layers, and I thought I could do better.

The Finished Result - Alpha and Colours
stipple2_zpsl0fhikgt.png

My plan was to use something akin to perlin noise to modify the alpha to get a blend where instead of just blending out the alpha, there was a gradual decrease in 'full blend' noisy areas. So I could have a decrease in density, rather than a decrease in intensity, at joins.

As I wanted the noise to look good in 3d, rather than use perlin noise, I used an equivalent open simplex 3d noise. This wasn't super difficult to get working and made the blends look much better. For variation I also wanted another type of noise, so after doing some reading I wrote a quick 3d worley noise implementation.

Procedural Alpha Only
stipple_alpha_1_zpsft1yvlew.png

Next, as I'd already done 'the hard stuff', I wondered what the results would be like if I went the whole hog and used the noise functions to generate colour, instead of just alpha. My colour experiments were mixed success .. it worked, but the colours looked rather boring and lifeless, and clearly it would take a lot of tweaking to get a good effect. So instead of fully creating the colours, I multiplied noise colours by the original layer colour channels. This produced much nicer results.

Boring procedural colours (ok for some things like lichen maybe?)
stipple_simple_zps5ghpjkjb.png

Alongside this, I had to figure out a good way of writing this system into the GUI, to make it tweakable, but not so much so as to frighten users. The most powerful system would have been to implement a node based custom graph, similar to the cycles renderer in blender, where you could feed the outputs of one node into inputs of others. However, this seemed like overkill, so I went for a simpler linear stack of 4 noise layers.

I experimented with a few GUI layouts, but the current one seems user friendly enough. I have a little preview window, which is faster to calculate as you change parameters, because changing the whole of a 4096x4096 texture for previews, is a little too slow.

It has also taken a bit of playing with the blending modes and maths to get something that looks right. I will probably put in some options for users to change blend modes per noise layer.

Once you have a prodecural stack that looks good for your layer, one of the best ways to use it is to blat a source texture all over the layer, then use a layer mask to determine how much is showing through in each area of the model.

I will tweak this a bit more and hopefully have it soon in the latest release.

Addendum

I have just compiled latest release, with the procedural stuff. Please try it! :)
https://github.com/lawnjelly/3dpaint

6 likes 4 comments

Comments

Navyman

I think you will get a lot of extra eyeballs on this because of the dinosaurs ;)

It is really looking great.

October 07, 2016 06:48 AM
lawnjelly

Thanks! :) Yes I am not a very good artist so I'm mostly downloading obj models for testing. It helps too because it makes sure the obj loader works with many models (I have already spotted a bug here on the dinosaur neck because of shared UVs, so I will have to fix this).

I have not heavily advertised the program yet as it is still an alpha with many things to fix. Also I have a feeling people will be more interested when I have added normal mapping, specular etc. These should be easyish to add once I upgrade the rendering to use a later OpenGL. Then I can e.g. have sliders to decide how much each procedural layer affects the normal map etc. :)

October 07, 2016 07:18 AM
Brain
I'll definitely be interested in this once you add full PBR :) I'm useless at modelling but I seem to be OK at texturing so a program like this would be really useful for me instead of tweaking textures in gimp :)
October 16, 2016 09:48 AM
lawnjelly

I am finally getting round to adding the normal mapping / gloss maps etc. I've used GLEW to get OpenGL 3ish, and am currently doing the shaders / VAOs. I'll do a journal entry when it is working. :)

October 20, 2016 06:35 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement