[Plugin] Color by Z (Updated August 27th, 2009)

[Plugin] Color by Z (Updated August 27th, 2009)

Postby Chris Fullmer » Sat Feb 14, 2009 12:27 am

This plugin will prompt you to enter two colors by inputing the RGB values. It will then paint all faces in the model according to their elevation (Z height). The first color will be applied to the highest elevations and the second color will be applied to the lowest elevations. It works by finding the coordinates of the center of the face. It will paint only what you have selected, or everything if you don't have anything selected. It will not paint groups or components or edges.

In the image, I entered green for my first color and blue for my second color. So the high peaks are green and the low points are blue and the script assigns the colors in between.

color by z.jpg


I've discovered that the script runs slow sometimes and its because it creates so many new materials. So sorry about that. I can't think of any way to get around that.

The script can be downloaded from smustard.com here:

http://www.smustard.com/script/ColorByZ

UPDATES:
v1.0 - The original
v1.1 - working out a few little bugs - as always.
v1.3 - Changed where it loads itself - under Plugins>Chris FUllmer Tools>Color by Z

Chris
0
Last edited by Chris Fullmer on Tue Mar 10, 2009 9:27 am, edited 3 times in total.
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] Color by Z

Postby spence » Sat Feb 14, 2009 12:41 am

Hey this is pretty cool. I can see this being very useful when I have a DTM and need to better understand the high and low points, I think that would work anyway. I need to try it out.
0
Spence
User avatar
spence 
Premium Member
Premium Member
 

Re: [Plugin] Color by Z

Postby xrok1 » Sat Feb 14, 2009 12:55 am

it would be cool to combine this script with the component spray tool as a pre-vis for the altitude settings. :idea:
0
“There are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

http://www.Twilightrender.com try it!

xrok1 
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 1:11 am

I was definitely thinking of DTM's and DEM's etc when I was thinking about how it should work. I've got a lot of ideas as to how to improve it in the future, but this is a good start I think.

Chris

PS I re-uploaded it right now. You might need to re-install it.

moutains by z.jpg
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] Color by Z

Postby kwistenbiebel » Sat Feb 14, 2009 1:24 am

Wow. You are making really cool plugins, Chris !

Almost Rhino's Grasshopper.
It would be great to also have a plugin that lets you pick a point in a flat (or curved) surface and a gradient will made from that point, like magnetic points. Moving the point, will shift the color gradient. Very useful for lakes and grass areas. But also for some wicked material use on facades etc...
0

kwistenbiebel 
 

Re: [Plugin] Color by Z

Postby pilou » Sat Feb 14, 2009 2:10 am

"Undfined method file loaded for main object!" :o
so no ruby :)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 2:39 am

Hmm, its working just fine for me. I just installed it on a fresh machine, not the one I created it on.

Could you copy the entire text from the ruby console? Thanks Pilou, you've been a die-hard script tester for me! Sorry they never seem to work for you on the first try :)

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] Color by Z

Postby pilou » Sat Feb 14, 2009 2:48 am

I can't open the ruby console it's at the start of the prog!
I must press OK and no ruby and no ruby console possible before! ;)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 3:22 am

Aha! I think I forgot to add "require 'sketchup.rb'" to the top of the file. And I think that is the problem. Try the current version. THanks,

Chris
0
Last edited by Chris Fullmer on Sat Feb 14, 2009 9:19 am, edited 1 time in total.
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] Color by Z

Postby JClements » Sat Feb 14, 2009 5:22 am

Chris, Super Idea and Implementation.

I can definitely see where this would help when "Use Sun for Shading" doesn't produce desired shading nuances.

Many thanks for coming up with this!

If you select a group, is it able to act on all surfaces within that group?



Regards, John
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 5:33 am

Thanks John and all!

For now, it does not work on groups by design (and because I haven't made a plugin that drills down into groups, so I would have to learn how). But I made it so it would leave all groups alone because I didn't think it would be desireable to have it re-paint your trees and buildings and things.

I suppose once I get it able to drill down into groups, I could just put in a prompt asking if you want it to work on groups and components. That would probably be a good solution.

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] Color by Z

Postby JClements » Sat Feb 14, 2009 5:57 am

Hi Chris, again.

Other ideas:

1. enable the script to "remember" the settings last used during the same SU session.
2. save the settings in to a library (each "style" would be saved a record in a text file).
3. call up the color wheel dialog

And OMG, is Mt Hood going following in the foot steps of Mt St. Helens?
Mt Hood gone Active Vulcanic AGAIN.jpg


EDIT: 14 Feb 09
Here is the skp , Chris. It may be that I didn't input the same values for the two terrains. It is geolocated, it will take you back to Mt. Hood in GE.
0
Last edited by JClements on Sat Feb 14, 2009 7:00 pm, edited 1 time in total.
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 6:57 am

Thanks Coen! This script was a good challenge for me, so I'm glad I got it to work at all!

John, those are great ideas. I'll have to look into how to implement them. I know I can get the color palette in this one too easy enough, but I can't get it to remember colors very well or to give it my own starting colors. If I could figure that out, then it would be super easy to save chosen color schemes and re-use them. Maybe Ill contact the guy who developed the SU color palette and see if he can give me any tips on how to use it better.

Anyhow, thanks for using it. I'm interested in you image though John. You have some unexpected coloration going I think. It looks like you have patches of light color moving up into higher elevations and a single color crosing over onto multiple faces. I'd be interested in seeing that file maybe. Thanks!

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] Color by Z

Postby kwistenbiebel » Sat Feb 14, 2009 7:09 am

I know in SU7 you can 'make a texture unique'.
Unfortunaly I am on SU 6. Is there a workaround to get it in SU 6 as well?
It would be great to be able to make a unique (projected) texture out of the mesh produced by Color by Z...

Keep up the good work! That city/terrain greebler is going to be a blast when you will have finished all the needed rubies.
We have a new ruby master :thumb:
0

kwistenbiebel 
 

Re: [Plugin] Color by Z

Postby Fletch » Sat Feb 14, 2009 7:49 am

Looks cool, Chris!

maybe we should just update the first post w/ new versions as it get confusing to try to follow if one has the most up-to-date version or not...

thanks for sharing and this is a great ruby idea!
0

Fletch 
Twilight Render
 

Re: [Plugin] Color by Z

Postby MALAISE » Sat Feb 14, 2009 8:31 am

I'm definitively fascinated by the way you produce so many plugins. :D
MALAISE :thumb: ................. :thumb:
0
La Connaissance n'a de valeur que partagée
User avatar
MALAISE 
 

Re: [Plugin] Color by Z

Postby Pixero » Sat Feb 14, 2009 11:12 am

I've experimented with something similar in the past but gave up because I didnt find a way of getting a smooth gradient. Colors are applied to every polygon and not the UV values. Also it resulted in a "LOT" of color swatches in the material browser. Is there a way of applying colors but not having them added to the materials? And is there a way of using the UV values to get a smooth gradient?
0
User avatar
Pixero 
 

Re: [Plugin] Color by Z

Postby pilou » Sat Feb 14, 2009 11:32 am

Works now! ;) :enlight:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Color by Z

Postby Heven7_floor » Sat Feb 14, 2009 11:35 am

Thanks Chris , your creation is still very cool and fantastic, :thumb: :thumb: my model is look better now
0

Heven7_floor 
 

Re: [Plugin] Color by Z

Postby kwistenbiebel » Sat Feb 14, 2009 11:41 am

Pixero wrote:I've experimented with something similar in the past but gave up because I didnt find a way of getting a smooth gradient. Colors are applied to every polygon and not the UV values. Also it resulted in a "LOT" of color swatches in the material browser. Is there a way of applying colors but not having them added to the materials? And is there a way of using the UV values to get a smooth gradient?


Yes, that is exactly what the new SU 7 feature 'Make unique texture' does. It makes one big gradient texture to project on your geometry.
If you go to the other plugin thread by chris (Random Color Select), he demonstrates this feauture in his proof of concept video in the first post.

Since I don't use SU 7 (various reasons, the handicapped component browser is one of them), I truely miss that 'make texture unique' option. :?
0

kwistenbiebel 
 

Re: [Plugin] Color by Z

Postby Daniel S » Sat Feb 14, 2009 12:06 pm

SU7 has an option called Combine Textures (The Combine Textures menu item combines separate textures on adjacent co-planar faces into a single larger texture. This feature also, optionally, removes edges between co-planar faces to reduce the polygon count for the model as a whole. Context-click on multiple selected parallel faces, with at least one face having a texture, and select Combine Textures to create a texture which is unique to that set of faces.)
This is a great tool, but it will be more usefull if it`s extended into curved surfaces. This Color by Z or the Tools On Surface are examples of plugins that will be benefit.

Daniel S
0

Daniel S 
 

Re: [Plugin] Color by Z

Postby Pixero » Sat Feb 14, 2009 1:47 pm

I still don't get a smooth gradient. :?
0
User avatar
Pixero 
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 5:32 pm

The way to get a smooth gradient is to make a material in photoshop that is a big smooth gradient. Then bring it into your model and turn it so it is standing vertical next to your model. Set it to "Projected". THen select all of the land for it to be applied to and apply it to your model. You'll get all faces nicely mapped with a single image.

I just don't know how to do all that in one clean ruby unfortunately. So painting each face its own material is the closest I can get for now :)

gradient z color.jpg


And with the combine textures bit....theres a HUGE downside to that. While it works great in that video I did, it only works on planar faces. So to get it to work on something like this, I would need to create a flat version of my terrain mesh, then apply all my materials to it, then run combine textures, then re-apply the new textuire onto my non-flattened terrain. So thats not terribly smooth either.

But it is what it is. Hopefully this script will be helpful for someone :)

Chris
1
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] Color by Z

Postby Pixero » Sat Feb 14, 2009 6:23 pm

The script idea I played with was to apply different colors based on slope and the side projected gradient doesnt work for that. :(
Texturing is another area in SU we could wish for improvements in.
0
User avatar
Pixero 
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 6:56 pm

Ahh, tis true! If you wanted to do slopes as gradients, then you're out of luck. The only possible workaround I can think of is to use the subdivide scrip to subdivide faces into a tone of smaller faces. Then apply a single color to each face. Then somehow turn the whole thing into a single material and re-apply it to the pre-subdivided mesh. But I have a feeling that is 1. beyond the scope of Ruby and 2. probably just not very efficient and would be better suited for another 3d modeler? Maybe someone like Al's team could write an entirely separate app that reads the SU model and does all that work with the UV and gradients, and then sticks the model back into SU.

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] Color by Z

Postby JClements » Sat Feb 14, 2009 7:03 pm

Chris, .skp was added to my previous posting.
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 7:09 pm

Cool, thanks John. I see it now. There is some overlapping geometry that I couldn't see in the image. That accounts for the coloration working the way it is. Thanks John!

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] Color by Z

Postby JClements » Sat Feb 14, 2009 8:05 pm

It never occurred to me to project a gradient color onto a terrain, great idea.

Mt Hood gone Active Vulcanic AGAIN 2.jpg


However, I do project gradient transparency along with gradient color onto a single surface to make arrow-shaped objects and "swooshes" that indicate direction or motion.

Gradient Arrow in SKP.jpg
0
Last edited by JClements on Sun Feb 15, 2009 9:41 pm, edited 2 times in total.
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Color by Z

Postby xrok1 » Sat Feb 14, 2009 8:15 pm

maybe a better direction for this would be to create a plug that creates 'real' gradient textures based on the height of geo in a scene. they could then be projected manually or auto matically based on a plane that is created with a similiar prcess to a section plane?
0
“There are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

http://www.Twilightrender.com try it!

xrok1 
 

Re: [Plugin] Color by Z

Postby Chris Fullmer » Sat Feb 14, 2009 8:23 pm

THats a nice arrow their John. It took me a while to find it on the image, but once I clicked on the image to expand it, it all made sense. Very nice. And your mountain looks great too! It works out really nice with white at the top that changes quickly into a brown and works its way down to give a nice snow capped mountain appearance :)

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
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 28 guests

Visit our sponsors: