Trying to create a shadow map...

Hm, I think this goes here.

Hi all,

I’m trying to create a shadow map like in this image:

http://affu.dendezyn.net/plugins/p17_image_gallery/images/603.jpg

However, I don’t know what the hell to do! I’ve been plugging away for two (now THREE!) days now, with unsatisfactory results. I have BrayBaker installed, my model is already unwrapped, and I’ve fiddled with ico lights, two lamps, multiple spots, etc. Currently, BrayBaker is just giving me a black image for it’s render.

Any help’d be much appreciated!

Edit: Alright, I’m two inches to the left of “pissed off”. The only script I found that did what I wanted was JMS’ - and it exports an image that for me is 436x394, rendering it useless, as I need a 1024x1024 image, that is aligned with the UV. I could hand align them, but not only would it not be perfect (and fuzzy), I need a repeatable pipeline solution, since I’m applying this method to several models.

-Stefan-

Try use this script.
You can render to texture in yafray :slight_smile:

http://blenderartists.org/forum/showthread.php?t=43015&highlight=baker

I also want to do this. I have found a page that describes how to do it using radiosity. It also describes how to keep the radiosity solution from changing the mesh, and provides a script for transfering the vertex color data from the solved mesh back to your original unwrapped mesh. Looks really cool. Im going to try it a little later today. If you have any luck before I do please post your results.
http://vegastrike.sourceforge.net/wiki/HowTo:Radiosity_baking_in_Blender

Im having trouble with the script that copys the vertex colors. I’ll try it some more if I don’t get it ill post a question about it in the python section.

Attachments



Well, no luck yet. But jms has pointed me to a script he wrote that will copy the uv coordinates from the original mesh to the new one. I will give this a try. I guess copying UV coords is easier than copying vertex colors.
Anyways here is the link to the script he wrote.
http://jmsoler.free.fr/didacticiel/blender/tutor/py_uvcoord_copy_paste.htm
He also said that a script will be bundled in 2.42 that will do this.

Czarek - what’s the rendering to texture in Yafray you speak of? I don’t see how Yafray could create an uv map image of the shadows on the model.

Does anyone know how to get BrayBaker to output a smoothly shaded image? Right now it just gives me a set of shaded squares stuck onto the mapped areas.

Oh, and how do I make Texture Baker useful ? All it spits out is a view of a chunk of the bottom of my model.

-Stefan-

Hmmmmm…
It seems that the new mesh created by the radiosity solution keeps the UV coordinates of the old mesh. Even if the new mesh is broken up by a higher detailed solution (MaxEl>1). So… 4 hours later I realise all this was for nothing. So to answer the original question, using radiosity and the bundled Texture Baker script will create shadow maps! Remember to set MaxEl to 1 if you dont want the mesh to change at all, and turn on Vcolpaint in the material settings before baking.
This is a common problem when learning new things in Blender. Because of the vast amount of information out there, it is sometimes easy to get confused between older stuff and newer up-to-date stuff. Sorry if I cluttered up your thread I was only trying to help. Good luck
[Edit] Sorry I havent tried BrayBaker, but the included texture baker script works fine for me [/edit]

Attachments



When you use Texture Baker it spits out an image that matches your UV Map? o.0 How?!

Edit: OMGOMG PLEASE TELL ME HOW!!! </whiney>

And all help is always appreciated. :slight_smile:

-Stefan-

Yes it does this by default. After doing the radiosity solution on the model, open up the UV editor window and select all the UV points and click on the texture baker script. Choose the size and the name, and the texture will be rendered and stored in the /temp directory, fitting your UV layout.
Again, to get the radiosity solution to render to the texture, Vcolpaint has to be pressed in the object’s material buttons.
Also again, when doing a radiosity solution, be sure to set MaxEl to 1 if you want the new mesh to be exactly like the old one.

Following your instructions I get this:

http://www.maj.com/gallery/sastrei/BIN/tb_wrong.jpg

Edit: oops! it turned itself off after the script ran, but the mesh was in face mode and had the whole map selected in the uv editor (all dots yellow).

To the right is the render I got from Texture Baker, and to the left is the setup it was on when I hit the button.

-Stefan-

Does the image not match your UV layout? Ill run through it with some pictures gimme a second.

Here we go: Left is the setup I used when I ran the script, right is the (so-not-right) image I got:

http://www.maj.com/gallery/sastrei/BIN/tb_wrong2.jpg

ACK! I’m so close! It generated a mesh with my maps laid out, but they’re all smushed together and the camera isn’t set right to view them all.

-Stefan-

Hmm not sure what is going on there. I could take a look at the .blend file if you want? The texture baker has always rendered the textures exactly like my UV layout.
Edit: The uv maps have to all fit inside the borders in the UV window

Attachments



sigh Now it tells me the object has no coords.

I’m uploading the file, maybe you can render the bakes successfully. After a week solid of working on just this, I’m tired.

http://brickspace.net/files/jager_lighting.zip

Just use the mesh on that last (should be the active) layer, ignore the other ones.

-Stefan-

Man I’m sorry I can’t be any more help. I went to the script Texture Baker from the UV menu in the UV window and it rendered this image. I didn’t do anything else to it. It seems to be working fine for me.

Attachments


O.O BEAUTY!

Okay, so it works fine…hmmm I have Python installed…2.41…

Face mode>run script>replace>name>it renders and saves, right?

:confused:

-Stefan-

I don’t have python installed. I just opened the file, clicked on the UV tab in the UV window, and clicked on Texture Baker

OH SWEET MERCY IT WORKS!!!

The texture baker script was pointing to the wrong file, I must’ve been using the same install and it got changed around, or something.

Rendered it and worked beautifully, THANK YOU!!!

OH THANK GOD I CAN BREATHE AGAIN.

-Stefan-

Awesome. Sorry for all the confusion, I just learned, too. With all the old information out there sometimes it can get confusing. This would be a good tutorial.