16
2013
[AssetStore] Normal & Specular Map Generator from Texture
Working on simple poor man’s normal map & specular map generator editor script.. (click image to view full size)
Left side = original bitmap, Right side = generated normal map + specular map
*Github: https://github.com/unitycoder/NormalMapFromTexture
Asset Store: https://www.assetstore.unity3d.com/#!/content/10388?aid=1101lGti
Unity Forum Thread: http://forum.unity3d.com/threads/normal-map-maker.254310/
—
Features:
– Creates normal (bump) map from texture (works ok, with adjustable strength & optional blur filter)
– Basic Specular map calculation (on that main image specular map was handmade)
– If texture is not readable, set it automatically on for reading, then restore it to off
– User can cancel map generation (median filter can take a while on a big texture..)
Todo:
– Editor GUI
– Progress bar with cancel button
– Optimize image processing (using setpixel now, setpixels would be faster) (For now only in median filter)
– Try using invoke? then it runs in background in editor(?) (not this time..)
– Documentation
– Specular map generator is not good quality..maybe in later versions can do better
– Set created normal map as [x] normal map.. (so that “fix now” button wouldnt appear)
– Texture leak warning.. (it was from median filter temporary texture, it wasnt cleared with DestroyImmediate)
– Request: Invert normal button (also invidual X, Y, Z flip)
– Request: Realtime preview (adding small texture previews first)
– Bugfix: AssetPostprocessor doesnt always run.. (Temporary fix, comment out line “if (!NormalMapMaker.running) return;”
– Feature: Add maximum texture size inside AssetPostProcessor
Webplayer:
http://unitycoder.com/upload/demos/NormapMapMaker1/
Shader used on that image:
– BumpedSpecular With Separate Specular Map : http://answers.unity3d.com/questions/306921/add-specular-map-to-shader.html
– Added “#pragma exclude_renderers flash” to get rid off the shader warning..
Image credits:
Main image: CGTextures.com : http://www.cgtextures.com/texview.php?id=43972
—
Image#2: Ground ( http://www.cgtextures.com/texview.php?id=64716 )
<- Click to view
Image#3: Wood planks ( http://www.cgtextures.com/texview.php?id=36848 )
<- Click to view
Image#4: Plugin window
Related Posts
13 Comments + Add Comment
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
Awesome! Can’t wait…
Found this site from the Rival {Theory} forum.
This looks fantastic.
Great job.
Would love to try it out when its ready.
If i purchase source, i have full access to everything? what limitations are there on using it?
I’m currently trying to submit this to asset store.
Sorry about that, was waiting to update this post once/if it gets in..
Also note that there are much better solutions around, for example:
https://www.assetstore.unity3d.com/#/content/5687
http://u3d.as/content/jeremie-st-amand/quick-map/3oD
It got accepted, http://u3d.as/content/mgear/normal-map-maker/5bA ,
but I wouldn’t buy this if I’d need to do normal maps for anything serious.
Maybe it could be useful for taking the normal map creation part
and using it runtime..(for example doing online normal map generator, you give image url, webplayer loads the texture, creates normal map from it..)
Submitted v1.2 update: Includes runtime version for generating normal/specular maps. (also public methods for median filter, combineRGB+Specular into 1 texture)
could be useful, PVRTC encoder/decoder for Unity (free)
http://forum.unity3d.com/threads/pvrtc-encoder-decoder-c.276233/
[…] http://unitycoder.com/blog/2013/07/16/normal-specular-map-generator-from-texture/ […]
Hi
I import Asset and error this
Assets/Extensions/unitycoder_com/DemoRunTime/Scripts/NormalMapMakerRuntimeDemo.cs(35,12): error CS1061: Type `UnityEngine.Component’ does not contain a definition for `material’ and no extension method `material’ of type `UnityEngine.Component’ could be found. Are you missing an assembly reference?
How fix
Is it possible or have you looked into making this run async so it doesn’t clog up the main thread and cause the app to freeze while its waiting for the pixels to be read and set?
yes, the calculation could be easily done in another thread, especially in the runtime converter.
i copied the plugin source into github, if anyone wants to try forking it,
or if i get time to test this sometime later https://github.com/unitycoder/NormalMapFromTexture/issues/2
I’ve been playing around with running in another thread the issue for me has been Getpixels and Set Pixels needing to be done on the main thread for unity. I will keep diggin into how to try and store them before applying.
yeah, better use this to get data first, https://docs.unity3d.com/ScriptReference/Texture2D.GetRawTextureData.html (either one of those, and need to modify the processing loops to use native/bytearray also)