Shadows when using PLSM2

SuperMegaMau

20-02-2007 04:59:16

I cant' get stencil or texture shadows to work when using PLSM2, If I use TSM or simply disable PSLM instead, I can see the them. I have no idea what's happening.

nindim

22-02-2007 17:26:04

Hi there, I have been able to get shadows working with PLSM2 but only the STENCIL_MODULATIVE variety. I only got it to work when using the PLSM2 SDK from Tuans site.

It seems though that the CVS release of the plugin doesnt work with shadows, at least not for me. My code is as follows:

mSceneMgr->setShadowTechnique (SHADOWTYPE_STENCIL_MODULATIVE);
ent->setCastShadows(true);

Just setting the shadow mode to use and then setting the entity to cast shadows. I'm pretty sure its not me. Anyone got a fix for the CVS version?

SuperMegaMau

22-02-2007 21:32:11

well, I'm using the CVS version, because I'm using terrain decals, and seems like the CVS version is the only one that supports this at the moment...

but that code you posted is the code needed to enable shadows...

tuan kuranes

24-02-2007 11:54:32

did you try all materials possible on PLSM2, with or withou vertex compression, etc... maybe some shaders makes it not working.

nindim

24-02-2007 18:01:48

I'm also using the CVS as I need support for the mesh decals, I'm using the PLSplattingShaderLit texturing method and dagon version of ogre.

Havent changed anything between the two builds, if I just replace the PLSM2 dll, shadows works (providing I remove the mesh decal code beforehand!) I'll try with a few different settings and report back the results.

nindim

24-02-2007 18:25:16

Hmm, have tested the texture modes listed below with or without vertex compression etc etc. Doesnt seem to make a difference, they wont show up.

TextureFormatSupported0=ImagePaging
TextureFormatSupported1=Base
TextureFormatSupported2=InstantBase
TextureFormatSupported3=Splatting
TextureFormatSupported4=Splatting5
TextureFormatSupported5=Splatting2
TextureFormatSupported6=Splatting7
TextureFormatSupported7=SplattingShader
TextureFormatSupported8=ImagePagingLight
TextureFormatSupported9=PLSplattingShaderLitDecompress
TextureFormatSupported10=PLSplattingShaderLit

Can anyone else confirm this is a bug or have other people got shadows working with the current CVS build?

nindim

25-02-2007 23:40:01

Should I post this in the bugs section of the forum? Not sure as I don't yet know if it's just something I'm doing wrong or if others have this problem as well.... Any feedback would be appreciated.

SuperMegaMau

26-02-2007 14:37:28

I made my own material, Just a texture that covers the whole map and a detail texture to tile, like ImagePaging, and disabled all the rest TextureFormat, and I made the shadows work this way.

nindim

26-02-2007 18:41:10

Hmmm, I'm sure I tried imagepaging and it didnt work, still though, having a lit and splatted terrain is pretty much a must for my game, anyone had any luck with the plsplattingshaderlit texture format and shadows, I know it is supposed to work....

SuperMegaMau

26-02-2007 23:49:57

I believe this shadows stuff is suposed to work with any of the TextureFormats given... This is probably a bug, but for now I'm good with my own TextureFormat(material).

nindim

27-02-2007 19:33:13

I compiled and ran the PLSM2 demo, as far as I can see only the textured shadows work, all others are broken (at least for me) for now.

I got the texture shadows working in my app with the PLSPLATTINGSHADERLIT texture format, turns out I just couldnt see the shadow as the "setShadowFarDistance" setoption variable was set too low. Increasing this made the shadows show up, the texrture size must then also be increased to make the shadows not look pixellated. Another problem is the when this type of shadowing is enabled parts of the terrain seem to disappear which doesnt happen when they are disabled. The only way i have found to rectify this is to set the setShadowFarDistance variable up quite high and set VisibleRenderables = 210 in my .cfg file.

My last problem is that I am using mesh decals for a cursor mapped to the terrain, when this mesh passes over the players shadow, it deisappears. The mesh has a depth bias of 1 set, is there a way for this type of shadowing to be applied to meshes? Or is it just terrain shadowing? I tried adding the line "receive_shadows on" to my mesh decal material in the pass bit but didnt make any difference.

kungfoomasta

27-02-2007 20:01:42

I had this problem before, hopefully this thread solves your problem:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=27892&highlight=render+queue+kungfoomasta

KungFooMasta

nindim

27-02-2007 20:35:47

Tanks a lot KungFooMasta, I set the decals moveable object to renderqueue 6 and that solved it. I can now see the shadow through the decal!

Now, is there a way to make texture shadows appear on other meshes?

On the wiki here: http://www.ogre3d.org/wiki/index.php/HowTo_(part_II)#How_to_get_some_shadows_in_your_scene

it says:

"
mSceneMgr->setShadowsTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);
mSceneMgr->setShadowsColor(0.5, 0.5, 0.5);
...
mLight->setCastShadows(true);
...
mCastingObject->setCastShadows(true);
mReceivingObject->setCastShadows(false);
...
myMaterial->setReceiveShadows(true);
...

Note that the instruction myMaterial->setReceiveShadows(true) can be replaced by receive_shadows on in the material file, at top level, or be omitted, as the default setting for material is ON. You can use this instruction to set the value to OFF for materials that should not receive shadows. This can save some framerate. "

This would lead me to believe that texture shadows can be prjected onto other meshes, but it says its turned on by defualt in the materials properties.

Texture shadows don't support self shadowing, but does this include other meshes? I'm a little confused!

asmo

01-03-2007 10:54:39

I have the following problems with shadows (any material.. splatting, PLShader etc):

With VisibleRenderables=2570
http://www.netherforce.com/images/highRenderlevel.jpg

With VisibleRenderables=257
http://www.netherforce.com/images/lowRenderlevel.jpg

If shadows is turned of, VisibleRenderables=257 works fine.

I'm using sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE); btw.

nindim

02-03-2007 02:27:49

I got stencil modulative shadows to "work", seems like it just doesnt work with directional light, changed it to point light and now its casting shadows.

Problem I'm having though is the shadow is absolutely pitch black with no texture detail at all.

Also,t he point light implemetation (Im using Per pixel but same for per vertex) in plsplattingshaderlit seems to do it on a per tile basis. Its not the normals as i have full lod for the whole map, Its annoying as I have to set the range to be quite far to get rid of the artifact. But if I do this the shadows from the point light continue way to far from the source light, and then they just go dead all of a sudden, maybe a way to fade them out like texture shadows, or are they supposed to do this already?

On a side note, I have been able to get some other meshes to show up correctly when in the shadow volume by moving them to render_queue 6, I assume this is because they are being rendered after the shadow, not sure though. Doesnt seem to work though for the the shadows cast by a model on the same model (self shadowing).

The actual shadow receivers code in the plsplattingshaderlit material dont actually seem to do anything, I removed the calls to it completely from all of the passes (ambient,directional and point) and the shadows still show up in the game (but just pitch black)

nindim

05-03-2007 21:47:01

The shadows were black due to the fact that I had my mesh decal set to use render_queue_group 6. Not setting this made the shadows a little less opaque. I knwo the mesh decals update the material used for the terrain so maybe updating it after the shadow had been rendered? Not too sure, looks ok now though, just the sudden curtting off of shadows is a bit of a problem.