Daz3D 4.8 png background is black
paphus
Posts: 42
I am rendering an animation in Daz3D to a png image series. The background comes in as transparent, as expected, but when I convert the image series to an mpeg or webm video the background becomes black.
In Daz3D 4.7 this did not happen, it was white. It seems Daz3D is setting the png transparent color differently than in 4.6.
Anyone know how to set the color of the transparent background to white?
I can force a white background using a backdrop from the Environment pane, but then I loose the trasparency. I want the trasparency as webm supports transparentcy on Chrome, but in Firefox it becomes black, where as it used to be white.
Comments
Make sure you use the alpha (the transparency) to mask the images agaisnt a desired background in your conversion application - there was a change in the handling og alpha channels and backgrounds in 4.7 to avoid colour bleeding from background to semi-transparent pixels.
Though WebM supports transparent video... Whatever you are using to convert the file or produce the file, does not.
Videos don't have native transparent levels, that is a special function done post-processing. (Removing solid colors and blending edges.)
Recording alphas would double the size of the video, if it were done.
I believe the color set is just the "Viewport color"... Or NULL, which is 0,0,0 (Black)
[Window]->[Styles]->[Customize Styles]->(Viewport color)
In your editing program, if making video from images, you should set the "background color" there, as that is where the color is set when they "render the video". That information is not actually saved with the alpha-chanel, it is saved in the actual image. (If you have no alpha data, it displays Black because your viewport is black. Change it to white, and it will be white without the alpha. Which is what your video editor is seeing, since it does not see the alpha.)
No, the webm video is transparent. But not all players support transparent webm. I want the background white on player that do not.
Chrome supports transparent webm and the video looks the same on Chrome as in Daz3D 4.6, but on Firefox, because Fixfox does not support transparent webm, the background is black, and worse, there is a hola around the image. I need the background to be white is Fixfox, like it was with Daz3D 4.6.
I have tried everything.
I tried setting the viewport background to white, but had no affect.
I tried setting the Environment backdrop to white, but then I loose the transparency.
I tried using the image converter mogrfy to set the background and transparent-color to white, but no luck.
How do I get it to work like in Daz 4.6?
All I can think of is using a batch process in your image editor to give the images a white background, save the alpha channel, collapse the layers to give (pre-multiplied) image on white, and then use the the saved alpha to reapply transparency. The 4.7 way is better for compositing and I'm glad it was done, but it is a pity there's isn't an option to switch back to premultiplied alpha on a selected colour.
For the first time that I can remember, my Jpeg saves are now rendering with black for the transparent background. I recall D|S used to save these with white for the alpha background. I'm guessing a broader change in establishing the transparency color has been made between versions. For Png,s I feel white is the better color to encode as the single color for the transparency, and JPegs should be saved with white to represent the transparent background.
Setting the Viewport or Environment colors isn't going to affect this, I don't think. We should gave a setting for the transparency palette.
I'm getting closer to fixing the transparency but still not back to what I ahd with Daz 4.6
I used mogrify from ImageMagik to convert the png files to change the transparent background to white,
> mogrify -background white *.png
> mogrify -alpha Background *.png
This works, webm looks good in Chrome with transparency, and is white in Firefox, but there is a wierd black halo around the image,
http://www.botlibre.com/media/a1153572.webm
same with the mp4
http://www.botlibre.com/media/a1153571.mp4
if I remove the transparency the mp4 looks good,
> mogrify -flatten *.png
http://www.botlibre.com/media/a1153573.mp4
But need solution for webm on Firefox still.
I seems like there are some semi transparent pixls that cause the black halo. Not sure what to do about these, although flatten seems to be able to work around it.
Anyone have any other ideas? Or know of a way to make Daz 4.8 work like 4.6?
As Richard pointed out above, "there was a change in the handling o[f] alpha channels and backgrounds in 4.7 to avoid colour bleeding." So I think any significant change is going to have to come programmatically. It's always best not to hard-code these kinds of changes, to avoid abruptly altering existing workflows. It's better to allow us to over-ride them, as in setting the color palette for the alpha channel. Some of us want white, even if for some applications there may be artifacts.
Or maybe such an adjustment is already available, but in an obsure place in the UI. If anyone knows where it might be, it's Richard.
With that said, what happens if you convert these pngs to 8-bit indexed? Counter-intuitive I know, but sometimes it makes a difference in avoiding the jaggies from your second example. This is a paid app that does it (https://tinypng.com/) but ImageMagick is supposed to handle it, too (in the right way, not like Photoshop).
Okay, this background change in Daz 4.7 /8 is really driving me crazy. Anyone know how to get it to work like 4.6? At this point I'm contemplating unistalling, and reinstalling 4.6 (if I can find it). Consdering how long it took to get all my content meta-data to work with 4.8, I'm not looking forward to this.
I have been almost able to convert the image series back to what is was in 4.6 using (ImageMagik),
convert -alpha extract talk*.png mask.png
mogrify -flatten talk*.png
for /f %x in ('dir /s /b talk*.png') do @composite -compose CopyOpacity mask-0.png %x %x
The final pngs look good, but when I try to make a webm from them, there is no transparent background, just white...
ffmpeg -framerate 10 -i talk%02d.png -r 10 talk.webm
They changed the alpha in the newer versions of DS for the png to use straight alpha. Before it used premultiplied alpha. 3delight always produces premultiplied alpha, so the conversion to straight alpha is done when a png is saved from DS. That conversion is only possible if the background is known (which is usually not the case, because the background might be generated by some complicated shader). To simplify things it only works with the background being black. In principle you could create the premultiplied alpha simply by putting the straight-alpha png over a background (preferably black), keeping the alpha channel as it is. The ImageMagick documentation should also tell which alpha-flavour (premultiplied/straight) is expected.
That "weird halo" effect you got has likely nothing to do with that. It looks like filter ringing, caused by a too large value for the filter size (in the render settings). It probably was there all along, without you seeing it (because of the "color bleeding" as Richard called it). I do not know if any of the movie formats support an alpha channel, but if they only support fully transparent or fully opaque pixels, simply set the filter size to 1.
In order to have the un-multiplied alpha all of the edge pixels that contain any part of the rendered objects must be purely the colour of the objects - if the background colour was mixed in then you'd be back to pre-multiplying - and that is one kind of weird halo. Filtering can, as you say, also produce a different kind of halo that will extend beyond the pixels that should contain object colour.
That is the reason to always use black for a background when rendering with premultiplied alpha. Black mixed with pure red is still pure red (only darker) and can be composed over a background without bleeding. Anyway, the artifact (those double border) in the OP's webm looks very much like filter ringing to me (see zoomed image).
My final script to convert a png image series from a black alpha background to a white alpha background.
for /f %x in ('dir /s /b talk*.png') do @convert -alpha extract %x %x-mask.png
mogrify -flatten talk*.png
for /f %x in ('dir /s /b talk*.png') do @composite -compose CopyOpacity %x-mask.png %x %x
End result is here,
http://www.botlibre.com/avatar?id=1115544