[Plugin] Normal Map Maker

[Plugin] Normal Map Maker

Postby Chris Fullmer » Tue Dec 07, 2010 9:23 am

UPDATED: Now there is an actual plugin file to download and install thanks to Didier Bur.

Ok, here's a quick and dirty normal map maker. It will re-paint all selected faces with the color of their normal, then it changes the camera to top mode and exports an image. Unfortunately you will have to crop the image yourself. Please watch the video for a brief demonstration of how to use it.

This video shows an old version of the plugin that required pasting code into the Ruby console. That is no longer necessary. Now the plugin has a proper item in the plugins menu.


Here is a picture of the base geometry:
geometry.png


Here is the actual exported normal map that you need to crop down:
Normal.png
5
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Normal Map Maker

Postby Rich O Brien » Tue Dec 07, 2010 10:58 am

Chris that's excellent :thumb:

Nice pink background in SU too :shock:
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Normal Map Maker

Postby Pixero » Tue Dec 07, 2010 11:15 am

Dang. Though this is good, I for a moment thought you had found a way of SETTING the normal in SU.
Oh well, maybe in SU 12... :roll:
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: [Plugin] Normal Map Maker

Postby Chris Fullmer » Tue Dec 07, 2010 11:37 am

rclub24 wrote:Nice pink background in SU too :shock:


:) I normally just have a white background, but with edges off and having just a pure white geometry, I could not see my geometry, so I needed a background color. Pink seemed to fit the groovy "normal" colors well :)
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Normal Map Maker

Postby Gaieus » Tue Dec 07, 2010 11:48 am

:thumb: :thumb: :thumb:
Excellent, Chris! Thanks!
0
User avatar
Gaieus 
 

Re: [Plugin] Normal Map Maker

Postby Chris Fullmer » Tue Dec 07, 2010 11:50 am

Also, if people don't like copy and pasting code into the ruby console, I could further develop it to be a regular install plugin that goes into the menu system. Maybe if I get some free time. I prefer menu items personally.
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Normal Map Maker

Postby Gaieus » Tue Dec 07, 2010 11:53 am

You described an easy and excellent way to make b&W displacement/bump map in another topic (using a gradient black-to-white image projected sideways...).

If you ever develop this plugin into a menu item one, could you also include that option? (although true that it can easily be done simply manually, too).
0
User avatar
Gaieus 
 

Re: [Plugin] Normal Map Maker

Postby Rich O Brien » Tue Dec 07, 2010 11:56 am

+1 for menu

+1 for Gaieus suggestion

+1 for +1
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Normal Map Maker

Postby Panga » Tue Dec 07, 2010 12:26 pm

Thanks a lot Chris for this one. Hope you'll find some time to make a menu for this one...and +1 for the Gaieus suggestion.

Cheers.
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] Normal Map Maker

Postby Didier Bur » Tue Dec 07, 2010 9:20 pm

Hi,
Here is my contribution to this nice idea.
I hate commands in the console, etc, so I've made it a plugin.

It sets temporarily the display style without edges and edges profiles, resets it after the tool has ended.
It restore all the original materials of the faces and also purge unused materials.
You'll find the command under the File menu -> Export normal map

@Chris: I hope you don't mind me tweaking your script...

EDIT: modified on Dec. 8th 2010(menu option not working)
0
Last edited by Didier Bur on Wed Dec 08, 2010 6:24 pm, edited 1 time in total.
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Normal Map Maker

Postby Chris Fullmer » Tue Dec 07, 2010 10:21 pm

Great, thanks Didier! You added pretty much everything else I was hoping to get to later, just didn't have time at the moment. I can redo my video tutorial and stuff later when I get a chance. Hopefully tonight.

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Normal Map Maker

Postby honoluludesktop » Tue Dec 07, 2010 10:26 pm

Chris and Didier, Good work. This is a very neat function added to Sketchup's "bag of tricks".
0
User avatar
honoluludesktop 
In Remembrance
 

Re: [Plugin] Normal Map Maker

Postby notareal » Wed Dec 08, 2010 3:32 pm

Neat!
0
Welcome to try Thea Render, Thea support | kerkythea.net -team member

notareal 
Thea Render Support
Thea Render Support
 

Re: [Plugin] Normal Map Maker

Postby Gaieus » Wed Dec 08, 2010 3:35 pm

Thanks Didier, too! :thumb:
0
User avatar
Gaieus 
 

Re: [Plugin] Normal Map Maker

Postby Didier Bur » Wed Dec 08, 2010 6:28 pm

Hi,
Just edited the script and re-uploaded it, because the menu option was not working.
Sorry for the inconvenience,
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Normal Map Maker

Postby tomasz » Tue Jan 25, 2011 10:17 am

It is a nice step forward!

I was thinking about using TIG's Java solution and produce a PNG with proper aspect ratio and without modifying the original materials. I don't know how to calculate smooth normals over a whole face when an edge is smoothed in SU, but I bet it can be done.
0

tomasz 
SU2TH & SU2KT Developer
 

Re: [Plugin] Normal Map Maker

Postby TIG » Tue Jan 25, 2011 12:40 pm

I've been thinking about using a jar to mimic 'make_unique' for skewed textured materials etc as exporting these with correct UV mapping to tri-faces is not possible [or at least I don't know how to do it] - the way the built-in OBJ exporter copes is to make special versions of the texture image files that have non-exportable distorted UV-maps [from skewing etc] and then use those as a non-distorted image in the OBJ code... It's relatively easy to distort the width/height of an image in java BUT skewing is more tricky - but possible... e.g. http://www.jhlabs.com/ip/distorting.html and http://www.jhlabs.com/ip/filters/index.html or http://java.sun.com/products/java-media ... p.doc.html
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Normal Map Maker

Postby thomthom » Tue Jan 25, 2011 1:35 pm

TIG wrote:I've been thinking about using a jar to mimic 'make_unique' for skewed textured materials etc as exporting these with correct UV mapping to tri-faces is not possible [or at least I don't know how to do it] - the way the built-in OBJ exporter copes is to make special versions of the texture image files that have non-exportable distorted UV-maps [from skewing etc] and then use those as a non-distorted image in the OBJ code... It's relatively easy to distort the width/height of an image in java BUT skewing is more tricky - but possible... e.g. http://www.jhlabs.com/ip/distorting.html and http://www.jhlabs.com/ip/filters/index.html or http://java.sun.com/products/java-media ... p.doc.html


Sketchup::TextureWriter allows you to write out distorted images. If you load a face with distorted texture to the TW and write it out it'll save a modified version of it. Oddly enough, it doesn't seem to work the same way for skewed, scaled etc - then the texture is the original texture. :?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Normal Map Maker

Postby TIG » Tue Jan 25, 2011 3:29 pm

And it's the skewed one we want! :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Normal Map Maker

Postby thomthom » Tue Jan 25, 2011 3:33 pm

ah... :oops:

But a skewed texture only needs three co-ordinates - why are these troublesome for triangles?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Normal Map Maker

Postby TIG » Tue Jan 25, 2011 4:31 pm

thomthom wrote:ah... :oops:
But a skewed texture only needs tree co-ordinates - why are these troublesome for triangles?

Maybe I use the wrong wording... it's textures that are somehow rotated/skewed/sheared that need four UVs ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Normal Map Maker

Postby thomthom » Tue Jan 25, 2011 4:51 pm

Only distorted textures needs four points.

Normal size (based on material width and height): 1 point
Uniformly scaled: 2 points
Non-uniformly scaled: 3 points
Skewed - sheared: 3 points
Distorted: 4 points
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Normal Map Maker

Postby TIG » Tue Jan 25, 2011 5:50 pm

It's distorted then - do you mean that we CAN export these already using a TW and the material's actual face front-material?
If so, how do we 'know' a face has a 'distorted' texture as opposed to a 'skewed' or 'rotated' one ?
Let's say I have a face with a material that has its texture distorted and some other faces use that material 'undistorted'.
The material is exported 'undistorted' and used with most faces with the simple 3-point UV-mapping...
I need to know how to find which face has which type of texture, then if it's distorted then export that texture as a 'variant' using the TW with the very face, and then use that image-file for that face in the exported data.
Is this what the built-in OBJ-Exporter does when it makes distorted texture files for some faces...

The main issue is how do I tell if a face's material's texture is 'distorted' and needs this extra step... :?
It would greatly improve my OBJexporter and some 3rd party tools I am involved with...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Normal Map Maker

Postby AcesHigh » Wed Feb 02, 2011 4:06 pm

sorry for the stupid question but...

1 - whats the advantage of normal map over bump and displacement maps (both of which can use the same grayscale bitmap)?

2 - VRAY doesnt use normal maps, does it?
0

AcesHigh 
 

Re: [Plugin] Normal Map Maker

Postby thomthom » Wed Feb 02, 2011 4:15 pm

AcesHigh wrote:1 - whats the advantage of normal map over bump and displacement maps (both of which can use the same grayscale bitmap)?

http://www.spinquad.com/forums/showthre ... #post54371

a) is a bump map
b) is a parallax/normal map
c) is a relief map (normal map with self shadowing)

AcesHigh wrote:2 - VRAY doesnt use normal maps, does it?

Not sure what V-Ray 2 does - but the version V-Ray for SketchUp currently use doesn't.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Normal Map Maker

Postby tomasz » Wed Feb 02, 2011 8:22 pm

TIG wrote:The main issue is how do I tell if a face's material's texture is 'distorted' and needs this extra step... :?
It would greatly improve my OBJexporter and some 3rd party tools I am involved with...


http://forums.sketchucation.com/viewtopic.php?f=180&t=23947&hilit=distorted&start=60#p204899
0

tomasz 
SU2TH & SU2KT Developer
 

Re: [Plugin] Normal Map Maker

Postby Pixero » Wed Feb 02, 2011 8:45 pm

AcesHigh wrote:1 - whats the advantage of normal map over bump and displacement maps (both of which can use the same grayscale bitmap)?


A bumpmap is like: Hey, change your normal (surface direction) by this grayscale amount!
A normal map is more like: Yo, use this normal instead of your old one!
0
User avatar
Pixero 
Premium Member
Premium Member
 

Re: [Plugin] Normal Map Maker

Postby tspco » Sat Mar 19, 2011 2:34 pm

I just downloaded and installed this plugin, but it doesn't seem to work, I am sure I missed something, nothing shows up in the plugins menu. Anybody have a step by step?
0
SU make 2017, /Twilight Render Hobby
Windows 10,64bit,16GB ram, quad core Athlon 3.6 proc Hz. Anything else you want to know, ask me.

tspco 
 

Re: [Plugin] Normal Map Maker

Postby RepulsiveBoy » Sat Jan 21, 2012 11:07 pm

tspco wrote:I just downloaded and installed this plugin, but it doesn't seem to work, I am sure I missed something, nothing shows up in the plugins menu. Anybody have a step by step?

It doesn't work for me either :cry:
0

RepulsiveBoy 
 

Re: [Plugin] Normal Map Maker

Postby driven » Sun Jan 22, 2012 1:01 pm

hi, did you look in the right place?
UI.menu("File").add_item("Export normal map")
john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: Afgan, Google Bot and 16 guests

Visit our sponsors: