Graphics card: 2x 2080TI
(2.79b f4dc9f9d68b, blender2.79b, 2018-03-22)
(2.80, a280867ac2ed, blender2.8, 2019-03-07, as found on the splash screen)
I have models (.blend files) that were created in 2.79 cycles. When attempting to open them in 2.8 I see some nodes are reconfigured, 2.79a (where Displacement was a scalar socket) and 2.8 (where Displacement is a Vector), Blender automatically replaces the "RGB to BW" node connected to the material output with a proper normalmap displacement node setup.
However, unlike opening, instead, when appending from that same file, 2.8 will not reconfigure the shaders, It retains the same node configuration as from 2.79 resulting in displacement looking blocky and incorrect: https://i.stack.imgur.com/LrXpx.png
Here is my StackOverflow [[ https://blender.stackexchange.com/questions/133779/find-any-node-connected-to-a-materials-displacement-input-and-replace-it-with-a/133918#133918 | post ]] explaining in more detail and with images of the node configurations.
Also, I was able to write a script that can be run just after appending objects into the scene. It will replace the nodes linked to the Material Output node with a proper displacement node setup. This resembles the way it would have been converted as if the object were opened instead of being appended.
# -*- coding: utf-8 -*-
__author__ = "Grant Olsen (2019)"
__credits__ = ["Rich Sedman", "batFinger"]
__version__ = "2.0.0"
"""Given a material this will search for any RBG to BW nodes that are connected to a Material Output's Displacement input.
If the RBG to BW node exists then this will create the proper Displacenment map node setup and link it to the
RGB to BW node.
Explanation: this function takes one arguments: `mat`.
`mat` is type bpy.types.Material and is the material for the object
to be checked for any RBG to BW nodes connected to the Material Output node.
Will replace with proper normal map node setup.
The return type is `None`.
if mat is None:# an object can have an empty material slot where slot.material is None
return #nothing to process
for link in mat.node_tree.links: #loop over all node links for this material.
if type(link.to_node) is bpy.types.ShaderNodeOutputMaterial: #check if this node is connected to the type: "Output Material" node
if link.to_socket.identifier == 'Displacement': #check if this node is connected to the "Displacemnent" input
if type(link.from_node) is bpy.types.ShaderNodeRGBToBW: #finally, is the child node an "RGB to BW" type node?
bwNode = link.from_node #the RGB to BW node
dNode = mat.node_tree.nodes.new('ShaderNodeDisplacement') #newly created Displacement Node
mat.node_tree.links.new(dNode.inputs['Height'], bwNode.outputs['Val']) #connect the RGB to BW node to the Displacement node
mat.node_tree.links.new(link.to_socket, dNode.outputs['Displacement']) #connect the Displacement node to the Material Output node
"""Loop through all objects in the scene, and for each object's material slot, passing it to Check_Material.
if __name__ == '__main__':
for mat in bpy.data.materials: #get list of materials, will save fixing same material for each object
#for ob in bpy.data.objects: #get list of objects
# for slot in ob.material_slots:
**Exact steps for others to reproduce the error**
1. Start Blender 2.79 and switch it to Cycles mode.
2. Select the default cube and edit it's material.
3. Switch to node editor.
4. Add Image texture (with a normalmap.png as the input texture).
5. Add a RGB to BW node.
6. Connect the "image texture" to input of "RGB to BW".
7. Connect "RGB to BW" output to "Material Output" displacement input.
9. Start Blender 2.80.
10. Open the file (the one just created in 2.79).
11. Look at the shader nodes and notice how it was just converted and Blender 2.8 added a Displacement node:
> Image Texture > RGB to BW > Displacement > Material Output
12. Start Blender 2.8 (again)
13. Append the cube object from the same file.
14. Notice how the nodes still remain as:
> Image Texture > RGB to BW > Material Output