Bit of an issue here, trying to render this glass scene
Looks fine in the viewport, but when I hit render
Does anyone know the cause of different view port and final render, and how to fix it?
Here's my Blend File
Bit of an issue here, trying to render this glass scene
Looks fine in the viewport, but when I hit render
Does anyone know the cause of different view port and final render, and how to fix it?
Here's my Blend File
If you need to produce a PNG file you have to know that the format uses "unassociated" alpha.
That means that the program that will do the compositing will "pre-multiply" foreground's RGB*alpha prior to adding it to the background plate.
This is important to know because it means that every pixel with alpha=0 will lose its RGB data (because multiplying anything by 0 gives 0).
Associated alpha, as explained here, allows you to have pixels that are both emissive and fully transparent, but that kind of information can't be expressed in a PNG file.
In order to transfer the the result of your render to a usable PNG output you'll have to cheat and pull an alpha from the RGB data, taking care of the light parts and the dark parts in two different steps.
Instructions:
1) First, do an alpha over on white, the result will show only the dark parts.
2) Then do another alpha over from the original render, this time on black. That will reveal only the light parts.
3) Now, invert the result of the first alpha over.
4) Using a mix node set to SCREEN, mix the result of the second alpha over with the inverted result of the first alpha over. That will be your alpha channel.
5) Take the output of your second alpha over (the composite on white) and using a mix node set to divide, divide it by the alpha created in the step 4.
6) Plug the pre-divided plate from step 5 into the "image" socket of the composite output, and plug the alpha channel produced in step 4 into the alpha socket.
That will give you a reasonable unassociated PNG output. It won't be perfect as the unassociated alpha format is very limited for advanced compositing, but it will do the trick.
Anyway, ALWAYS REMEMBER that associated alpha is the one true alpha, and allows compositing effects that are impossible with unassociated. This means that PNG isn't an adequate format for vfx compositing and a format that allows associated alpha should be chosen instead. If the program where you're going to composite these plates allows associated alpha always prefer it over unassociated.
What you are experiencing is a limitation of the render viewport. Sadly it is broken and has issues displaying the mix of transparency and luminescent (emission or reflections) correctly.
Your information is there, your file is fine, but is not being displayed correctly.
Trying to view the render using the default Color+Alpha will not work.
You can choose to ignore the display and composite normally.You'll see that once you overlay your rendered layer image on top of something else things are correct.
For example if you overlay your image on top of a color background using Alpha Over you'll see what I mean:
Note that if you save the image using the .png or .Tif format the error will persist, as the alpha channel will be unassociated. (see this link for a deeper explanation)
If you save the image as an EXR file you'll be able to preserve the transparency and emission you are looking for.
somehow related posts: