SketchUcation Plugin Store

 

 

[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
Please, register (free) to access all the attachments on the forums.
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6680
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

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:
:::Blog:::

I'm a Trimbler now!
User avatar
Rich O Brien
Administrator
 
Posts: 8273
Joined: Fri Oct 31, 2008 9:05 am
Location: Limerick, Ireland
Name: Rich O'Brien
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Advanced

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:
User avatar
Pixero
Premium Member
Premium Member
 
Posts: 1284
Joined: Wed Nov 14, 2007 2:58 pm
Location: Halmstad, Sweden
Name: Jan Sandström
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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 :)
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6680
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: [Plugin] Normal Map Maker

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

:thumb: :thumb: :thumb:
Excellent, Chris! Thanks!
Gai...
User avatar
Gaieus
Administrator
 
Posts: 27605
Joined: Sat Oct 20, 2007 8:24 am
Location: Pécs, Hungary
Name: Csaba Pozsárkó
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: historical reconstruction
Level of SketchUp: Advanced

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.
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6680
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

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).
Gai...
User avatar
Gaieus
Administrator
 
Posts: 27605
Joined: Sat Oct 20, 2007 8:24 am
Location: Pécs, Hungary
Name: Csaba Pozsárkó
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: historical reconstruction
Level of SketchUp: Advanced

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
:::Blog:::

I'm a Trimbler now!
User avatar
Rich O Brien
Administrator
 
Posts: 8273
Joined: Fri Oct 31, 2008 9:05 am
Location: Limerick, Ireland
Name: Rich O'Brien
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Advanced

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.
Panga
Premium Member
Premium Member
 
Posts: 357
Joined: Fri Dec 14, 2007 11:04 am
Location: FRANCE

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)
Please, register (free) to access all the attachments on the forums.
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
 
Posts: 1238
Joined: Wed Nov 14, 2007 10:07 pm
Location: Nancy, France
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6680
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

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".
User avatar
honoluludesktop
In Remembrance
 
Posts: 2219
Joined: Fri Sep 12, 2008 12:08 am
Location: Hawaii

Re: [Plugin] Normal Map Maker

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

Neat!
Welcome to try Thea Render, Thea support | kerkythea.net -team member
notareal
Thea Render
 
Posts: 946
Joined: Tue Nov 13, 2007 9:54 pm
Location: Oulu, Finland
Name: notareal

Re: [Plugin] Normal Map Maker

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

Thanks Didier, too! :thumb:
Gai...
User avatar
Gaieus
Administrator
 
Posts: 27605
Joined: Sat Oct 20, 2007 8:24 am
Location: Pécs, Hungary
Name: Csaba Pozsárkó
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: historical reconstruction
Level of SketchUp: Advanced

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,
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur
 
Posts: 1238
Joined: Wed Nov 14, 2007 10:07 pm
Location: Nancy, France
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.
tomasz
SU2TH & SU2KT Developer
 
Posts: 768
Joined: Fri Nov 16, 2007 8:46 pm
Location: Poland
Name: Tomasz
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
TIG
User avatar
TIG
Global Moderator
 
Posts: 13927
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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. :?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17556
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] Normal Map Maker

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

And it's the skewed one we want! :roll:
TIG
User avatar
TIG
Global Moderator
 
Posts: 13927
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17556
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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 ?
TIG
User avatar
TIG
Global Moderator
 
Posts: 13927
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17556
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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...
TIG
User avatar
TIG
Global Moderator
 
Posts: 13927
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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?
AcesHigh
 
Posts: 428
Joined: Wed Mar 05, 2008 1:58 pm

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.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17556
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
tomasz
SU2TH & SU2KT Developer
 
Posts: 768
Joined: Fri Nov 16, 2007 8:46 pm
Location: Poland
Name: Tomasz
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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!
User avatar
Pixero
Premium Member
Premium Member
 
Posts: 1284
Joined: Wed Nov 14, 2007 2:58 pm
Location: Halmstad, Sweden
Name: Jan Sandström
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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?
tspco
 
Posts: 208
Joined: Tue Mar 09, 2010 12:15 am
Name: Ryan

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:
RepulsiveBoy
 
Posts: 1
Joined: Sat Jan 21, 2012 6:12 pm

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
driven
Top SketchUcator
 
Posts: 1409
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 8
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Not a Premium Member yet? Check out the great time-limited deal we are offering.

Ad Machine
Robot
 
Posts: 2012

Next

Return to Plugins

Who is online

Users browsing this forum: c2phace, dyustin, mvit, yuridomingos and 7 guests