Shadow for 3D character (SOLVED)

Started by td, Wed 19/07/2006 19:02:52

Previous topic - Next topic

td

Well is that not same like "shadow for 2D character" (seems                                    FollowCharacterEX(shadow, character, follow_exactly, 1);
     Set Trasparency(shadow, 50);
dosn't work...)
i suppose. Who know how can i make shadow for 3D character???

DoorKnobHandle

Hehe, as far as I know, it's really not as simple. There are various approaches to real-time shadows in 3d-environments such as "Shadow Mapping" or "Shadow Volumes". But all that is not implementable in AGS at the moment, maybe the developer of the Character 3d-module could do this in C++, but he would need to know what kind of level-file you're using as well, because when calculating a 3d-shadow, you need to know where to project it.

Or, aren't you even using the character3d-module? Give us more information, please.

td

I using Character3D plugin ver. 0.93 by Ferri Gabriel - besh81. Well it is not necessarily to use realistic real-time shadow for me. i wanna just "black spot" thats of it...

DoorKnobHandle

Ah, in that case you might simple draw a black dot (circle or ellipsoid) shape as sprite and then try to always position it underneath the player. You could have it as object and make it transparent as well. However, I don't know if objects will be infront or behind characters from the module and it won't look good from all perspectives.

td

As i understand is a problem to create a "spot" sprite in MilkShape3D because this soft not for creating, but for changing existing 3D models. Anyway i think using 3D models  is a future of AGS and shadows is the next step...

Besh

Hey dkh knows my plugin better than meÃ,  ;D

Inside the plugin there is the code for generateÃ,  "Shadow Volumes" but the problem is: (as dkh said) "you need to know where to project it".

Second problem: the speed, with "Shadow Volumes" enable the fps drastically decrease.
"Spread our codes to the stars,
You can rescue us all"
- Muse

GarageGothic

But wouldn't it be possible to just project it directly below the character, as if he was standing under a lamp? Then you would have the equivalent of a blob shadow but matching the character's movement and have no problems with it projecting onto objects or walls.

DoorKnobHandle

Good idea, GG, but what if you want the character to float in the air for example? Or if the character is lit from one side, so that a long shadow in one direction is created and he stands in front of a wall, the shadow should wrap around the wall? And what if the character stands on a ramp?

You could use this "hack" and just make sure that the light is always on top of every character so that the shadow always is really small underneath it and then pretend that you know that the character always stands on an even ground.

Another, way better possibility would be to combine the AGS3D-module (which is great for the levels) and this Character3d-module (which is great for characters) and allow them to communicate together for things like this!

GarageGothic

#8
dkh, the floating in air situation should be quite simple since the shadow coordinates would still be (character.x, character.y) if you use the  the character.z to make the character float. Most AGS users only use shadows for making the character seem "grounded", or in the floating situation, do define his depth position in the room.

The problem with combining the character module with AGS3D for shadow rendering is that the basic geometry of the room has to be mapped on in a 3D space. For most users this would be way too much work just for shadows and would be quite impossible with some art styles that don't rely on realistic perspective.

I wrote a shadow rendering module for 2D characters which uses geometry and basic rules of drawing to project a dynamic shadow of a character onto the floor, walls and ceiling of a basic room. The light source is defined using x, y and a height coordinate, and if it is possible to grab a DynamicSprite of the character rendered from this point in the room, the module would work just as fine with 3D characters. I'm sure it could be speeded up greatly if the rendering was done in a plugin instead, but I would suggest an approach similar to this instead of one that requires full modelling of the room (one of the main reasons I gave up on the WinterMute engine).

td

Besh, could u give me a simple example of code?? I wanna project swadow right under character... well nevermind what of side shadow will turn i just need a code example...

Besh

With the actual version of C3D it is impossible since the code for generate shadow is inside but there isn't the AGS interface.
Also this routine works with the scene light so the shadows isn't project under the character but in the right direction.
"Spread our codes to the stars,
You can rescue us all"
- Muse

td

So maybe exists some way to realize a shadow with standart AGS instruments? Please... i need just a BLACK CIRCLE under the character...

GarageGothic

You said something about FollowCharacter not working, which I don't really understand. But anyway, just create another character (not 3D), create a black blob sprite for it's view, set it's transparency to 50 or so and place it at (player.x, player.y) every loop through the repeatedly_execute_always.

(Or rather at (player.x, player.y - (shadowheight/2)) to make it seem beneath the character - but then I would suggest resizing it manually to avoid it being a different scale than the character).

td

Please tell me what should i do exactly??? I has been created another character (black spot), set the view and type in global script :

FollowCharacterEX(shadow, (character name), follow_exactly, 1);
Set Trasparency(shadow, 50);

But there was error line 17: Undefined token FollowCharacterEX

Whaaat wrong?


GarageGothic

Ok, the problem in this case is the capitalization of the X I think. You've written FollowCharacterEX instead of FollowCharacterEx. There may be other problems, but since I'm using a later version of AGS, I'm only familiar with the new object-oriented versions of the commands.

The 'Set Trasparency' line should be SetCharacterTransparency though, I think. Be very careful with correct spelling, spaces and capitalization.

td

#15
Do'h!

FollowCharacterEx (... < error undefined token ...
                               follow_exactly < error undefined symbol

I has been followed AGS help, but where i misspelled???

Edit:

It's FOLLOW_EXACTLY, capitalized. Solved.

SMF spam blocked by CleanTalk