LuxRender | Premultiply Button Missing?

So I decided I’d take a crack at matchmoving and went and modelled a hole in the ground to fit into some footage that I have. Everything’s good for the footage, I have a solved camera from the matchmoving software I’m using, but I want to make my render of the hole look good so I’m trying Luxrender.

I’m using Blender 2.54 Beta for this feat and Luxrender is working perfectly fine, I’ve been able to get a working image seuence. The only problem with the sequence is that it doesn’t have an alpha channel. I remember when I was using 2.49b with Luxrender, there was a “premultiply” sorta thing that produced an alpha channel wherever there weren’t any objects in the scene.
http://www3.sympatico.ca/berns.rowe/Images/Premultiply.jpg
If I could use 2.49b I would, but Luxrender is having problems with it on my mac (It’s a macbook pro 15" don’t know what version - sorry). Getting back to 2.54, wherever I look, there’s no premultiply option. There’s an option to output the sequence using RGBA channels but no check/dropdown box that allows me to premultiply.

Am I the only one with this problem? Anyone else getting a premultiply button? If it’s disguised as another term someone please tell me! I don’t want to have to use the internal blender render engine for this. I also can’t seem to get Yafaray working on my mac. I’m almost certain it’s because i’m running python 2.6 on this fellar when Yafaray for mac was built using 2.5. If I downgrade will that result in other python dependant things to be useless… like blender 2.54?

Maybe there’s some sort of workaround? Like putting up a pure green screen as a background? I don’t know enough about Luxblender to do that… I mean, I tried, but since Luxrender does global illumination, the green just ends up rubbing off onto the surfaces of other objects in the scene - it looks strange.

Any help is appreciated, sorry I made this post unnecessarily long. Happy Blending!

Am I the only one with this problem? Anyone else getting a premultiply button?
It looks like that feature hasn’t been implemented yet. The chances of it getting implemented soon may increase if you ask nicely in a relevant thread on the LuxRender forum.

Maybe there’s some sort of workaround?
There is, if you’re not afraid to edit files by hand: Open the .lxs file that got exported (for example in notepad or notepad++), find the section called Film “fleximage” and add the following lines:

"string write_png_channels" ["RGBA"]
"bool premultiplyalpha" ["true"]

It shouldn’t have problems - if you have the time, please report this problem on the LuxRender forum.

Wow. Thanks for the quick response, extremely helpful! I was actually able to get Luxrender working with 2.49b, but it’s really good to know that I’ll still be able to get an alpha channel in 2.54. As for the workaround, I’m going to try that right now. If it works, I’ll post back and let you know. Many kudos to you for letting me know (:

Edit:
Okay, so I did what you said and yes! It worked, I got an alpha channel in my render. Only problem is that for every single export, I’d have to do that and I’m trying to get an animation out of it…
I’ll see if I can get blender to automatically export with the two lines
“string write_png_channels” [“RGBA”]
“bool premultiplyalpha” [“true”]

by having a look at the addon script thingy for luxblender. I’m not good with python so don’t expect much :stuck_out_tongue:

Edit:
Hmm… I went and looked in the scripts folder for Blender. Here’s what I found:
I’m on a mac btw, but in
Blender.app/Contents/MacOS/2.54/scripts/io/luxrender/export
I found a file called “film.py”

Inside this “film.py” I find this:
# Output types
params.add_string(‘filename’, efutil.path_relative_to_export(efutil.export_path))
params.add_bool(‘write_exr’, False)
params.add_bool(‘write_png’, True)
params.add_bool(‘write_tga’, False)
params.add_bool(‘write_resume_flm’, False)

These few lines look awfully similar to what I found in the exported .lxs:
Film “fleximage”
“integer xresolution” [800]
“integer yresolution” [600]
“float gamma” [2.200000047683716]
“float colorspace_white” [0.314275000000000 0.329411000000000]
“float colorspace_red” [0.630000000000000 0.340000000000000]
“float colorspace_green” [0.310000000000000 0.595000000000000]
“float colorspace_blue” [0.155000000000000 0.070000000000000]
“string filename” [“TestBlender2_5.Scene.00004”]
“bool write_exr” [“false”]
“bool write_png” [“true”]
“bool write_tga” [“false”]
“bool write_resume_flm” [“false”]

“integer displayinterval” [5]
“integer writeinterval” [8]
“integer haltspp” [100]
“string tonemapkernel” [“reinhard”]
“float reinhard_prescale” [1.300001144409180]
“float reinhard_postscale” [1.200000047683716]
“float reinhard_burn” [6.000000000000000]

So I just thought “Okay, I’ll just use that template they provide to add a couple parameters for premultiply and RGBA channels.” I made sure to backup before I did anything. So this is what I edited “film.py” to have:
# Output types
params.add_string(‘filename’, efutil.path_relative_to_export(efutil.export_path))
params.add_string(‘write_png_channels’, RGBA)
params.add_bool(‘write_exr’, False)
params.add_bool(‘write_png’, True)
params.add_bool(‘write_tga’, False)
params.add_bool(‘write_resume_flm’, False)
params.add_bool(‘premultiplyalpha’, True)

Notice the added parameters for ‘write_png_channels’ and ‘premultiplyalpha’

I then renamed both ‘film.py’ and ‘film.pyc’ to have an extension of ‘.old’ so Blender wouldn’t use them. I left my modified film.py as it was, and when I launched Blender, Blender autocompiled a second modified version of ‘film.pyc’
This is where I got excited and thought it was going to work, but nope. Something went wrong with the compiled ‘.pyc’ or I went wrong in the methods of modifying ‘film.py’. I looked at the exported “.lxs” and what happened was that the export completely skipped the section where all the parameters were (Film “fleximage”)

Anyone got any ideas on where I went wrong? I was completely guessing with all of this. Maybe I should just leave this to the guys who actually know what they’re doing?

Anyways, here’s the files that I ended up with. ‘film.py’ and ‘film.pyc’ are not the originals, those are my modified ones. ‘film.py.old’ and ‘film.pyc.old’ are the original ones, open 'em up with notepad or textedit.

Click to download/view
film.py
film.py.old
film.pyc
film.pyc.old

Thanks a bunch if someone does take a look at these, it isn’t of utter importance since I can use 2.49b now, but it’d be nice to see if I can get this to work - It’s like a challenge (:
Happy Blending!