![]() ![]() In the node editor set your world nodes like this: One of the solutions sure is to compose it later in the compositor, but I came with an idea (or maybe I've read or seen it somewhere and just passing it along) to divide illumination between foreground and background in the scene itself. If you don't mind me coming up with a 'somehow dirty' solution, I had to deal with the same situation a while back and this is what I used:īasically every time you change the background color it also changes the global or ambient illumination of the scene (as was mentioned before). When you encounter problem in your file then, you will notice the moment when it went wrong with more ease and find solutions faster. ![]() So just paste the script into Blender and run it.Ī tip: If you are having a problem with anything, it never hurts to try things on a new blank file and get a feel for how a thing behaves. At this moment, you can adjust the Translate parameters manually to select a different pixel (Alt+V and V to zoom the backdrop in and out). If you click it in the Compositor (and you have backdrop enabled and you have rendered the image already) you will see a cross on the screen, pointing to the selected pixel in the backdrop. It isn't necessarily pixel precise so choose a general area. Target_x and target_y is used to select the pixel from which a color for the background is picked. T_node = (type='CompositorNodeTranslate') Mix_node = (type='CompositorNodeMixRGB')Īf_node = (type='CompositorNodeDilateErode') #_attach_remove_on_cancel(TRANSFORM_OT_translate=) #_node(type="CompositorNodeMixRGB", use_transform=True) Render_h = .resolution_y * render_pīpy._transparent = True #note that it is not necessarily exact so it may be about +-4px (too lazy to do the math correctly) #select the point in pixels from which the background color will be selected I found a way to setup the whole thing with Python and was eager to try it out, so here is the code. Now the background color will adjust automatically. Then you scale the image by large amount (so that the whole image is made up of this one pixel) and you plug that into the first Image input of the Mix node. You basically use the Translate node to move the pixel of the image, that you want to grab the background color from, to the middle of the screen. You can get very close to this behavior without using Python with this node setup: You would need to look at the rendered image, the way is described here, and determine what the background color is, then set the color on the Mix node to that value. You could actually do this in python so that python script sets the color. Now for the last question, how to do this in python (I assume to automate this). Note however that the color of the plane might change if you add a light source or even an object (again due to the way light works). Now each time you render, the background will be this color. Here is a visualisation of what the Feather filter does to the alpha channel: In the compositor you will need to apply a Feather (Dilatate/Erode - mode: Feather) filter to the alpha channel, before plugging it into the Mix node.įeel free to adjust the Distance value (Note that it can be both positive and negative). ![]() You will notice the border line, where the plane ends, which is probably undesired and can be fixed by further utilization of the Compositor. You can precisely set the color of the background by checking the color of a rendered image (right click on rendered image to see RGB values), or kind-of automatically (below). Set the desired color of the background on the first Image input of Mix node and finally route the output of Mix node to Image input of Composite node. Go to Compositor (Compositing workspace), tick Use nodes, add a Mix node and route RenderLayers Image output into the bottom Image input of Mix node and Alpha otput of RenderLayers into Fac input of Mix node. Go to Propetries panel > Render > Film and tick the Transparent box. Now the way how to achieve what has mentioned is following. (And the fact that background is not just a color). The reason, why the colors of other objects change, when you change background color is beacause the way light works. As mentioned by you will need to add the color in compositor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |