- Home /
Texture Render Error - black color only
Hi Guys,
I created a png with a cross (tic tac toe). And I imported it and created a material attached with it.
But the texture shown in unity 3d is all black which results when I dragged material to the cube, it's also rendering all black.
This png file has alpha channel, the background is transparent (edited, earlier it said doesn't have any alpha channel)
What should I do to correct it?
Thanks in advance.
What kind of shader do you use? The builtin diffuse shader should work for textures.
How are your import settings for the png? $$anonymous$$ake sure texture type is set to texture.
If it is not the default cube make sure the UV map is set correctly.
The preview is (from my experience) not always to be trusted but it might be worth the efford to check if the png got saved correctly into your assets folder . Doubleclick the png in the inspector to open it with an external program to check.
I use the diffuse, shader for my material. And my texture type is Texture. I did check with external program see if I did anything wrong before that. I thought I didn't save properly, so i cropped and make sure it's 256 pixel by 256 pixel. I'm using default cube.
How do I check the UV $$anonymous$$apping in unity?
It has to due with the alpha channel.
It seems that when I click the button under preview section, beside the $$anonymous$$IP setting, when it's in A rect mode, ( I believe it is alpha mode, please correct me if i'm wrong)
the cross become white, and the background black.
I fix it by selecting the shader to transparent/diffuse, and it works fine.
I always believe diffuse will auto include transparent alpha property for us. but I guess i'm wrong. :)
Thanks @Lockstep!
btw, I still want to ask you, how do I check UV mapping in unity? I only know how to check it in maya etc.
P.S. I will post a new answer below (short ver) for others.
I believe that you would need an additional plugin for the unity editor to show uv maps. Ther has already been a question concerning this: http://answers.unity3d.com/questions/17252/any-way-to-change-uv-mapping.html.
One more thing: Could you accept your own answer as solution? Just to keep things sorted.
Thanks, yes I can select my own answer as solution. Should I?
Answer by moonLite · Sep 23, 2012 at 05:32 PM
The above picture has alpha channel. and the background is supposed to be transparent.
Hence, by using Transparent/diffuse to the material's shader, it will do the job. Don't use diffuse, it doesn't apply the alpha property to material.
Answer by alandgfr · Jul 07, 2017 at 11:25 AM
https://www.youtube.com/watch?v=rn4mmIchgvA find answer here
Answer by swredcam · Jul 01, 2020 at 06:36 PM
I had a similar problem -- black image texture when using lighting in the Scene window or when running game. My issue turned out to be a lack of lighting UVs for objects I had created myself in Blender. The fix was easy -- on the model import in the Inspector, click the Model tab and click "Generate Lightmap UV". Then hit "apply" at the bottom of the Inspector window. I then had to replace my model in the scene -- basically copy the coordinates of the old one, delete the old one, add a new one from my Project window, and then paste in the coordinates from the old one. No more black image.
Answer by ShajithaMhd · Jan 05, 2021 at 08:23 AM
I got rid of a similar issue by adding the directional light to the current scene. Right click -> Light -> Directional Light, and transform it accordingly. Now the object showed up with the material applied.
Your answer
Follow this Question
Related Questions
Texture render performance - one 1024px, vs two 512px - for modular models? 1 Answer
Render Texture in Scene 1 Answer
Something about Render Texture Transparent.. 2 Answers
Render Texture in Render Texture not Rendering? 0 Answers
How to render a filled circle in a shader given a vertex and radius 0 Answers