Grungit : 1-click wear and tear for Blender

These Optix Limitations are WIP but no time estimate was made in order to be fully compatible with all nodes.
I’m also a Optix User. Switching to CUDA is just a button on preferences. Your sollution seems like a good one and it would be nice on a upgrade. In fact, I’m considering buying because of this.

Thanks for letting me know!
I included the Optix workaround, as well as the occlusion improvement @VARRYUS suggested in v1.6.1 and it’s up on BlenderMarket and GumRoad
For the Optix workaround, I don’t have an RTX card to test it (just in case something very unexpected happens. You know, you can’t be 100% sure when programming ¯\_(ツ)_/¯ ), but it did seamlessly switch from CPU to CUDA then back to CPU in my tests, so I’m fairly confident it will work for you. Let me know if you encounter any issues

1 Like

Amazing Work beeing done here! Thank you so much abdoubouam! Still some quirks on my rig (edit: with the new 1.6.1 version):

OPTIX:
Seems like it behaves just as before, throwing the error message, that OPTIX is not usable for baking (yet). CUDA works. I am running the 2080TI if that helps. A behind the scenes switch to CUDA is a great idea though. Every klick saved is worth it. :smiley:

MULTIPLE OBJECTS:
Unfortunately doesnt work for me in the simple setup of two intersecting cubes (default and 1 copy moved a little) and two seperate materials. I select both and hit GRUNGIT. The copy bakes fine in all tests. The original cube doesnt, whatever I try - completely black grunge-map. When I bake them separately: no problems. What I think i witnessed on other occasion with more intersting objects: just when all objects have their UVS properly set up and the "(Re)Create UVs)-Button is deactivated it works. So returning to my case before with the cubes it turned out like this: The first try (select all, hit grunge) one cube fails to bake, the second time (selecting again, hitting grungit again) it works as intended and both maps show up. Both times the “recreate uv” was disabled. Thats interesting as the default cube actually comes uv unwrapped.

OCCLUSION:
Fantastic! What a great experience customer/developer-wise! Really works and beefs up this addon by quite a bit! Thanks for the inclusion (pun etc) :smiley:

ANOTHER IDEA - MAPS PER OBJECT/COPY MATERIAL
It seems that when two objects share the same material and I grunge them both (the cubes from before) one map gets created and used for both objects - which might go unnoticed in more complex scenes. What I need to do in this case is, to copy the material manually first and then get on grunging. What if the copying of the material (possibly using groups so that change in the colour of one results in a change of the color for the others) could be handled by the addon, so that if that step is forgotten things dont end up looking broken.

Again: Your work - for me - is one of the most interesting addons for this whole 3D thing. “Imperfection is digital perfection” somebody smart once said. And you are nailing this department!. Thanks again for your commitment and energy to deliver us juicy imperfection!

I just noticed for my last point: COPY MATERIAL
that actually that does happen in a way - multiple object get a shared UV map. Thats amazing! Actually the smarter approach, just need to keep in mind to up the resolution for those cases. It worked for me like a charm after a while. I can’t really say for sure when it fails or works - but just know: It did work eventually, and when it does: perfectly so! My bad for bringing up stuff that is non-issue after all. Just monkeying around in a complex program.

Can you send me a screenshot? it seems like it’s working on my machine, but someone reported an issue and it looks like they’re using macOS https://pbs.twimg.com/media/EOIt0M_UcAA_nnb?format=jpg
After some research, I found “AMD OpenCL GPU rendering is supported on Windows and Linux, but not on macOS.”, and since Nvidia isn’t supported anymore on macOS, I think the “compute device” option is simply not present in macOS.
Can anyone confirm?

I will investigate all the bugs and try to fix them today. Thanks again!

Either way, I fixed my “fix” lol (1.6.2 experimental, and I deleted 1.6.1)
now it checks if “compute_device_type” exists first before changing it, regardless of the reason why it doesn’t exist.

Hey there! I get this Error message when OPTIX is enabled.

A bit more interesting is the system console (it shows that it does at least output the intention of switching between CUDA and OPTIX:

OptiX implementation does not support baking yet
Error: OptiX implementation does not support baking yet
Info: Baking map saved to internal image, save it externally or pack it
Traceback (most recent call last):
File “C:\Users\VARRYUS\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\Grungit\grungit.py”, line 498, in execute
Grungit.bake(self,context)
File “C:\Users\VARRYUS\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\Grungit\grungit.py”, line 426, in bake
bpy.ops.object.bake(type=‘EMIT’)
File “C:\Program Files\Blender Foundation\Blender 2.81\2.81\scripts\modules\bpy\ops.py”, line 201, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: OptiX implementation does not support baking yet

location: :-1

location: :-1



Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Switched back from CUDA to Optix
done!


Also i tried to do a little screencap showing A) the Error (not too interesting) and B) how it looks when I have to grunge it twice for the intended result. Also… still on 1.6.1 - didnt find time yet to update.
Dropbox Link to the video: https://www.dropbox.com/s/ibxww4ne8rdrlw4/Desktop%202020.01.13%20-%2023.25.52.02_1.mp4?dl=0

Hope this helps :slight_smile: Cheers!

So 1.6x was a trainwreck :slight_smile:
I just realized made it check for Optix AFTER it tries to bake (because I’m smart). It should be fixed now, I will be releasing an update soon, just after I make initial tests for a new feature (1-click PBR bake)
As for the second issue, it seems like all objects, except the active object, get deselected. You can see from your video that you only end up with one object selected in the end, and it’s the one that looked correct.
I’m not sure what deselects them, but I added a few lines of code to restore selection and it seems working fine for me.

1 Like

1.6.3 is up on BlenderMarket and Gumroad.
When you have time, can you test them and let me know?
I also added a PBR bake feature. You only need to click that button and it generates diffuse, metallic, roughness and normal maps for all your objects and materials, saves them, then switches your old nodes with the new baked images. It doesn’t delete the old nodes, it just disconnects them for convenience.
Also it works with all kinds of nodes, not just Grungit, the only condition (for now at least) is to use one Principled BSDF node per material
pbrbake

1 Like

Good Evening!
Eagerly I tested your new code:

MULTIOBJECT BAKE:
Continues to fail me in part. If they (same cube test) have the same material + Recreat UV is selected yes, It works. When its two seperate objects with different materials - still no. One map remains black. It seems both objects are now selected after the grunge. Seperate Bake - no problemo.

OPTIX:
Worked flawless, no error, OptiX still selected after Grunge Map Bake (not PBR Bake though).

PBR BAKE:
Oh boy… what a feature. Big up for this one! All the time saved from not having to recalc shaders in eevee. Blessing. It actually works out of the box it seems. The PBR map nodes are all centered in one spot (node wrangler to the wrescue) but functionwise on point. It does throw the OptiX error though.

Keep it up man! You are doing such amazing work!

I think I found the issue: the second image is baked, but it’s not saved and it gets discarded. I’m not sure how to fix it yet, I’ll investigate.
I forgot to add the Optix fix for PBRBake, it’s done and will be included in the next update. Thanks for letting me know!
I will reposition the images properly in the future, and add an option to select what maps you need to bake. That’s why it still has the warning, (also because I didn’t test it enough)

Great to hear! Looking forward! :blush: cheers!

F47439E3460C4C7DAF5085D29297A403.png

I think it’s fixed now in 1.6.4

Buon Giorno! Just tested it out. Seems like a really good release mate! 5 Cubes all selected in OptiX, Bake - Boom - Done, Hit PBR Bake - Boom - Done. Amazing!

I did have it fail on me the first time - but the other 20 times it worked without hesitation.

Really great mate!

May I suggest another improvement?
I think the system for the scratches, potentially the cracks could be improved. First it seems the same texture and orientation is used for everything. Secondly: the amount of scratch basically controls the strenght of the bump or normal map. My thought was: what if it was procedurally created and also adheres to the physical circumstances - as in: more scratch on the edges, shorter scratches on the edge, maybe occlusion affecting it and so on. Just an idea, I am sure you are not yet out of work and ideas for this addon any time soon :smiley: .

I want to emphasize that I for my part am incredibly astounded of what you managed these last few days. Thank you very much! Really can’t wait what else you come up with!

1 Like

Love what you’ve done, useful for so many things. I do a lot of metal stuff and have my own ill-conceived solution - what you’ve created is a godsend.

1 Like

This is so good! I am wondering if its possible to have a no UV mode, my geo is sometimes too nasty and heavy to even pull off an auto UV. I get that it will be worse looking without baking and instead using like an inverted AO or something, but the trade off might be worth it. Especially since I can continue to model and have it update without having to rebake every time.

1 Like

Technically yes, but it only works with Cycles and it’s extremely slow (like 25x slower or more), and sometimes it doesn’t work at all because it’s too complex for Cycles.
Here’s the node setup:


You need to delete the dust node otherwise Cycles will not work. shift+a>groups>baker v1.6 (you should apply grungit in your scene at least once so you can have the “Baker v1.6” and “Grungit v1.6” nodes imported) Add a combine RGB node and connect everything as shown and you’re ready to go

1 Like

Good to hear! However if you encounter the error again please let me know how it happened so I can fix it :slightly_smiling_face:

Thanks a lot for the suggestions, I already have some of these planned, and I added the rest to my to-do list. Thanks a lot for the suggestions and the support, really appreciated!

I’m glad to hear that :smile:

This may sound like a silly question, but does GrungeIt have different masks? I mean, take a look at substance painter. You have lots of different masks for variety.

Grungit has 2 nodes/components : grunge and dirt.
The grunge node allows you to control how much wear there is, how much scratching, occlusion (remove/reduce wear from edges that are hard to reach), edge wear, cracks, clearcoat, main (top) material, secondary (bottom) material…etc
The dirt node lets you control how much dirt to add on top, bottom, sides, from the bottom up, from the top down, in cavities…etc.
On top of that, you can add your own mask and paint to add or remove wear from some certain areas if you want more control.
So, technically speaking, it does not have multiple masks, but it is very flexible and can give you a wide variety of results.
I hope this answers your question

1 Like