0
$\begingroup$

I installed the Blosm plugin and copied an area from Google Maps to Blender. But the area does not respond to the light in Render Mode,and also in the final render. Even when I try to connect to it principled BSDF in Nodes. How can it be made to react like a mesh or at least copy it to another surface that reacts to light, or another creative solution?enter image description here

$\endgroup$
4
  • $\begingroup$ There are so many reasons this could be happening… Are you sure there’s not another object there causing a Z fight? $\endgroup$
    – TheLabCat
    Commented 2 days ago
  • $\begingroup$ There are no other objects except the sun, here is the link to the file: drive.google.com/file/d/1UT0jblEigqWPe0wE_kz7ImrGOcu5Pp-T/… $\endgroup$
    – yair biton
    Commented 2 days ago
  • $\begingroup$ I'm not going to give my email address to get access to the file, make it freely available or better upload it here: blend-exchange.com and edit it into your question. Although you already seem to have an answer and might not care. I just cannot believe that a complex script is necessary to make it work in Blender. I never used Blosm, is the result something else than a mesh with a texture? If not, there must be other ways than scripting. Also the video linked below the answer seems to be about getting things into Unreal - is this actually about making it work in Blender or Unreal? $\endgroup$ Commented yesterday
  • $\begingroup$ Thanks for the response, I thought the link I sent was enough to download the file... If there are other easier solutions I'd love to know about them, but the file is too heavy to upload via the link you sent. In the meantime I managed. Regarding the video, its ultimate goal is to transfer the file to Unreal, but most of the video explains how to fix in Blender. $\endgroup$
    – yair biton
    Commented 22 hours ago

1 Answer 1

0
$\begingroup$

I had this issue, code to fix it below. I'll try to keep in touch as developing on it as we speak, but be sure to remove the right indent on that second line of code. Good Luck

import bpy

for mat in bpy.data.materials:
if not mat.use_nodes:
    continue
nodes = mat.node_tree.nodes
mix = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeMixShader)), None)
while mix is not None:
    nodes.remove(mix)
    mix = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeMixShader)), None)
emission = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeEmission)), None)
while emission is not None:
    nodes.remove(emission)
    emission = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeEmission)), None)
transparent = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeBsdfTransparent)), None)
while transparent is not None:
    nodes.remove(transparent)
    transparent = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeBsdfTransparent)), None)
light_path = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeLightPath)), None)
while light_path is not None:
    nodes.remove(light_path)
    light_path = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeLightPath)), None)
output = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeOutputMaterial)), None)
if output is None:
    continue
principled = nodes.new("ShaderNodeBsdfPrincipled")
principled.location = (output.location[0] - 400, output.location[1]+100)
mat.node_tree.links.new(principled.outputs[0], output.inputs[0])
texture = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeTexImage)), None)
if texture is None:
    continue
mat.node_tree.links.new(texture.outputs['Color'], principled.inputs['Base Color'])

Adds a value node and connects it to Specular with a value of 0.5.

valueA = nodes.new("ShaderNodeValue") 
valueA.location = (principled.location[0] - 200, principled.location[1]-200)
valueA.outputs[0].default_value = 0.5
mat.node_tree.links.new(valueA.outputs[0], principled.inputs['Metallic'])

Adds a value node and connects it to Roughness with a value of 0.5.

valueB = nodes.new("ShaderNodeValue")
valueB.location = (principled.location[0] - 200, principled.location[1]-300)
valueB.outputs[0].default_value = 0.5
mat.node_tree.links.new(valueB.outputs[0], principled.inputs['Roughness'])

Rename the material

mat.name = 'A_' + mat.name

Rename the the image

image_node = next((n for n in nodes if isinstance(n, bpy.types.ShaderNodeTexImage)), None)
if image_node is not None:
    image_node.image.name = 'A_' + image_node.image.name
New contributor
The Vision Tunnel is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
4
  • $\begingroup$ Thank you very much! It seems complicated, but I'll try. $\endgroup$
    – yair biton
    Commented 2 days ago
  • $\begingroup$ no worries if you can't get it to work the script is available in the description of the youtube video below. youtube.com/watch?v=7gi0-nVrsnM Once opening the link be sure to copy directly into your scripting console. Press enter twice to run script $\endgroup$ Commented 2 days ago
  • $\begingroup$ Thank you very much dear friend, it worked! $\endgroup$
    – yair biton
    Commented 2 days ago
  • $\begingroup$ wonderful! This took me a week to work out, have a happy new year! $\endgroup$ Commented 2 days ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .