Home General Discussion

xNormal in Blender

Hi,

I have written an addon to Blender that allows baking all sorts of maps using xNormal as the external renderer directly from within Blender.


blender-xnormal-111.jpg?1385627045


Maybe it is just me being workflow fanatic, but I found for myself that switching between the two applications was somewhat interrupting, time consuming and quite annoying when processing a lot of maps for little pieces.

Well, this addons gives me all I need directly inside Blender and removes using yet another Gui.

I must mention that this addon is a far cry from stable or production-ready, since there are at the moment 16 different maps you can bake (all that xNormal offers minus base-texture-bake for now) with each of them having their options again. I haven't invested the time to actually test all of them yet, since I don't know if there is even a single person interested in using such a tool and I can always fix bugs for myself when they cross my way.

So yes, if there is someone interested, then hands up please. Testing would also be much appreciated.

And a word for those who cannot be bothered re-learning: I made sure to keep the Blender integrated Gui layout close to xNormal's layout (at least for the map specific settings) :)

Initial version of the tool is hosted on my website, at http://felixschlitter.com/tool/blender-xnormal

Thanks

Replies

  • Mongrelman
    Offline / Send Message
    Mongrelman polycounter lvl 18
    Awesome, will have to give this a bash at some point.

    Although I use Blender for modeling and UVs, I've not tried baking yet. Have you found issues with bringing in highpoly zbrush meshes? (a few hundred thousand triangles after decimation).
  • Chriz
    nice addon! I got an archive is corrupt with Winrar. With 7Zip it worked fine without an error. I will test it tommorow.
  • Mongrelman
    Offline / Send Message
    Mongrelman polycounter lvl 18
    Might be worth talking to Joghsy about this by the way as he seems very open to suggetions and may be able to help integration.
  • AlexLeighton
    Sounds cool, I'll give this a go later today!
  • jogshy
    Offline / Send Message
    jogshy polycounter lvl 17
    Very nice!
    If you find any bug in the batch mode or you need to change anything just tell me !
  • kat
    Offline / Send Message
    kat polycounter lvl 17
    Can you explain a little how this actually works in terms of what it's doing with meshes? Is it exporting files out of Blender and simply using that app (Blender) as an interface to what would otherwise be done in xNormal?
  • FelixSchl
    Mongrelman, there should be no need to load the high-poly mesh into Blender. You can point to the low mesh from the interface or just use a generic temp obj for all bakes that you can export to from Zbrush.

    Jogshy, that sounds awesome!

    Kat, yes the tool is using xNormal for all processing and is doing exactly what you think it is. All heavy lifting is done by xNormal. This addon just exposes the xNormal settings and gives quick access to baking directly from within Blender.

    Key differences in initial version:
    1) Only single low-poly / high-poly mesh
    2) Only bake one map at a time
    3) No base-texture baking
    4) No blocker files
    5) No cage files

    I am interested in adding cage- and maybe blocker files but I am somewhat reluctant to add the multiple high- and low poly mesh feature, since I do want to keep it focused around what is actually happening in the Blender viewport (instead of abstract obj files). Not sure about base-texture baking at the moment, have not used that feature yet myself tbh.
  • kat
    Offline / Send Message
    kat polycounter lvl 17
    So you have high/low poly meshes in Blender then, once you've provided the system path to xNormal.exe, you can render whilst remaining in Blender using xNormal instead of the internal Bake system. Is that right?
  • FelixSchl
    Kat, regarding the actual baking process Blender itself is doing next to nothing. It is only providing an user interface to xNormal. In fact, all Blender does is exporting the meshes and even that is optional since the path to the low and high meshes is configurable.

    Maybe I need to elaborate: xNormal can be launched from the command line and you can provide it with an xml file that holds the settings. What my addon does is expose the available xNormal settings, then write them to a xml file and then start xNormal with that xml file. Then you get the images out the other end, completely without manually starting or fiddeling with xNormal itself.

    The idea of integrating it into Blender was to get access to all these settings more quickly and more easily and therefore streamlining the process of straightforward map baking. I am interested in taking it further and making it more efficient if people are interested in it. Else I will probably keep it around and update it once in a while when I feel like it.
  • kat
    Offline / Send Message
    kat polycounter lvl 17
    Thanks for the clarification, I see what you're doing now *up*
  • PLyczkowski
    Offline / Send Message
    PLyczkowski polycounter lvl 14
    Hi, is this addon discontinued? I get the following error in Blender 2.65 - http://db.tt/sXYYwYpO
  • respawnrt
    Offline / Send Message
    respawnrt polycounter lvl 8
    Hey dude, i used it recently with blender 2.65, have you checked your xnormal exe path ? :)
  • PLyczkowski
    Offline / Send Message
    PLyczkowski polycounter lvl 14
    I do, it's correct. I just noticed that when I start a new blend file, it bakes ok. But in the file that I work in, it throws this error after pressing Bake, without launching xnormal.
  • FelixSchl
    Sure sounds like missing or wrong exe path. Since settings are tied to scenes in Blender it might just be it works fine in one and not in the other. I would make a new scene, set it up and save as default. That's the safest bet to ensure it's always working.
  • FuzzYspo0N
    Hey this is a fantastic script. I will definitely have to try it out when I work in windows again.
  • Pancakes
    Offline / Send Message
    Pancakes polycounter lvl 10
    cool, but are you guys saying that you find the xnormal bakes to be better than blender's - I've yet to get any other program to bake a normal (or other) map with the same quality as blender, not zbrush, 3dcoat, or xnormal at least
  • Andreas
    Offline / Send Message
    Andreas polycounter lvl 11
    Blender is a fantastic normals cruncher, at least IMO. XNormal has the advantages of playing around with cages though. Also I find blenders AO a bit strong, but that's easily editable in Photoshop.
  • PLyczkowski
    Offline / Send Message
    PLyczkowski polycounter lvl 14
    Hi, gives this error in Blender 2.66:
    Traceback (most recent call last):
      File "C:\Users\Ja\Google Drive\Programs\Blender 2.64\2.66\scripts\addons\bake_xnormal\__init__.py", line 255, in execute
        keep_vertex_order = True,
      File "C:\Users\Ja\Google Drive\Programs\Blender 2.64\2.66\scripts\modules\bpy\ops.py", line 188, in __call__
        ret = op_call(self.idname_py(), None, kw)
    TypeError: Converting py args to operator properties: : keyword "use_apply_modifiers" unrecognized
    
    location: <unknown location>:-1
    
  • FelixSchl
    The blender API is a beast to keep up with. I updated it on my site. Also the sources are here, so next time someone can just make a pull request if I don't respond. In this particular case, it was a one liner to fix.

    I also changed a little thing: You now set the xnormal.exe in the addon preferences in the user-preferences->addons->xnormal. This means the path to the exe is maintained across all files, thanks to finally having separate user prefs and startup scene.
  • Jesse Meyer
    This is fantastic! When it works it has easily optimised my cross-application workflow by a significant margin.

    One rather significant problem. The first session with 2.68 I played around with baking out maps, everything worked fine. I rebooted, did the sleep thing, and the next day re-opened Blender and it freaked out about not finding Xnormal's path, which I had determined after peeking at the code. It seemed that Blender wasn't saving the executable's path. Anyway, I set that up and was able to get the Xnormal prompt to start up from after pressing the 'Bake' button, but now after both the high and low poly are loaded up, Xnormal's window vanishes into thin air. I'm going to uninstall both Blender and Xnormal, and re-setup it all, but I thought this should be brought to your attention since it may be an odd code thing.
  • EarthQuake
    Looks cool, it would be good to add an option to export a cage mesh as well. Not sure how you guys go about creating that in blender though.
  • SnowInChina
    Offline / Send Message
    SnowInChina interpolator
    EarthQuake on Today 05:05 PM
    Looks cool, it would be good to add an option to export a cage mesh as well. Not sure how you guys go about creating that in blender though.

    sadly you have to use some magic and the shell modifier, because blender doesnt use cages

    yep, one of the few points where blender is behind
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    No need to use the solidify modifier, just use the displacement one and set it to normals works great, that's what I do.
  • EarthQuake
    No need to use the solidify modifier, just use the displacement one and set it to normals works great, that's what I do.

    Yeah so, maybe you could make a copy of the mesh, and then the script could have a button for "use as cage" or whatever.

    Even better yet would be something automatic in the cage that makes a copy, adds the displacement function with a slider for strength or something, and automatically exports that with the lowpoly.... Dunno how much of this is possible in blender but that would mimic the cage features of max/maya, a bit better.
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    mm, I was thinking about doing a script like that myself, just a easy one to duplicate my lowpoly and add a displacement mod and "_cage" behind the object name.

    Should not be too much problem to add to the script, but I'll let FelixSchl answer that part.
  • FelixSchl
    Anyone still using this? I missed all notifications on this thread, it's been almost a year now. If there are still folks using it, I would be happy to ensure it works and possibly add that cage thingy. Or has something else emerged while I was "away" that renders this addon obsolete?
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    There's a very early version of Cycles bake, so I guess people will be more interested in it.

    Thanks for you work on the script though!
  • FelixSchl
    Oh cool, well I have been completely detached from Blender developments for almost a year now. Good to see they work on baking with cycles. I see their website got some love, too.
  • Michael Knubben
    Nevertheless, Xnormal baking is still nice to have. It offers the ability to change the tangent basis to fit your engine, and will (I assume) offer better speeds than Cycles, still.
Sign In or Register to comment.