0

How can I enable shadow effect on *.pod object? I set up camera and light but my object didn't have shadow. Can somebody explain how to resolve this?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Faraona
  • 1,685
  • 2
  • 22
  • 33

1 Answers1

1

In order to enable shadows in cocos3d, you must first set

_viewController.viewShouldUseStencilBuffer = NO;

to

_viewController.viewShouldUseStencilBuffer = YES;

in the application delegate.

Next, you must add shadow volumes to the objects of a scene manually.

You can do this by adding this method call to the initialization method of your cc3scene subclass:

[self addShadowVolumesForLight:yourLight];

in order to add shadow volumes to every object in the scene for a specific light, or:

[self addShadowVolumes];

to do the same for all lights in the scene.

alternatively you can do the same for specific objects in the scene, if you want to limit shadowing. e.g.

[someObject addShadowVolumesForLight:yourLight];
[someObject addShadowVolumes];
  • p.s. for some reason shadows don't seem to work with opengles 1 on my system, but they do for opengles 2. Not sure if its a local problem or not. – waywardson07 Jan 23 '14 at 07:10