- Home /
Lightweight shader doesn't properly apply to blender imported GameObjects
Hi !
Unity 2018.1 is out. I have created fresh shaders with the new Shader Graph tool. So far, it's very cool ! Next, I have created a new material to try out my new shader. All good so far. Finally, when I drag & drop my material on a freshly made Unity cube GameAsset, it works fine !
But when I drag & drop my material on a very basic asset I created & imported from Blender, the material from my fresh shader does NOT work. WHY ?
Here is a screenshot: - On the right, a cube with the working material. The cube is a basic Unity cube GameAsset. - On the Left, my game Asset on which I apply the very same material (on the turret & shield child objects - obviously not on the canon). It doesn't render properly.
Regarding technical questions :
This is under Unity 2018.1.0f2
The graphics parameters I have set are the "LightWeightPipelineAsset" (Edit -> Project Settings -> - Graphics -> Lightweight Pipeline Asset").
The Lightweights pipeline is installed via the Asset Manager and works fine.
The shader I created for my material is a PBR-type (Right click -> Create -> Shader -> PBR Graph)
I have tried the importing settings for the tank turret as "Import materials" unchecked. (I tried with checked too by the way..)
The imported item comes from Blender.
Here is the "graphical architecture" of my shader (very basic)
Has anyone an idea why it doesn't work on imported gameObjects ?
Cheers !
$$anonymous$$ay I suggest you use a different texture when testing your shader. Here is a google image search for "test texture mapping" just click and pick.
The advantage to using images like these for your shader texture are, they enable you to see issues with UV mapping clearly and quickly (which is where I suspect the problem lies, though not sure why)
HI ! thanks for the fast reply.
It doesn't look like this is the issue. See screenshot below.
I would disagree and say this appears to confirm UV mapping is the issue! I would suggest at this point you take a look at the mesh's UV array, at runtime, and Debug.Log it to the console. I'd bet that you will see all the same value for every element in the array. You can access the UV array using: (uncomplied, example only)
Vector2[] meshUVs = gameObject.GetComponenent < $$anonymous$$eshFilter >.shared$$anonymous$$esh.uv;
Alas, I still can offer no specific advice on resolving it. (thus a comment, not an answer)
Answer by Kciwsolb · May 11, 2018 at 05:43 PM
I am going to ask the obvious here for my answer, but we all forget sometimes so it is worth asking. Did you UV unwrap your imported object in Blender? If an object is not UV unwrapped, it will appear as one solid color. If it is not unwrapped, do so in Blender.
You guys are both right... I simply forgot my UV unwrapping !!!
$$anonymous$$illion thanks... I was looking somewhere else and would never have found it !
Ah! Glad someone who actually knows Blender chimed in ;)