How can I change the color of a glass object?

I’m really new to Blender, but I got a pretty specific question. I have made a glass pyramid and it looks great with a white background. I want to export the object as a PNG so I removed the background. But the object is made out of glass, so the color changes significantly. How can I get the beautiful colors without adding a white background? I hope that the picture makes it more clear.

The color of the pyramid with the background on is what I want, but I also want a transparent background. Hope someone can help me out!

Thanks for the fast response! I’m using cycles so that’s good. It works when I tweak the color a bit but it is not really the same unfortunately. Do you have another idea? Once again thanks for the help, appreciate it.

you’re right, my bad :wink:

Your problem is that the white background is seen through the glass and obviously contributes to the colour.

The simple way round this would be to render with the white background save the image and then edit it in gimp or photoshop etc.

Give the image an alpha layer select the white and delete it!

If that gives you problems with Anti-aliasing on the edges of the pyramid, instead of deleting the white in Gimp you could go to colour menu, chose colour to alpha (white to alpha) and that will give you a result similar to Blender when you render with «film transparent». Then select the transparent background and invert the selection, create a new layer underneath your pyramid and fill the selection with white. You will have the result you are after.

I think you could do this with masks and things in blender compositor but it would be much quiker to use Gimp.

The problem is that I want to use this render as an animation and as a still image. It is pretty easy for one image but not for a lot of images. Isn’t there a way to place a solid white color behind the object or with nodes?

After a bit of thought it is actually pretty easy, Make a large plane to use as a white background and give it a material as shown in the example, with the light path node the plain is not visible to the camera but its colour does effect the pyramid. Render with the film-transparent option. If you want to move the camera around instead of a plane behind the pyramid use a sphere large enough to en-globe you scene.

edit; note the mix node that mixes the white colour with the transparent node using the light path as a factor.

1 Like

If you use a sphere turn off shadow in object properties visibility - ray visibility

great I tried with the Light Path node but didn’t do it the right way :wink:

What was the problem?
Sorry I just realized you meant that you switched the inputs

I used the Transparent Depth output of the Light Path

I think this is it! I did exactly what you did and the colors were not the same but after changing the emission color to white on the principled BSDF node it worked! I’m rendering the image now. If it works I’ll mark this as the solution.

Thank you so much for your help (and moonboots as well!)

You are welcome, in my example i lit the white background plane with the sun lamp to get it white, your emission method is good that way it is white always independent of the lighting, you could also substitute the principled shader for a simple emission shader with the value at 1.

1 Like