Almost instance support for blender mitsuba exporter

I was planning to add blender particle support for mitsuba exporter, and export them as instances, but it seems there is always some kind for problem.
Blender mitsuba exporter works based on collada format, and collada exporter in blender dosen’t support modifiers (including particles).
So I did something like 3 different python scripts to hack my way through exporting instanced particles (it would be good for all kind of stuff – hair, grass, instanced leafs or whole trees etc.)

  1. Changing exporter from dae to obj. Unfortunately mitsuba seems to convert all obj objects from ‘scene.obj’ file as one shape (mitsuba shape is same as blender object-mesh entity). So I could not even get materials to work, and assign them correctly through mitsu adjustment file.
  2. Exporting each blender mesh, as separate obj file. This time Blender was freaking bitching about modyfing scene while . I have no idea, how do I bypass this. Probbably need to detect UI drawing state, but I have no idea how ( I just learn Blender API and python while coding exporter :/).
  3. I tried to just iterate manually over each particle and export it through mitsuba adjustment mechanics, as type with transformation matrices, but then it seems, there is no way to attach this list of after shape they are referring too. It is important to attach instances of object after it’s declaration in xml scene file, so parser knows what those instances are reffering too.

Damm, coding is stresfull. Somebody help me…
Anyway here is updated mitsuba exporter with:

  • texturable roughness
  • Wireframe texture
  • Linear blend material
  • After coding it is good to relax by drawing some 🙂

    Published by

    bartoszstyperek

    Człowiek używający wolnego oprogramowania i wolnego komputera....

    3 thoughts on “Almost instance support for blender mitsuba exporter”

    1. Hi

      Tried mitsuba09 in Ubuntu 11.10 running Blender 2.63 but still no luck. Will look into it if I find time later, but python is entirely new to me, so it might take a while.

      The best way I’ve found to handle stress in Transcendental Meditation, which provides deep rest while unlocking creative potential. Used by David Lynch, Clint Eastwood, Martin Scorsese as well as Federico Fellini.

      TooBad is too good.

    2. HI Aurosutru, Sorry about Ubuntu. I think You can make it and learn python – it is one of easiest scripting languages. I learned it too just for Mitsuba – to fix compatibility problem with new release of blender, and then I started to add some more new features.
      About stress, well I draw to relax but I can’t do it while programing – so bit of a stress is unavoidable 😉

    3. Found a typo in my previous post where “in Transcendental Meditation” should be “is Transcendental Meditation”.

      Wenzel updated some of the Blender exporter code, which now works in Ubuntu. The change involves substituting the following code for the entire MtsLaunch function in export/__init__.py

      def MtsLaunch(mts_path, path, commandline):
      env = copy.copy(os.environ)
      env[‘LD_LIBRARY_PATH’] = mts_path
      commandline[0] = os.path.join(mts_path, commandline[0])
      return subprocess.Popen(commandline, env = env, cwd = path)

      He thought you might like to include this in your next update.

      If particle instancing for hair etc. is proving difficult, would the Mitsuba hair code be a good alternative? Wenzel recently upgraded that code to make it faster. Won’t help with leaves and trees, but might be very quick for hair.

    Leave a reply to Aurosutru Cancel reply