shadow for dynamic map entities?

Posted By: Mo222

shadow for dynamic map entities? - 01/05/13 16:05

Hello ,

I am making a small platform game with my old A6 6.60 gamestudio edition.
I have a little problem about dynamic shadows for map entities.
Let me explain .

I put several platforms (as map entity) in the level from wmb files.I give them an "action" to let them react with the player.

The problem is they dont cast shadow on the ground when i set [my.shadow=on;] ,whereas the player casts shadow on the ground with the same flag.

Are not Map entities able to cast shadow?
Posted By: Superku

Re: shadow for dynamic map entities? - 01/05/13 17:34

I don't think they are. If you have a flat ground surface you can emulate a shadow easily with a transparent sprite (move it if necessary).
Posted By: Mo222

Re: shadow for dynamic map entities? - 01/05/13 18:11

Originally Posted By: Superku
I don't think they are. If you have a flat ground surface you can emulate a shadow easily with a transparent sprite (move it if necessary).

Hi superku!

Ok thanks for the precision .
In order (for a cube map entity) to emulate a shadow on a flat ground, how should i proceed? :
1- the cube should trace a ray to the ground in the direction of light ray?
2- then place the shadow sprite on the ground at the place hit by the trace ray?

but how can i get the direction of the light ray if i put several lights in the level? (i'll try and think about that)

PS : by the way , i watched a video of your game superku and i say good work , especially for the gameplay which seems entertaining!
Posted By: Superku

Re: shadow for dynamic map entities? - 01/05/13 19:11

Thanks! wink
Obviously you can use models instead of map entities, the latter don't really have advantages over models since we have polygonal collision detection on models.

You mean dynamic lights, right? If you only have static lights, simply use the sun light direction vector for your trace or a simple vertical trace. If you have dynamic lights instead, iterate over them and use the nearest for calculation.
Posted By: Mo222

Re: shadow for dynamic map entities? - 01/06/13 08:56

Originally Posted By: Superku
Thanks! wink
Obviously you can use models instead of map entities, the latter don't really have advantages over models since we have polygonal collision detection on models.

You mean dynamic lights, right? If you only have static lights, simply use the sun light direction vector for your trace or a simple vertical trace. If you have dynamic lights instead, iterate over them and use the nearest for calculation.


I tried to use cube models instead of map entities.
Indeed cube models cast their shadows on the map ground, but they dont show the shadow of the player when he jumps on them.
Unlike the cube map entities which shows the shadow of the player on them, and dont cast shadow on the ground ....


I dont understand why the engine cannot render the shadow of the map entities.

Thus , what is the benefit of using map entities in a level?
Posted By: Ayumi

Re: shadow for dynamic map entities? - 01/06/13 09:42

Map Entities are static Blocks.Render your Blocks and use the static Shadows.The benefit is the speed (-> Manual->How to...->Use Entities->Sub Level).

Textures and shadow maps of the level and of map entities are preallocated in video memory at loading time, in order to maintain smooth gameplay. Textures of all other entity types are normally only allocated when the entity becomes visible.

And here-> Entity selection guide .

It isn t a Model or Block, it s a Level part.Therefore u can t render Shadows with Maps.

Posted By: Superku

Re: shadow for dynamic map entities? - 01/06/13 10:17

Map Entities are not static blocks (maybe you meant prefabs?), they are in fact dynamic blocks, if you want to call it that way. Map Entities don't serve any real purpose, they used to be available in A4 (?) because they provided polygonal detection and models didn't.

Mo222, what kind of shadow are we speaking of, stencil shadows?
Posted By: Ayumi

Re: shadow for dynamic map entities? - 01/06/13 10:26

Yes i have forgot to delete this sentence.

Quote:
It isn t a Model or Block, it s a Level part.Therefore u can t render Shadows with Maps.
Posted By: Mo222

Re: shadow for dynamic map entities? - 01/06/13 11:29

Originally Posted By: Superku
Map Entities are not static blocks (maybe you meant prefabs?), they are in fact dynamic blocks, if you want to call it that way. Map Entities don't serve any real purpose, they used to be available in A4 (?) because they provided polygonal detection and models didn't.

Mo222, what kind of shadow are we speaking of, stencil shadows?


Ok now i understand ! Map entities are a residue from A4 then.
I am playing with A6 which includes my.polygon=on;(i just discovered yesterday when you talked about that).

If i can emulate a shadow on the model cube , then i 'd rather work with models than map entities.
Now i should see if i can get a normal direction of model faces when trace hit a model face, in order to tilt properly the shadow.

by the way, i am talking about the standard shadow which comes from my.shadow=on; and offered by the sun.

Thank you both of you , superku and ayumi!
© 2024 lite-C Forums