3
$\begingroup$

I have my rendering set up like so:

render setup

the idea is to combine the normals and the depth in to one texture which i can use in a game i am making. I could do 2 separate images, one for normal and one for depth, but it seems to be like i should be able to combine the 2 using the alpha channel to contain the depth information.

When i render it i get what i expect. I can click the rendered image in blender to see the colour and alpha values all over it, and they are consistent with what i expect. The row of boxes looks like it changes colour as it becomes more distant (because of depth/alpha) but the sampled rgb values are steady. The very near box is almost entirely transparent and the rgb values present and correct (i hope!).

render sampling

(White cross marks where i was clicking)

When i save that image and edit in gimp everything has changed. With the row of boxes, instead of the rgb values remaining steady and only the alpha changing, both rgb and alpha changes. And the very near box has lost all rgb information. It's now just white with 1% alpha.

enter image description here

What do?

Edit:

If in blender i render the image, then go to the image menu and chose save as, i get a checkbox "save as render" on the left. If i uncheck this it works as expected (i think... not thoroughly checked it).

... just checked it and this isn't solving it. It keeps colour values in the extreme-alpha case, and it keeps colour values internally consistent, but the values themselves are all wrong compared to what the blender render window says they are.

Further edit:

It seems if i export as EXR the values are all correct. I can than convert to PNG and the values are all correct. Most peculiar. Would be marvellous if i didn't have to do all that extra work and it just made the PNG in the first place :)

$\endgroup$
  • $\begingroup$ Add your files in the comments, and I will edit them in to your question. $\endgroup$ – David Oct 3 '15 at 18:27
  • $\begingroup$ Ok, cheers. Here's the image of sampling the colours in gimp s3.postimg.org/a6266pbmr/gimpsample.png $\endgroup$ – jimjamjahaa Oct 3 '15 at 19:01
  • $\begingroup$ And here's the render output, might be more useful? s12.postimg.org/ej60p1sfh/Camera_B2.png $\endgroup$ – jimjamjahaa Oct 3 '15 at 19:32
  • $\begingroup$ What format are you saving to? (this could be a result of premultiplied alpha, see blender.org/manual/glossary/index.html#term-alpha-channel) $\endgroup$ – gandalf3 Oct 3 '15 at 22:23
  • $\begingroup$ i have read about that but i can't for the life of me find an option to save straight alpha. i read somewhere that a recent update to blender decided to remove that option and do it automatically for you... idk?? i have tried saving in many formats, but i was hopinh for just using an 8 bit rgba png $\endgroup$ – jimjamjahaa Oct 3 '15 at 22:34
1
$\begingroup$

Strangely enough it appears to work if you convert to premultiplied alpha:

enter image description here

This messes up the RGB values in blender, but the exported png then works as desired. I'm not too sure why this works the way it does (I'd expect the opposite), but a lot of alpha handling in blender is rather odd..

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.