Jul
16
2013

[AssetStore] Normal & Specular Map Generator from Texture

poormans_normal_specular_map_generator_unity3d
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 )
unity3d_normal_map_bump_generator_ground_2<- Click to view

Image#3: Wood planks ( http://www.cgtextures.com/texview.php?id=36848 )
unity3d_normal_map_generator_plugin_wood1<- Click to view

Image#4: Plugin window
normal_map_maker_plugin


13 Comments + Add Comment

  • 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?

  • 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/

  • 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.

Leave a comment to 3D Realisation: Map Types List Bibliography | Twiknight

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.