Earth Night Lights

(bcaloia) #1

Hello, er…Blenderers…

This is my first post on these forums. I am a new blender user, having switched from 3dsMax. I have been learning and learning and such. I am trying to complete a realistic project of our earth, and I have had some real success so far (mostly following other tutorials). I have run into a problem…

I am using textures from BLUE MARBLE, and so far the earth looks really great. The problem I am having is trying to figure out a way to add earth lights (city lights at night) to the dark side of the planet, so that they fade in at the terminator of my main light and emit on the dark side (but not the lit side). Are there any tutorials for using energy ramps or other way to accomplish this?

B

0 Likes

(jezza) #2

Hi.
Just a suggestion and it might be a bit of a cheat but I just dl’d some great earth texture maps from here:

http://www.oera.net/How2/TextureMaps.htm

not that hot with belnder myself but i’d look at using some kind of mask map or something?
anyway, not much help i know but hope it points in the right direction.
cheers
j

0 Likes

(BlackBoe) #3

You can use material nodes, in fact. :] If you have your night-light map already, you could probably add another material(assuming that the light map is all black with lighter bits for the highlights) set to ‘shadeless’(full bright, in plain english), and use a mix node set to perform a ‘lighten’ image function on the two materials. If you’re having trouble following me, which would be understandable, considering that I’m bad at explaining stuff, I could make a demo file.

0 Likes

(jezza) #4

demo file would be good for me too. i just found the thread again to say its ‘in the nodes’, been playing with them trying to work it out but can’t figure it. and there you had it all along. yes, demo file would be great to help understand for me too.
much thanks
j

0 Likes

(bcaloia) #5

Would that require a seperate rendering pass, then an image composite? I ask, because I already use 2 seperate passes to integrate (er… composite) the atmosphere.

And… um… yea, a demo file would be great! Thanks.

B

0 Likes

(kernond) #6

You could create a new texture channel just for the night lights texture. On the Map To panel, set the Spec (you might also try Emit) option. Position a special Lamp (or whatever other type of light) that’s set to No Diffuse, No Ray Shadow. This light would simply be used to create the specular effects on the “night lights” texture as the Earth model rotates it within the light’s field. You might need more that one of these lights.

…that might work.

BTW, if the model is UV mapped, you could try creating a specular map with the same light setup.

0 Likes

(BlackBoe) #7

Ok, hopefully this–while crummy, will reasonably illustrate what I mean. Good luck with the earth model, by the way. :]

http://zombiedog.spindash.net/nightside_nodes.blend

0 Likes

(jezza) #8

sweet, thanks mate will have a dig into nodes today, thanks from me for the head start

0 Likes

(bcaloia) #9

Ok… Getting better results now… just wish I had more control at the terminus.

0 Likes

(BlackBoe) #10

That’s easy enough. Just stick a colour ramp in between the invert node and the strength input for the colour mixer node, and modify the gradient however you like.

Btw, if lighten doesn’t work for you, you can make it ‘screen’ or something else.

0 Likes

(bcaloia) #11

Um… Not sure what an invert node is…

B

0 Likes

(RamboBaby) #12

The invert node is only available in SVN. You can make your own invert node by adding a color ramp and reversing it’s color bands. You can get a SVN build here but not all builds have the node. Look for a build by Broken and it should contain the node (plus lots of other cool stuff):

www.graphicall.org

0 Likes

(bcaloia) #13

Thanks… wonder if you could post a blend to illustrate?

0 Likes

(RamboBaby) #14

Working on an animatable example now.

0 Likes

(RamboBaby) #15

I had to sit here and play with this for over an hour and it’s a bit difficult to map an image like this but it can be done. The result is a fairly advanced masking technique that works like a charm.

Anyway, I had to create 3 render layers to accomplish this task. The first thing that you need to understand when compositing with Blender is the type of information contained in the different render passes. e.g. There are only 3 passes which contain alpha channel information (Combined, Color, and UV). You can find all of the necessary information in the following link but don’t expect to understand all of it right off the bat. I had to reference this section for six months before all of it began making sense to me:

http://www.blender.org/development/release-logs/blender-243/render-passes/

Even the wiki does not contain information as useful as that when it comes to composite nodes and render passes. It will really help you in your future compositing endeavors.

First you’ll need to duplicate the Earth two times and put a copy of it on layer 1,layer 2, and layer 3. If you add an IPO to any one of these Earths make sure that that each Earth copy shares the IPO. Next make each coppie’s material single user. Now delete the textures form the coppies on layer 2 and 3. Make the copy on layer 3 Shadeless. Now you need to uv map the city lights to the Earth copy on layer 3. For this technique to work the image needs to contain an alpha channel that only allows the lights themselves to be visible. The reason for this will become obvious when it’s time to composite the render layers in the nodes compositor. Place your light source on layer 4.

Now it’s time to create your render layers. Render layers are quite different from scene layers in that they can contain objects from any combination of scene layers or from all or no scene layers. We will be reusing the light source on scene layer 4 in this fashion. If we did not place the light on it’s own layer then we would need to duplicate it for each scene layer which would just make the scene bloated and messy once it began to become complex.

First render layer(Atmosphere). The Earth with it’s uv mapped atmosphere on scene layer 1 and it’s light on scene layer 4. Disable all buttons on the Render Layer tab for this render layer except for Solid, Sky and Combined.

Second render layer (Diffuse). A diffuse only pass of the earth with NO textures on scene layer 2 and the light on scene layer 4.Disable all buttons on the Render Layer tab for this render layer except for Solid and Diff. This is important because we need the diffuse shading to help create a diffuse shading inverted mask which will casue the lights to vanish as the Earth rotates into the sunlight. If any texture information is included in the diffuse pass then this mask will not work.

Third render layer (City Lights). A color only pass of the earth with UV mapped lights via an RGBA texture on scene layer 3, set to Shadeless on the Material tab. With the Shadeless button set there is no need to use any lighting. Disable all buttons on the Render Layer tab for this render layer except for Solid and Col.

Now it’s time to set up the composite nodes. Add 2 render layers to the composite nodes default setup. Select each render layer to contain one each of the 3 render layers. Before setting up the composite nodes render the scene. This will fill the render layers with image information that you need to be able to see while working. Next add a Color Ramp node and reverse it’s color bands. Now plug the Color Pass from the City Lights Render layer into the this Color Ramp. This will create a grayscale inversion of the city lights image. This mask will be subtracted from the mask that we create in the next step in order to create an alpha channel that will ultimately hide the city lights whenever they encounter day light while revealing them on the dark side of the Earth. Plug te result of this Color Ramp into a Viewer Node. You should see a bunch of black holes where the lights would be and white everywhere else.

Now add another Color Ramp and plug the Diffuse pass from the Diffuse Only render layer into this ramp. Plug the result into a viewer node. You’ll notice that you now have a grayscale representation of the diffuse pass. Add a mix node to this Color Ramp, set it to Subtract and set the Value to 1.0. Now plug the Alpha socket of the Atmosphere render layer into the top image socket this Mix Node making sure that the Diffuse render layer Color Ramp is plugged into the bottom image socket. Plug the result of this mix node into a viewer node. What we are trying to do here is to create and inverted grayscale image that directly corresponds with the diffuse shading in the day to night transition. When looking at the result in the viewer node it is obvious that our current result doesn’t have nearly enough contrast. Start sliding the white color band of this second Color Ramp to the left until the viewer node reveals a fairly close yet inverted representation of the day to night transition. The final result should look like a crescent moon in the viewer node. I had to move the slider about 95% to the left to get the result I was looking for.

OK, were getting close now. Select the mix node and SHIFT+D to duplicate it. Plug the Diffuse pass’s Color Ramp result into the top image socket, the City Light’s Color Ramp into the bottom socket, and the result into a Viewer node. What you should be seeing now is white dots only in the area of the Earth’s dark side and black everywhere else. This is the final mask (alpha channel for the city lights) that we’ve been working toward. Add a Set Alpha node and Plug this mask into the alpha socket, then plug the Color pass from the City Lights render layer into the image socket. Add an Alpha Over node and plug the result of the Set Alpha node into it’s bottom image socket and the Image pass of the Atmosphere render layer into it’s top socket. Leave the value at 1.0. Finally plug the result of this node into the image socket of the Composite node. If your lights don’t fade quite at the right place then just tweek the Diffuse renderlayer’s Color Ramp (via the white color band) untill you get exactly what you’re looking for.

I hope I didn’t leave anything out. Just ask if any of this is unclear.

Attachments


0 Likes

(bcaloia) #16

Wow. Thanks. Ill dive into in in a day or so…

B

0 Likes

(bcaloia) #17

This is EXACTLY what I needed. Thanks for your effort, man!

B

0 Likes