[broomstick] Problem with Shadows

瀏覽次數:117 次
跳到第一則未讀訊息

ragaes

未讀,
2011年5月16日 凌晨3:42:442011/5/16
收件者:Away3D.dev
Hi,

While trying the SoftShadowTest sample in Away3D 4 I'm getting the
following exception:

RangeError: Error #1125: The index 4294967295 is out of range 8.
at away3d.lights.shadowmaps::ShadowMapperBase/renderDepthMap()[C:
\Downloads\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\lights
\shadowmaps\ShadowMapperBase.as:88]
at away3d.containers::View3D/updateLights()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
395]
at away3d.containers::View3D/render()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
317]
at SoftShadowTest/_handleEnterFrame()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Examples\Away3D\as\src\SoftShadowTest.as:
151]

If I enter in debug mode I can see that the problem is that context is
null.

If I choose to continue the execution, then shadows are rendered but
always in Software mode.

If have tried also with all shadow related methods:
SoftShadowMapMethod, HardShadowMapMethod, FilteredShadowMapMethod and
SlowFilteredShadowMapMethod.

Always getting the same result.

Is this a problem with my graphics card?

Thanks in advance.

mobstar07

未讀,
2011年5月16日 凌晨4:16:232011/5/16
收件者:Away3D.dev
I have no clue about your error, but I have similar results with the
various shadowmap methods.
They all look jagged on the edges, no matter which params (like
stepsize) I feed them.
I tried it on different machines with different graphicscards: it's
all the same.
Am I missing something? How to get smooth and acceptable shadows with
Away3D?

DerSchmale

未讀,
2011年5月16日 清晨6:02:572011/5/16
收件者:Away3D.dev
Ragaes: Hm, I'm not sure what causes that issue, it's something I'll
have to investigate. Any example code you can provide would help us
duplicate the error.

Mobstar: You could try the SlowFilteredShadowMapMethod (the name is
purely temporary ;-) ), but also be sure to set the camera.lens.far
parameter no larger than it needs to be to render the visible
geometry. That allows the shadow map to be constrained to the area of
interest, providing a higher resolution.

Hth,
David

mobstar07

未讀,
2011年5月16日 清晨6:18:252011/5/16
收件者:Away3D.dev
That did the trick David, thanks! I had the far param of the lens
bumped up to 50k which was way to high.

mobstar07

未讀,
2011年5月16日 清晨6:57:022011/5/16
收件者:Away3D.dev
That did the trick David, thanks! I had the far param of the lens
bumped up to 50k which was way to high.

On 16 mei, 12:02, DerSchmale <david.lenae...@gmail.com> wrote:

mobstar07

未讀,
2011年5月16日 清晨6:57:242011/5/16
收件者:Away3D.dev
That did the trick David, thanks! I had the far param of the lens
bumped up to 50k which was way to high.

On 16 mei, 12:02, DerSchmale <david.lenae...@gmail.com> wrote:

mobstar07

未讀,
2011年5月16日 清晨6:58:562011/5/16
收件者:Away3D.dev
Crap, something went wrong, excuse me for the duplicate posts :(

ragaes

未讀,
2011年5月16日 清晨7:22:072011/5/16
收件者:Away3D.dev
Thanks David for your attention,

I'm experiencing this with the SoftShadowTest example provided with
Away3D sources. I'll see if I can isolate the problem...

May be there is some AGAL instruction not supported in all graphic
cards?

The shadows are rendered fine after the exception is caught, but in
software mode (too slow).
> > > Thanks in advance.- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

CoreGr

未讀,
2011年5月16日 清晨7:58:042011/5/16
收件者:Away3D.dev
Hi, Im getting the same error when I try any of the shadow methods:

[Fault] exception, information=Error: An abstract method was called!
Either an instance of an abstract class was created, or an abstract
method was not overridden by the subclass.


It's throwing this exception from LightBase:

protected function createShadowMapper() : ShadowMapperBase
{
throw new AbstractMethodError();
}

I also tried what DerSchmale said about using
"SlowFilteredShadowMapMethod" but still getting the same error. Could
someone give me any advice please?

CoreGr

未讀,
2011年5月16日 清晨7:59:512011/5/16
收件者:Away3D.dev

ragaes

未讀,
2011年5月16日 上午8:03:132011/5/16
收件者:Away3D.dev
Hi again,

I've managed to avoid the exception.

I think there is a bug in View3D.as: In render method there is no
check for null context before calling updateLights and
renderSceneDepth.

Here is the modification I made in View3D.as:
Before (at line 317):
updateLights(_entityCollector);

if (_requireDepthRender)
renderSceneDepth(_entityCollector);

After:
if(context)
{
updateLights(_entityCollector);

if (_requireDepthRender)
renderSceneDepth(_entityCollector);
}


After making this change a new exception arises at
popModelViewProjection in Entity.as, caused by the call to
_entityCollector.cleanUp() at line 338 in render method:

RangeError: Error #1125: The index 1 is out of range 1.
at away3d.entities::Entity/pushModelViewProjection()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\entities
\Entity.as:157]
at away3d.core.partition::EntityNode/isInFrustum()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\EntityNode.as:70]
at away3d.core.traverse::EntityCollector/enterNode()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\traverse
\EntityCollector.as:133]
at away3d.core.partition::MeshNode/acceptTraverser()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\MeshNode.as:39]
at away3d.core.partition::NodeBase/acceptTraverser()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\NodeBase.as:100]
at away3d.core.partition::Partition3D/traverse()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\Partition3D.as:38]
at away3d.containers::Scene3D/traversePartitions()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\Scene3D.as:
52]
at away3d.lights.shadowmaps::DirectionalShadowMapper/drawDepthMap()[C:
\Downloads\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\lights
\shadowmaps\DirectionalShadowMapper.as:46]
at away3d.lights.shadowmaps::ShadowMapperBase/renderDepthMap()[C:
\Downloads\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\lights
\shadowmaps\ShadowMapperBase.as:90]
at away3d.containers::View3D/updateLights()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
398]
at away3d.containers::View3D/render()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
319]
at SoftShadowTest/_handleEnterFrame()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Examples\Away3D\as\src\SoftShadowTest.as:
156]


To solve it I've added a check before decreasing _mvpIndex:
public function popModelViewProjection() : void
{
if(_mvpIndex>0)
--_mvpIndex;
}

I think this deserves a deeper insight because there are more pops
than pushes, something misssed there.

With these changes I have removed the exception but the shadows
continue rendering in software mode.

Hope this helps.


On 16 mayo, 12:02, DerSchmale <david.lenae...@gmail.com> wrote:

ragaes

未讀,
2011年5月16日 上午8:20:362011/5/16
收件者:Away3D.dev
I think that shadows are only implemented for Directional lights.

Try with a DirectionalLight.

CoreGr

未讀,
2011年5月16日 上午8:27:382011/5/16
收件者:Away3D.dev
My error is different than yours ragaes. Mine seems to be caused when
passing the "light" argument to create an instance of any of the
ShadowMethod classes. In the "LightBase.as" class the method I said
before (createShadowMapper()) is called and it throws the exception.
The method is called from: "castsShadows(value : Boolean)" which is in
the same class (LightBase).

My code is very simple:

var material : ColorMaterial = new ColorMaterial(0xff0000);
material.shadowMethod = new SlowFilteredShadowMapMethod(light);
material.lights = [light];
var esfera:Sphere = new Sphere(material, 100, 10, 10);
esfera.castsShadows = true;
esfera.position = new Vector3D(-200, 50, -200);
view.scene.addChild(esfera);

Even ommiting the line "esfera.castShadows = true" I get this
exception.

Any idea about what could be the problem please?

ragaes

未讀,
2011年5月16日 上午8:37:552011/5/16
收件者:Away3D.dev
This was the error I was getting when trying with a PointLight and
solved when I replaced it by a DirectionalLight...

Please confirm the type of light you are using.

CoreGr

未讀,
2011年5月16日 上午8:38:222011/5/16
收件者:Away3D.dev
Thanks Ragaes you were right but still having problems. I did the fix
you said but now Im getting a "RangeError" launched from the method
"public function pushModelViewProjection(camera : Camera3D) : void"
from the "Entity3D" class (even having done what you said about adding
the checking (if _mvpIndex > 0) ). I'll keep trying to find a way to
fix it.

ragaes

未讀,
2011年5月16日 上午8:41:342011/5/16
收件者:Away3D.dev
I've managed to render shadows in HW mode. I think the problem was the
ColorMaterial ¿? because now I'm using BitmapMaterial and is running
in HW mode....

If I use a PointLight insead a DirectionalLight I'm getting the
exception reported by CoreGr.

Now I've lost antialiasing and the shadows are pixelated.



On 16 mayo, 12:02, DerSchmale <david.lenae...@gmail.com> wrote:

CoreGr

未讀,
2011年5月16日 上午9:02:202011/5/16
收件者:Away3D.dev
I've used a BitmapMaterial but still not working :(. I got the same
error that you had at the beginning with the "ShadowMapperBase" class.
I did the fix you said but I still get problems with "_mpvIndex" in
"Entity3D.as" even after adding the checking :S.

ragaes

未讀,
2011年5月16日 上午9:30:092011/5/16
收件者:Away3D.dev
Entity3D? There is not such class I think. You may mean Entity...
right?

You have to do the modifications in the method render in View3D.as and
in the method popModelViewProjection in Entity.as.

By the way, you must get the last version in SVN before doing any
change.

CoreGr

未讀,
2011年5月16日 上午10:19:312011/5/16
收件者:Away3D.dev
Sorry I meant Entity. I've done the modifications in View3D.as and in
the method popModelViewProjection from Entity.as but I still get an
error because of the _mvpIndex. My version of away3d is quite recent
(like 2 weeks ago or some). I downloaded the last one but I've noticed
that there's a file missing in the new version that I need
(away3d.loading.ResourceManager). Anyway thanks a lot for your help ;)

CoreGr

未讀,
2011年5月18日 上午8:37:262011/5/18
收件者:Away3D.dev
Hi again,

Yesterday I updated my version of Away3D and had the same problem when
I try to use the "SoftShadowMapMethod" class. I also made the changes
you said but still not working. The error (rangeError type) is
reported in the line:

"var mvp : Matrix3D = _mvpTransformStack[_mvpIndex]"

from the method "pushModelViewProjection()"

from the "Entity.as" class.

I've also found a file in the examples called "LoaderOBJTest.as" in
which "SoftShadowMapMethod" is used and I can compile it without any
error. I tried to do exactly the same as it's done there but still
getting the same error.

Could someone tell me how I could fix this problem? Thx very much in
advance.
回覆所有人
回覆作者
轉寄
0 則新訊息