Shadow/Texture Bake ???

Morn’n Folks,

Recently – I’ve seen it mentioned on two different forums – 3DTrains and UKTrainsim – that one of the key features missing from 3DC is it’s ability to "Shadow Bake" a texture… Is this a big deal ??? Honestly – I haven’t a clue what it means… Is there a good PIX somewhere that will clearly illustrate the advantages of shadow baking ??? Finally – if it is important – any plans to add it in 3DC 9.x ???

Regards,
Scott

Like Scott, I’ve no idea what ‘shadow bake’ means. Nor ‘texture baking’ either…… I too would welcome a reference.

Thanks

John

Hi John,

Oh – yeah – one site did say "Shadow Bake" the other did say "Texture Bake"… I’m assuming it’s the same thing…

Regards,
Scott

It is actually, in my view, the most useful missing feature in 3DCrafter. If you wish to use the TrainLightMapwith Diffuse.fx shader, you need to be able to generate a shadow map which privides dynamic shadows for any scenery item (mostly used for close-up buildings) to give them a 3D look. Have a look at the tutorial on making a shed in ‘the art of railworks’, blog, and you can see the difference a shadow map can make . ( <!– m –><a class="postlink" href="http://the-art-of-rws.blogspot.com/2010_01_01_archive.html">http://the-art-of-rws.blogspot.com/2010 … chive.html</a><!– m –>). The shadow map is generated automatically in 3D Max and uses a second channel in the material editor but it cannot be used in a non diffuse slot in 3DCrafter. I believe that Blender also allows for the creation of shadow maps, but I have never been able to get my head around Blender. Of course, the same effect can be obtained by adding shading in strategic places to diffuse textures with Photoshop, but its much more difficult to achieve good results unless you have a very good and artistic eye. Almost all of the default scenery in Railworks includes shadow maps.

BFM

Hi BFM,

Wow – very helpful… Looks like I have a lot to learn with Railworks… While I have Alpha’s with Transparency and Translucency down – this seems like a whole new world… I guess all this stuff only applies to Railworks and has no use in MSTS ???

Let me see if I got this… Big picture – Texture Baking – is like running your model though POV-Ray or some rendering software that intruduces light and shadow – then saving the resulting shadows to the model shape file itself – not the actual texture ??? Is that about it ???

I also liked the examples on light poles… I’m sure I’m not the only one that thought those silly cones of light from street lamps in MSTS were always pretty weak… In Railworks – the lights still won’t light up objects that come in range – will it ???

Thanks for the help…

Regards,
Scott

Not quite. The process does not affect the model. Rather a second texture is generated (‘baked’) which contains the shadows and this is superimposed on the model on top of the normal diffuse texture (this may not be a technically correct description of what happens). The actual textures look like old black and white negatives. If you open (with RW-Tools and a viewer) any Kuju texture with _sm (shadow map) at the end, you can see what shadow maps look like. They often bear little or no resemblance to the original diffuse texture.

BFM

Hi BFM,

Ahh – I think I have it now – you were a BIG help – greatly appreciate the assist…

So while 3DCanvas does have a light and shadow capability – we don’t have any means to save the shadow map – make it a texture – or – apply it to the model afterwards…

Regards,
Scott

This is something I’d really like to do. I think it would be quite interesting. I’d guess it will be in 9.2, whenever that is. I have some other things to implement first.

Sorry about the long post. <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

Creating the shadow and highlight detail on models is one of my favorite passtimes, this is what brings the model to life, IMO. Without shadows and highlights models tend to look very flat and washed out.
I’ve tried just about every method available, so here are some of my thoughts on the subject.

The possibilities are….
1) Texture baking
2) Light mapping/Shadow mapping
3) Real time shadows
4) Paint the shadow/highlight detail onto the model textures.

I’ll run through these methods briefly but the thing you MUST keep in mind is that you CAN’T USE ANY OF THESE METHODS ON ANIMATED PARTS.
So whilst you can create shadows/highlights on the main structure of say, a locomotive, you can’t create them for the wheels and con rods etc. More on this later.

With methods 1 and 2 you need an app that allows you to load in your model and set up the lights to create the shadows/highlights. You then export the model to your required file format.
Some of the high end 3D models apps do have these options, but at a price.
You can use a stand alone app like Gile, which is now free, for lightmapping.
Which ever way you go you need to make sure you can export your model to your required file format, this could be a problem.
If Richard can create a lightmap feature this would be the best bet as he would no doubt be able to make all the train sim formats available.
But don’t be put off by all this, read on…..

1) Texture Baking…
This is the oldest method of creating shadows on 3D models and isn’t used much now that lightmapping is available. It’s a term that is often mis-used I think to include just about every method of shadow creation.
With Texture Baking a SECOND set of textures are generated, onto which the shadow detail is added.
Suppose you have a model of a building and you apply and scale a 256×256 texture of a floor tile onto the floor area.
The app that is doing the texture baking couldn’t possibly create all the shadows on your 256x 256 texture so it generates a second, much larger texture of the whole floor area, onto which the shadows are generated.
So the downside is…This is very memory intensive method, although it can produce quite good results.

2) Light mapping/Shadow Mapping…
This is the best of the first two methods by a long way.
A second texture is created, called a lightmap, which is then (sort of) wrapped around all the faces of your model by the Lightmapping app.
You set up the lights, make adjustments to texures (depending on the app) click Render and the Lightmapper will generate the lightmap which contains all the shadow/highlight detail created by the lights you set up.
Lightmaps are nearly always black through grey to white, although some apps do allow for coloured light maps.
Giles
does this so you can set up coloured lights. Deepest shadows are black, highest highlights are white.
You then export the model an the lightmap is exported with it.
No real downside to this method, in fact most lightmappers allow you to adjust both the size and the number of lightmaps which is very helpful.
If the lightmaps is to small you get very poor shadows with jagged edges.
More on creating lightmaps here…

<!– l –><a class="postlink-local" href="http://amabilis.com/forum/viewtopic.php?f=20&amp;t=11093">viewtopic.php?f=20&amp;t=11093</a>&lt;!– l –>

<!– l –><a class="postlink-local" href="http://amabilis.com/forum/viewtopic.php?f=20&amp;t=1109">viewtopic.php?f=20&amp;t=1109</a>&lt;!– l –>

3) Real time shadows…
This method isn’t even in the running, it’s used by most of the train sims and game industry to create a flattened shadow model of say your locomotive and rolling stock which is then used to simulate a shadow cast onto say a terrain.
You can’t use this method to create shading for your model because you need certain parts of your loco to cast shadows onto other parts of your loco. The cab roof needs to cast a shadow onto the cab floor etc.
This method won’t do this, so forget it for now, maybe in the future…who knows.

4) Use your artistic abilities to create the shading/highlights
Without doubt, the best method of all as things stand at the moment.
Yes it’s a bit more time consuming creating the textures but it’s not that difficult once you get the hang of things.
All you need is a decent paint app with a layers feature. A Dodge and Burn or Light and darken brush.
Then loads of practice…

[img:2ljldd1h]http&#58;//img98&#46;imageshack&#46;us/img98/6892/newhall1md7&#46;jpg[/img:2ljldd1h]

I’ve posted this pic elsewhere on the forums but it’s here again as an example.
There AREN’T ANY LIGHTS in this scene to create the shadows and hightlights.
They are all created directly onto the textures in my paint app.

So to get this sort of effect…..
The underside of your boiler texture needs shading, a highlight something like the one here and a shadow for the handrail.

The boiler would cast a shadow onto the the footplate so apply some shading to the footplate texture.
Note the shadow on the lower part of the footplate where the smokebox overhangs the footplate. I had to create a seperate texture for this part of the footplate so I could apply the shading.

If you have outside cylinders the cylnder covers need shading a bit like the boiler texture.

The loco wheels have a dark texture applied to the inner rim and the inner sides of the spokes, also don’t forget the back of any wheels would look very dark.

Highlights are applied to all moving parts, con rods, piston rods etc.

Note the shading on the top of the driving wheels, this is a cheat, because you can’t apply the shading the footplate would cast to the wheel texture, if you did, as the wheel turned so would the shading. <!– s:oops: –><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed" /><!– s:oops: –>
This is why you can’t lightmap or texture bake animations.
I used a basic cube, deleted the top and bottom faces, scaled it so it fitted just outside the wheels, applied a dark texture to it then adjusted the transparency so I could just see the top of the wheel.
Note I haven’t got round to doing the front bogie in the same way, note the difference.

Some of the textures used for the above loco.
[img:2ljldd1h]http&#58;//img14&#46;imageshack&#46;us/img14/4100/shadetextures&#46;jpg[/img:2ljldd1h]

Anyway thats enough of my ramblings.

Bazza

Hi Bazza

Thanks for that! As a genuine novice at this – especially in the area of textures – I’d imagined that the term ‘baking’ implied something much more complex or arcane.

Impressive details on the textures.

Cheers

John

Bazza, Thank you for your fine efforts to help new comers like myself.

I have read through your tutorials, and using a much simpler model than your example, I successfully created a light map for the model. I am not clear on how to assign the light map back to the model, export as .x and then reimport back into 3DC with the lightmap included. This of course would be necessary if I were to export the lightmapped model into RailWorks as an igs model with the new textures.

Can you point me in the right direction here?

@ John13
Pleased you found it helpful, I’ll see if I can get round to some more hints and tips for textures sometime.

@ Dick8299
How did you create the lightmap, did you use Gile?
The bad news is that at the moment 3DC doesn’t support lightmaps so you can’t import the model back into 3DC with the lightmap attached.

Bazza

Yes, I used Giles and I was afraid that you were going to say that 3DC is not compatible. Hopefully something will happen with 3DC9.

Hi Bazza,

Just one last thought for shadows… While not perfect – I’ve got pretty good results using Alpha Channel gradient shadow boxes… I used several around the base of the entire locomotive and tender to darken the lower half of the models in a somewhat convincing manner… Low end video cards have some substantial banding – but – mine handles it pretty well…

[img:1gzzct1i]http&#58;//img&#46;photobucket&#46;com/albums/v304/scottb613/TS/ScreenShot012&#46;jpg[/img:1gzzct1i]

Regards,
Scott

Hi Scott,
Yes a good idea, thats the better way I think, the gradient on the ‘shadow’ looks much better.
Probably the major downside to all these visual texture improvements is that once you get one loco loooking good, it stands out like a sore thumb, so you then have to do all your other loco’s.
Then your rolling stock needs doing, then your buildings…… <!– s:roll: –><img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes" /><!– s:roll: –>

@ Anyone else wanting lightmaps for train sims
As Gile is now free maybe it’s possible to write an exporter plugin so you can export your models directly from Gile.
Gile
does have a plugin system just like 3DC so you can write your own exporter.
Maybe someone on your train sim forum, with a knowledge of file formats could help.

However, the better way would be to export back into 3DC.
Even if you could import the model into 3DC without the lightmap being displayed, should do, but you would still need either Richard or Paul to rewrite the exporters.

However try to avoid using .x file format….read on
If you tried to export a model WITH A LIGHTMAP from either Gile
or 3DC using the .x file format you would need extra work when importing into your train sim or any other 3D Engine.
When you export as a .x file, it creates two models, one carries the texture information the other the lightmap information and you need to blend these two models together in the 3D engine.
This isn’t a Gile
or a 3DC export problem, it’s the way the .x files work…crap really.

Maybe Richard could comment.
Using Gile
with an exporter to 3DC may be a quicker option for the time being.

Bazza

You must be logged in to reply in this thread.

18 posts