Bumpy materials plug-in

I’m writing a plug-in to auto-generate simple “bumpy-shiny” materials from a diffuse texture. We all know it’s bad, we should map high poly models and stuff. But I like quick and dirty things - and I’m lazier than a sloth.

Updated video

I have to add buttons over buttons and even more fields for all the parameters and options. I’m not really satisfied with the specular map, I tried with some convolution matrices but in the end the result that looks better to me is still an inverted gray scale map. I’ll try some blurring or contrast-brightness adjustment. I will probably add the ao map if I find some filtering procedure to generate an acceptable result.
And buttons. There are like a trillion properties that one could set.
When it is finished I’ll think about performances - it’s kinda slow but I didn’t really do anything to speed it up even a little.
If anyone is interested, I’ll release the alpha-state plug-in (it’s really one python file) tomorrow.

Here’s the plugin:

ImageFilterPanel0.6.zip [9.1kb]

To install it, unzip, there’s a single python file in it, open blender, user settings -> add on -> from file -> pick the file, check the box. The plugin is in the “tools” (left side) panel of the image view-editor space.

Known issues: it’s slow, like in “press the button and go for a coffee” slow if the image is big. I’ll try to make it fast when it is finished.

1 Like

Great plug-in ! , I would use this a lot for sure…

-Most of the time, I would have to do this with at least one or two other programs, such as the Gimp and Mind Tex.
-Even if the plug-in would come to bring some unsatisfying results, one can still get on with what is essential, and come back later to improve some of the texture maps…

First post updated with the plugin. I’ll update the video too.

Well, the original target of Blender’s Game Engine was the lazy game makers.
So, your nice plugin is in the right mood!
Thank you for your effort!
Bye

I have updated it to version 0.2. Fixed an error (create material when the selected object has no material list resulted in an error message - the material was created but not added to the object, set the category to Game [E]ngine instead of Game [e]ngine) I’ve added a scale option and a sort of invert option. Now you can drop a big diffuse image and go straight for a scaled down material. In theory (1 test made) if you have an image where the darker parts should be bumped out you can tell the filter to do so by checking invert - otherwise shinier part are read as prominent. I’ve also added a scale factor control to the bumpy material panel - it makes sense to have one there too.


Awesome plugin!
Request: Is it possible to provide an option (checkbox may be) to update the current material itself?

In theory yes. In practice I have to find out a sensible way to do that with zero risk to overwrite a material that might have been created with great efforts - like a very complicated shader-node material - and my button would simply trash with no hope of recovery.
I will test if replacing the current material with a new one leaves the old one still intact.
It’s the same reason while the plugin doesn’t overwrite images - avoiding the “hey, lemme try this button while I have my freshly painted Picasso right in front of me” thing.

I see your point. How about applying the newly created material to the selected faces?

I think there is a way to do it, I’ll check it. I’ll add an option list to the bumpy box, so that the user can specify some direction for the created material (create a new material, replace the current material, replace the textures of the current material, create a new material and assign it to the selected faces).
I shouldn’t really be doing any optimization right now but i managed to cut in half the normal map generation time, it will be in 0.3 version, along with the output mode selection.

Version 0.3 up - link in the first post.
Added an output button to the bumpy box.

[ATTACH=CONFIG]357889[/ATTACH]

There are three options. All fallback to the creation of a new material - that will be added to the list of materials of the selected object if any.

Add material: adds a new material to the list of materials of the selected object. If the object has no materials, then the new material will become the active one. If not, the new material has to be made active to be applied.
Replace material: same as Add material but makes the added material the active one.
Replace textures: this doesn’t add a material but takes the active material of the object, clears the texture slots (textures are still in the blender file, they are just no more used by the material) and replaces them with the textures created by the bumpy filter.

I have to dig a bit more in the documentation for the “apply to selected faces” mode.

Version 0.3 should be a little faster, I fixed the convolution filter (it didn’t normalize the kernel when asked) and did something else I forgot.

Awesome! Thanks very much for sharing! I hope that it will be added in the next releases of Blender.

Updated to version 0.4 - zip in the first post.


Added soft light generator, specular and soft lights are optional, reworked the ui a bit to make it less crumpled.

0.5, added an option to write the result of the “filter image” button to an existing image. To update the viewport I had to do a strange gl_free/gl_load thing, I don’t know if it is because of my video drivers or a bug or a misuse of the api or what (AMD and Linux? Yeah, good luck). Hacky at best, I don’t know if it works on other systems. Of course I asked on blendercoders which is like talking to the wind.
If it doesn’t work for others, I can disable the option in the next revision.

Tested with (Windows 7 64-bit) - GPU (geforce 660 GTX)

I just tried the overwrite function and it works.
After if I try and use images that are for example (1024p x 1024p) in size and in a .tga format ; then I get the regular message in the window header “not responding” for 15-30 seconds then everything kicks back in…

That slowness is normal. The algorithms are all quadradic, the code does a bagillion jumps and it is single threaded. To do worse one could only punch the pc while it’s counting. I’ll try to check what can be done without using external libraries (i want the addon to be self-contained), hopefully keeping the code vaguely pythonic.

Updated with 0.6. No new features, just a little optimization pass. It should be a bit faster. Still at “coffee cup” levels of speed though.

Great plugin!
It will save me a lot of time.