- Home /
Normalmap/bumpmap on runtime from www.texture?
Please can anyone enlight me if this is possible? I would like to generate normal map from downloaded texture to minimize bandwidth usage. I know that generating from diffuse texture is quality compromise but I can live with that..
I solved MIPMAP generation already. Source:unitianswers
var www:WWW = new WWW (url);
yield www;
Debug.Log("Converting to MIPMAPS");
var tex1 = www.texture;
var tex2 = new Texture2D(tex1.width, tex1.height);
tex2.SetPixels(tex1.GetPixels());
tex2.Apply(true);
Debug.Log("Converting DONE");
Searching forums was no help. Doc's neither.
Anyone solved this? SEARCHING FOR NORMALMAP FROM DIFFUSE
Answer by Eric5h5 · Jan 08, 2011 at 08:25 PM
You don't need to use GetPixels/SetPixels like that to make mipmaps; just create a texture first and then use LoadImageIntoTexture. There isn't any quality compromise, unless you're using jpeg instead of png. And yes, a normalmap is a texture like any other texture, so it's possible. I don't see how this is "minimizing bandwidth usage" though.
Hi Eric, I want to create normal map like in editor from downloaded color[diffuse] texture. Hence bandwith saving. Cause it is 300+ textures I want to make normal map on the fly from downloaded data.. Not to download separate normal map after diffuse is my goal. Should be easy but I need to point in right direction.
I see...I thought you were talking about downloading normal maps.
Answer by Noise crime · Jan 08, 2011 at 10:45 PM
There are shaders that can create a normal map from a diffuse texture map, from memory there is one in AMD(ATI) RenderMonkey, but sure you can find plenty of other examples online.
So one method (I guess you need Unity Pro for this though), is to use the shader with renderToTexture to generate your normal mapped textures at runtime. This should be very fast compared to get/set pixel.
Alternatively you can use get/set pixel and simply convert the shader code into javascript/c#.
Edit: You might find this page useful for obtaining better quality normalmap data.
Thank You. Yep know that link I will try to find suitable shader to converting to javascript.. If you already know about such one can post link here for speed up.
As I mentioned I'm pretty sure A$$anonymous$$D/ATI Render$$anonymous$$onkey has a normalmap generation script in it, used it myself in the past. Rendermonkey is a free shader editor released by ATI, well worth having around I$$anonymous$$HO.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094623im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Importing and configuring Normal Maps at runtime ? 2 Answers
Normals on procedural mesh 0 Answers
export normal texture at runtime 2 Answers
Bumped Lightmapped not working? 1 Answer
Bump mapping procedural mesh. 1 Answer