Topic: Experimental - shader based shadows

dezGusty on December 05, 2011, 02:35:09 PM

dezGusty

  • Artists
  • Full Member
  • *
  • Posts: 245
  • Karma: +8/-0
    • View Profile
Hello everyone,

I think I finally got the shadows figured out. I have managed to implement them in a scene in my test application, based on one of the Ogre forum "Soft-shadows" implementation. I guess I'll be able to start bringing some functionality in the game in one of the following weekends.

So far, it's looking good. There are some issues with scaling the items that should receive shadows (they don't quite display correctly, but it's still a vast improvement over the current form).

Among the amusing things that I discovered along the way:
- I must be careful when declaring variables, as I tend to default to int, instead of float. This means I was using full black or full white shadow colour for a couple of days without understanding why is this Ogre engine simply not working. As most often, the problem was a ... how should I put this nicely... insufficiently intelligent user.
- one should use either SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED or SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED as shadow mode.
- one MUST use a shadow camera setup, and it must be used in accordance with the used lights and the shadow technique.
- one must use a "shadow caster" material based on shaders.
- one must use all materials that should receive shadows based on a "shadow receiver" material based on shaders.
- one must be careful when using lights. Just because you (or I) think that a light has a certain direction it doesn't mean that it really is so.
- maybe (not sure yet), the shadow texture count per light must be specified. Need to check if it's 100% required.

- a working combination was : FocusedShadowCameraSetup with a directional light, 4 shadow textures and the shaders from here: http://www.ogre3d.org/tikiwiki/Depth+Shadow+Mapping&structure=Cookbook
Logged
  • Read 2524 times
  • Category Graphics
Comments: 5

greengecko on December 05, 2011, 05:10:43 PM
Reply #1

greengecko

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Looks nice already.
Seems like thereĀ“ll maybe be a christmas present. ;)
Logged

fusion44 on December 06, 2011, 07:15:20 PM
Reply #2

fusion44

  • Administrator
  • Sr. Member
  • *****
  • Posts: 459
  • Karma: +10/-0
    • View Profile
Looking great! I had a testapp with a different camera setup, wich worked well in the testapp but translating to Sumwars was not working correctly.
If this doesn't work correctly we'll have to try and look at how our meshes are built. I think there maybe a problem with them.
Logged

dezGusty on December 07, 2011, 08:13:30 PM
Reply #3

dezGusty

  • Artists
  • Full Member
  • *
  • Posts: 245
  • Karma: +8/-0
    • View Profile
I tried using the meshes and they produced shadow results. The only problem is the detail; most meshes are very small. Shadows for them tend to be pixelated, as scaling them seems to produce artifacts.

I made a branch named material-system-056 here: https://bitbucket.org/sumwars/sumwars-code/src/492ea9fc96e6

I think I brought over all your changes from the fork, but I can't be sure... please double check this to be sure.
Logged

fusion44 on December 12, 2011, 09:28:47 PM
Reply #4

fusion44

  • Administrator
  • Sr. Member
  • *****
  • Posts: 459
  • Karma: +10/-0
    • View Profile
Hey dezGusty,

any idea when you'll be available on irc? Looking great so far!
Logged

dezGusty on December 12, 2011, 09:57:57 PM
Reply #5

dezGusty

  • Artists
  • Full Member
  • *
  • Posts: 245
  • Karma: +8/-0
    • View Profile
Hi fusion, I'll try to be online in the following 2 days.
Sorry for the lack of updates;
- I have been trying to apply the shadows to the game materials;
- ran into problems with transparency;
- then finally decided to give the RT Shader System another shot.
I was pretty much against it at first... because... The SDK version is buggy (crashing on my ATi card), but the Ogre trunk version (based on 1.8) works great. I just wish I didn't have to install and compile and build something like 6GB of data. In theory, this should be the easiest to implement.
Logged