Jump to content

Bake alpha shadows


Zak Kozlov
 Share

You are about to reply to a thread that has been inactive for 4162 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello!

 

Alright i'm sure this is a quite simple question but maybe i'm bad looking in google, i didnt found the answer hehe and i only have experience with simple Ambient Occlusion baking

 

I start to work on my store that should be real simple but modular

So i'm making a brick division that should have shadow on wall

 

it look like this, i'm sure you'll get the idea

http://i.imgur.com/vzKfJ.png

 

As you can see i need the shadow on the back to be baked alpha

I looked up google on that, only to find some place saying straightup that AO dont support that, and others saying to enable Z Transparency in materials ( which didnt helped )

 

So i'm clueless

Anyone can point me to how i can achieve the wanted result ?

 

Thanks alot! :)

 

edit; I forgot to mention i'm using Blender hehe

Link to comment
Share on other sites

Here's how I usually do it:

1.  In your modeling program, create a plane, and put it behind or under the model, depending on whether you're creating a wall shadow or a floor shadow.

2.  Put a pure white material on the plane.

3.  Light the scene, and bake the plane's texture.

4.  Bring the baked texture into Photoshop, invert the colors, and use it is the alpha channel of a pure white image.  Save as 32-bit TGA.

5.  In SL, upload the image, and tint it the appropriate color to look like a convincing shadow on whatever surface it will sit in front of/on top of.

With this method, you don't have to bother with any unusual render settings in your modeling program.  The rendering itself is super fast, since all you're doing is putting shading on a white surface.  It also gives you a ton of added control, in post.  You can control the intensity of the shadow in two ways.  One is by adjusting the levels and/or brightness/contrast in Photoshop, during step 4.  The other is to change the transparency setting in SL, after step 5.

Fast, easy. Enjoy. :)

  • Like 2
Link to comment
Share on other sites


Zak Kozlov wrote:

That work great thank you
:)

I had to ask a friend who know some more about alpha layers than me in photoshop hehe

 

once you know how this solution is just perfect

 

Thanks alot
:)

*give you a bag of gummybears *

Can you tell me exactly what you did in Photoshop please as I am having problems with this too. 

Thanks :matte-motes-big-grin:

Link to comment
Share on other sites


Swobbly Minogue wrote:

Can you tell me exactly what you did in Photoshop please as I am having problems with this too. 

Thanks :matte-motes-big-grin:

 

Here's how i do it:

 

Open image and invert colors ( CTRL+I )

Go in the channel tab and right click duplicate one of those. name it Alpha

Reselect RGB and go back to the Layer tab

Paint the whole image in black

Save this as TGA w Alpha

Do an happy dance

  • Like 1
Link to comment
Share on other sites


Masami Kuramoto wrote:


Zak Kozlov wrote:

edit; I forgot to mention i'm using Blender hehe

screen1.png


 

Hmm i'm not sure if i'm missing something but I have put those exact settings and gave it a try

baking AO bring the same result, baking shadow bring a plain black texture

Link to comment
Share on other sites


Zak Kozlov wrote:

Here's how i do it:

 

Open image and invert colors ( CTRL+I )

Go in the channel tab and right click duplicate one of those. name it Alpha

Reselect RGB and go back to the Layer tab

Paint the whole image in black

Save this as TGA w Alpha

Do an happy dance

I'd recommend filling the image with white, not black.  That way, you can tint it any color you want, once it's in SL.  Shadows are not always black, after all.  In most cases, in fact, they're not.  A shadow on a colored surface is a deeper shade of the same color.  It's not until light becomes absent entirely that it actually turns black.

Also, just so you know, duplicating one of the channels isn't always the most versitile or convenient solution for creating the alpha channel.  Often, it's better to copy the layer, and paste into the new channel.

Link to comment
Share on other sites


Chosen Few wrote:

 

I'd recommend filling the image with white, not black.  That way, you can tint it any color you want, once it's in SL.  Shadows are not always black, after all.  In most cases, in fact, they're not.  A shadow on a colored surface is a deeper shade of the same color.  It's not until light becomes absent entirely that it actually turns black.

Also, just so you know, duplicating one of the channels isn't always the most versitile or convenient solution for creating the alpha channel.  Often, it's better to copy the layer, and paste into the new channel.

You are right, i'm gonna paint it white

 

As i said i dont really know how to deal with channels and had to ask how to do it to friend, i'm doing it the way he told me

 

How exactly would i copy the layer in a new channel ?

I dont see any copy options from layer to channel

Link to comment
Share on other sites


Zak Kozlov wrote:

Hmm i'm not sure if i'm missing something but I have put those exact settings and gave it a try

baking AO bring the same result, baking shadow bring a plain black texture

You must bake in "full render" mode, and your target image must be of type RGBA, not RGB. To see the baked transparency in the UV/image editor, you must enable a view mode that includes the alpha channel, otherwise you'll see a plain black texture.

Link to comment
Share on other sites


Zak Kozlov wrote:

How exactly would i copy the layer in a new channel ?

Just like you would copy the layer to a new layer. Select the layer (ctrl-a) then copy it (ctrl-c). If there is no alpha channel present, create a new channel, this will be the alpha channel by default. paste your layer in the new channel (ctrl-v).

Link to comment
Share on other sites


Zak Kozlov wrote:

As i said i dont really know how to deal with channels and had to ask how to do it to friend, i'm doing it the way he told me

 

How exactly would i copy the layer in a new channel ?

I dont see any copy options from layer to channel


Do what Kwak said. :)

Just so you understand, this isn't really so much a Photoshop thing as just a basic computer use 101 thing.  Copy and Paste are pretty much universal functions across the whole of your computer.  If you want to copy from any one thing to any other thing, simply select the first thing, press ctrl-c, then go to the second thing, and press ctrl-v.  As long as the two things in question use the same kind of data in the same kind of way, it will always work.

Most of us never give this a second thought when it comes to copying and pasting text.  Just about everybody at some point during a typical day will do things like copy text from web page and paste it into a Word document, or copy text from Notepad and paste it into an E-mail, or copy text from a spreadsheet and paste it into a database, or... you get the idea.  We all just kind of instinctively realize that text is portable, and can be moved from any place to any other place, no problem.

Well, the same exact concept also applies to just about every other kind of information your computer uses.  In the case of copying from a layer to channel, the data happens to be pixels, rather than text, but the principle is exactly the same.  You can copy pixels from any bitmap in any application, and paste those pixels into any other bitmap in the same application, or even another application.  Try this:  Select some imagery in Photoshop, press ctrl-c, then go into MS Paint, and press ctrl-v.  You'll see the exact same imagery appear in Paint that was in Photoshop.  Again, as long as both places use the same kind of data in the same kind of way, it will work.

It doesn't stop with just bitmaps, by the way.  It will work with vectors, too.  Create a shape from Bezier curves in Illusrator.  Select the curves, press ctrl-c, then go into MS Word, and press ctrl-v.  The shape will appear in your Word document.   This is because Word happens to have Bezier drawing tools built in.

In each example, although the applications all have different sets of tools, the data that those tools act upon is the same.  In the case of a layer vs. a channel, they're both just bitmaps.  The fact that they happen to be utilized for different purposes in the construction of more complex imagery doesn't change that. Copying & pasting from one to the other is no different from any other copying & pasting you'll ever do.

 

Hopefully, now that you're aware of this concept, your brain will be a little closer to stepping past the sort of hesitent thinking that lets it scare itself into saying things like "I don't really know how to deal with channels".   It's all the same stuff. :)

 

Link to comment
Share on other sites

Thank you!

 

Yes of course CTRLC/V was the first thing i tried, even before i ask my friend how i could do this

 

But when i was doing so i had marquee tool activated, CTRL+Click the layer to select it and CTRL+C while still the marquee tool was selected, so it was copying nothing i suppose

 

seem that it was the problem, i tried now taking care of having the move tool activated when i copy and it worked just fine :)

Link to comment
Share on other sites


Zak Kozlov wrote:

You are right, i'm gonna paint it white

Not sure what that is good for since shadows always subtract from the base color, never add to it, but then again, you can still do the same thing faster without leaving Blender:

 

  1. Create a material, set its diffuse color to white and enable the "shadeless" option.
  2. Create another material and enable its "shadows only" option.
  3. Connect the material nodes as shown in the picture below.
  4. Bake your texture.

screen2.png

Link to comment
Share on other sites


Masami Kuramoto wrote:

Not sure what that is good for since shadows always subtract from the base color, never add to it

That's true if you're talkinga bout a real shadow, that is actually on the same surface that the base color is on.  However, when you're just faking it by parking a translucent plane in front the colored surface, the effect isn't necessarily subtractive.

 

Thanks for the info on the shader setup.  Good stuff.

Link to comment
Share on other sites


Chosen Few wrote:


Masami Kuramoto wrote:

Not sure what that is good for since shadows always subtract from the base color, never add to it

That's true if you're talkinga bout a real shadow, that is actually on the same surface that the base color is on.  However, when you're just faking it by parking a translucent plane in front the colored surface, the effect isn't necessarily subtractive.

It is always subtractive only if the shadow plane is black. Which was kind of my point there.

Of course, if we had proper lightmapping on the shader level, colored shadow maps would make a lot of sense (as shown here). But that feature isn't coming to SL any time soon, and there is no way to fake it with tinted shadow planes.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4162 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...