self receiving shadow on create manual

gangwism

08-05-2015 09:50:23

Hey *,

I got a question concerning the use of different shadowtechniques in combination with a manually created mesh.
It seems that ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE; with normal closed polygons works really nice, such that I get a nice shadow.

My Problem is with the use of a manually created mesh which is not closed and should somehow represent the underlying terrain.
And exactly for this mesh I want to get shadow on this mesh which got casted by the mesh itself! (So some shadowed parts in the terrain which are shaded.)

If I use the ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE; I get some artifacts, like these parallel lines (see screenshot).
Below the terrain I have a shadow receiving ground plane...

Maybe you have an idea what I'm doing wrong? :-)

Have a nice day!
- Marcel

Beauty

10-05-2015 18:00:35

Hi gangwism,

welcome to our Mogre world.

I don't know much about shadow techniques, but have an idea:
Try to define normal vectors for each vertex (which are perpendicular to the neighbour triangles).
This is needed for good shading. Maybe it's also related to shadows.

You can define them for ManualObjects by the ManualObject.Normal() methods.
For the calculation you can use helper methods from the Math class.

Math.CalculateFaceNormal(Mogre.Vector3,Mogre.Vector3,Mogre.Vector3)
......... Calculate a face normal, including the w component which is the offset from the origin.

Math.CalculateBasicFaceNormal(Mogre.Vector3,Mogre.Vector3,Mogre.Vector3)
......... Calculate a face normal, no w-information.

Math.CalculateFaceNormalWithoutNormalize(Mogre.Vector3,Mogre.Vector3,Mogre.Vector3)
......... Calculate a face normal without normalize, including the w component which is the offset from the origin.

Math.CalculateBasicFaceNormalWithoutNormalize(Mogre.Vector3,Mogre.Vector3,Mogre.Vector3)
......... Calculate a face normal without normalize, no w-information.

For more information look to the Ogre API documentation, e. g. here:
ManualObject: http://www.ogre3d.org/docs/api/1.9/clas ... bject.html
Or search in the Ogre forums.

By the way:
I recommend to write the same post in the Ogre main forum again.
... Why? ... This is no Mogre specific question. It's a general Ogre question. So the many many people in the main forum can help you. (Here in the Mogre forum are only a few active people.)

Good luck!

gangwism

21-05-2015 09:04:40

Hey Beauty,

thank you for your reply! Unlucky the problem still exists..
I posted the thread also in the ogre forum:

http://www.ogre3d.org/forums/viewtopic.php?f=2&t=83436

Have a nice day!

gangwism

21-05-2015 15:07:23

Hi *,

after a lot of searching the problem I found some shadow problems which might cause the shadow artifact:

http://linode.ogre3d.org/forums/viewtopic.php?f=25&t=83212

Ogre::Root *root = mGraphicsSystem->getRoot();
Ogre::Hlms *hlmsPbs = root->getHlmsManager()->getHlms(Ogre::HLMS_PBS);
Ogre::HlmsDatablock *hlmsPbsDefaultDatablock = hlmsPbs->getDefaultDatablock();
hlmsPbsDefaultDatablock->mShadowConstantBias = 2.0f;


This might be a solution, but only available for new Ogre Version... We are still running 1.7 Mogre Version... (Is it possible to run Mogre 2.x?)

http://www.cnblogs.com/pulas/archive/2013/03/29/2989392.html

here are some artifacts describtions... Is my Problem called Shadow acne artifact?

http://www.ogre3d.org/forums/viewtopic.php?f=5&t=59322
And I think I also see this artifact :-/

Maybe you know how to solve this Problem with Mogre (1.7? or 2.x?!)

Have a nice day,
- Marcel

Beauty

30-05-2015 15:10:31

Thanks for posting the links.

Is it possible to run Mogre 2.x?
Currently the latest Mogre version is 1.7.
Many months ago somebody (or maybe more people?) started to update the autowrapper tool for Ogre 1.8, but it's not ready.
Also Ogre 2.0 is currently not available.

I can't tell you where there comes up a Mogre update. But I think the day will come.
It happens when somebody really needs it, has very advanced development knowledge (for figuring out why the wrapper tool has problems with newer versions) and enough motivation + spare time for this job.

I'm sorry that I can't help you more.