Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, ozgur, Quad), 844 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 6 1 2 3 4 5 6
How do you display shadows on invisible surfaces #135959
06/12/07 15:14
06/12/07 15:14
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
This request is carried over from a thread I started in The Future. Jcl says it can already be done without any additional new features; however this one moves into territory beyond my means.

Here's my original request thread:

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/741148/

Here's jcl's comment:

Quote:


Shadows on invisible models should be possible by using nontransparent models with an FFP effect that renders only into the z buffer, but nothing to the screen buffer. I haven't tried it, though.





That quote came from this thread:

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/747240/

It's an entirely different subject involving a request to place panels behind the view and has since been implemented into the newest private beta (thanks jcl); however these two features are related.

In a 2.5D game, the backgrounds are either prerendered or made by hand (drawn, painted, etc). The player and NPCs; however are realtime. In order to interact with these 2D backgrounds, an invisible, 3D collision hull has to be constructed and has to match the background. If there are two wooden crates in the middle of the screen, you have to place a collision block there so the player won't walk through the crates. There is also some layer_sorting effects that have to be done, but that's beyond the scope of this thread.

Anyway, using that crate example above, let's say the player's stencil shadow covered the crates. Since 3DGS won't allow the shadow to appear on my invisible collision geometry, it's not going to look right. If the feature were implemented, the shadow would wrap itself around the crates just like they would in a full realtime game. It's a fancy pants illusion, and according to jcl (see above), it can already be accomplished.

Here's a screenshot from the Resident Evil remake on Gamecube. You can see the player/zombie shadows going up the wall on the left. This is a prerendered background, so there is invisible collision geometry in place and the shadow is contouring to that and when combined with the 2D plate, the illusion is complete:



This is where I need help. Using jcl's comment or using a different method (if you know of one), I'm requesting that someone help me out with writing this particular effect. Thanks.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: How do you display shadows on invisible surfac [Re: Orange Brat] #135960
07/15/07 05:58
07/15/07 05:58
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I'm still lacking a solution for this problem. I've been busy out in the real world (marriage, moving, etc), so I haven't had a lot of time to keep up with 3DGS goings on. Anyone?


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: How do you display shadows on invisible surfac [Re: Orange Brat] #135961
07/15/07 08:54
07/15/07 08:54
Joined: May 2003
Posts: 567
Spain, Canary Islands
Felixsg Offline
User
Felixsg  Offline
User

Joined: May 2003
Posts: 567
Spain, Canary Islands
I don't know because I not check but with a transparent targa texture the stencil shadow are still over the model?
Or with the overlay option and a black texture?

Re: How do you display shadows on invisible surfac [Re: Felixsg] #135962
07/15/07 09:31
07/15/07 09:31
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
The feature isn't possible right now. According to jcl though:

Quote:


Shadows on invisible models should be possible by using nontransparent models with an FFP effect that renders only into the z buffer, but nothing to the screen buffer. I haven't tried it, though.





Scripting the FFP effect is what I cannot do, since I have zero experience in this field. The effect should allow the stencil shadow to display on an invisible or none surface. The old non-stencil shadows do render on invisible surfaces, but they don't contour to non-horizontal surfaces, so they are useless.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: How do you display shadows on invisible surfac [Re: Orange Brat] #135963
07/15/07 18:33
07/15/07 18:33
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
I think this can be achieved with shadow mapping or with shadow volumes via a shader. The advantage of shadow mapping is that it is independent of scene geometry while usings shadow volumes, this is a required option. With shadow volumes you'll need a dll were you should create the object's silhouette which helps to locate level geometry in relationship with the shader where it should than create the shadow with a certain volume adapted to the level geometry.
But where there are advantages, there are alos disadvantages. Shadow mapping may not require any information related the scene geometry but it seems to cast out much more pixelised shadows, where as shadow volumes have a moiré effect.

Hope that gave you an overal idea OB But it's off course a nice theory but the practical side is as you've mentioned, far from easy. I'm trying to achieve shadow mapping through a shader with 3dgs because I'm not very familiar when it comes to writing a dll or sort like I'll post a topic which will be related to this one in the 'far' future.

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: How do you display shadows on invisible surfac [Re: frazzle] #135964
07/15/07 20:08
07/15/07 20:08
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I'm trying to stay away from shaders. I'm not using a standard 3D level. My visible level will consist of handrawn art. The art will will be textures that are mapped onto a series of parallel camera facing planes. However, given I want the shadows to interact with these flat surfaces, I will include some invisible collision/shadow geometry for the shadows to contour to. Think of the levels as hand drawn backdrops except they have actual 3D depth to them.

This is a standard issue 2.5D adventure game shadow method. Wintermute Engine does it, but I'm not using Wintermute because I don't have access to a realtime camera. I could achieve everything else I wanted in that engine except the realtime camera which I'd use to move the camera into and out of levels.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: How do you display shadows on invisible surfac [Re: Orange Brat] #135965
07/16/07 00:51
07/16/07 00:51
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Same thing resident evil did...

Hey, I thik I've just found a solution. Sweet. Lets see f this still sounds do-able as a write/think...


WHAT IF, the model wasn't invisible, but simply drew exactly what was behind it (The model being collision geometry, using models with polygon flag, etc). I could use the same shader I used for portals to draw an image onto the model, but instead of reading from the texture from the models tex-coord, Ill read from the pixels position on the screen. Since pixel shaders draw by the amount of visible pixels on screen, and not by texture size, it won't lose quality!

Ok, there's the end of my ramble, and I still havn't found a downside. Yes, shaders are a bit slower, but this shader requires VERY LITTLE math, so the shader should run very quickly. The hardest part is adjusting the position and size of the image for differnt screen resolutions, but once the formula for this is found, it shouldn't be a problem.

Since stencil-shadows are displayed onto models (even with shaders), you should have a perfect result! You could probably even add dyn. lights to the scene for brightening the shadows in certain areas....

I won't be back home until the 25th, so I can't really begin on this idea now, but if someone else wants to give it a try, please do!


Let me know what you guys think!...


xXxGuitar511
- Programmer
Re: How do you display shadows on invisible surfac [Re: xXxGuitar511] #135966
07/16/07 02:15
07/16/07 02:15
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I suppose it's worth investigation. I think I'm going to write the author of the Wintermute engine and see he does it.

EDIT: ...and in fact I have. Somehow, I don't think shaders are the answer, and it's probably something very simple.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: How do you display shadows on invisible surfac [Re: Orange Brat] #135967
07/16/07 11:07
07/16/07 11:07
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
I think Guitar his idea seems logical enough to work such as mine but the problem is the shader. But when relating to jcl his answer, while using a FFP effect (Transform & Lighting and Multitexturing) you should remind that shaders( VS,GS,PS) are nowadays quite hard to avoid from the OpenGl/D3D pipeline.

But for making it clear, you're trying to make collision detection for shadows between a predefined sprite (your hand drawn art) and a realtime model. So that not only the shadow is aware of the scene 'invisible' geometry but to make sure that there is a 'contour effect' while the shadow interacts with it.

But why not using a realtime sprite which represents your hand drawn art, works perfectly

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: How do you display shadows on invisible surfac [Re: frazzle] #135968
07/16/07 11:20
07/16/07 11:20
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
A shader shouldn't be necessary because this is just something that is part of the stencil shadow crap in DirectX. I got a response from Mnemonic at Wintermute. He's basically saying jcl is on the right track, and here's the msssage:

Quote:


Hi Ryan,

the hidden geometry indeed needs to be rendered into the depth buffer, so that the shadow volume is properly mapped onto it. In Direct3D the following render states should do the trick:

Code:

m_Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
m_Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
m_Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);



This unfortunately also means the hidden geometry must closely match the 2D image, otherwise the depth buffer will mask the 3D character (like on this screenshot: http://www.dead-code.org/blog/wp-content/shadow2.png).

JN





So, if someone knows what that means, then this is the key or at least an entry into what I need.

@frazzle: The parallel, camera facing planes are going to have the art on them. I could just as easily make them regular sprites if I wanted. The shadow can only interact with the invisible collision hull (block, model, whatever...it's separate from the sprite art or the plane with the art mapped on it..whichever I use), so it has to exist for not only this shadow stuff but also for collision for the player. The 2D art is placed within the level at the approximate place the collision hull is at. If every matches, then the shadows should appear to contour around the elements in the art. You can see this in the screenshot in my first post. The shadow is going up the wall, but that's just a 2D bitmap background. It's really contouring to the collision hull.

Page 1 of 6 1 2 3 4 5 6

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1