Shadows on none surfaces...

Posted By: Orange Brat

Shadows on none surfaces... - 04/01/07 00:29

I'd like an option to allow stencil shadows to be visible on either surfaces marked none or if it's possible on invisible blocks.

I'm experimenting with using realtime levels for my basic level structure (walkways, collision, etc), and dropping in more detailed 2D sprites in front of the appropriate collision areas but still have my dynamic shadows wrap around this area as it should. This will give me the freedom of a realtime environment, but it will also allow for me to integrate decoration areas for more detailed sections. Hmm, I wonder how the shadow would react to the sprite? Would the shadow be obscured or clipped since the sprite is ultimately in front of the hidden geometry?

A commercial game that is using this specific technique is A Vampyre Story. They're using a realtime engine and are breaking up their 2D backgrounds into layers. Each layer gets mapped onto a 3D plane (all planes are parallel to one another), and the realtime characters' shadows will contour to the backgrounds as expected. Although, I personally want to still display parts of the actual 3D level, I would like this feature to allow for interaction with these special 2D areas when appropriate.

http://www.amegames.com/vs/

The Wintermute Engine's stencil shadows allow for this, however it isn't capable of true realtime levels (only objects). The screen below is from an in development Wintermute game. The backgrounds are 2D, and the player is a 3D model. The appropriate hidden geometry is in place, so the shadow appears to interact with the 2D background.




Posted By: lostclimate

Re: Shadows on none surfaces... - 04/05/07 05:39

I thought you already could cast shadows on transparent sprites?
Posted By: Orange Brat

Re: Shadows on none surfaces... - 04/05/07 06:13

This request is in regards to surfaces set to none or invisible blocks. I mentioned sprites because I don't know if the shadow would appear on top of the sprite and blend with it or if the sprite would cover up the shadow since it's in front of the hidden geometry the shadow is supposed to appear on.

These sprites would only appear in places where the player could walk behind them. The stove in the image above is a good example. As pictured above you can only walk in front of it, but if it were placed in such a way that the player could walk behind it, I'd place a sprite in front of the hidden geometry representing the stove.
Posted By: Pappenheimer

Re: Shadows on none surfaces... - 04/05/07 11:31

Do you actually need sprites?
The style of fixed camerapositions allows high quality textures.

Another suggestion:
Use blocks with simple grey surfaces, make the sprites transparent, this way you get the mix of shadow, surface and sprite, too.

All in all, I would use the first way, simple and fast.
(Progress is very important for one's motivation! )
Posted By: Orange Brat

Re: Shadows on none surfaces... - 04/05/07 17:53

That transparent sprite technique sounds like it should get around that shadow clipping problem, although I guess you could see the player through it if it walked behind it. The problem with using all geometry is it interferes with establishing a style that is unique. The go-to feature for style these days seems like "shaders, shaders, shaders." I don't want any part of that, and it has been illustrated time and time again that they aren't needed to establish a style that is appealing even in this day and age. They have their place, but not in my work (at this point in time).

If you look at A Vampyre Story, it's all in realtime but the levels are all handpainted. It doesn't feature any actual geometry other than the hidden collision hull, parallel planes for the background layers, and the interactive entities. Most of the images on that site are from an old, 2D tech demo (there are a couple with the 3D Mona...do you think one can actually do this with a 3D only level? And, don't mention Okami. ), so it takes a little bit of using your imagination to wrap your noggin around what they're trying to do. If you've ever seen the old Disney short "The Old Mill," (YouTube it) that's what they're trying to do in regards to the layering. All it is is old school parallax scrolling, but it has that extra bit of DOF-like blurring when the camera zooms in or moves away from or towards the viewer.

This is the EXACT aesthetic I've been experimenting with for years. I have old WIP levels using it but lacking the DOF blurs. This effect is not apparent in any screens I've posted, but if you're familiar with your early Disney then you know what it is. The WIP Limbo game also uses it, although that's a different genre, plus none of what's in the trailer is realtime...it's all proof of concept and prerendered/preanimated: http://www.limbogame.org/

I don't want to use any DOF shaders, but I have a theory regarding animated sprites that contain blurry and non-blurry frames that activate depending on player position relative to the sprite's parent camera. It's similar to what is accomplished with this camera code only using individual frames in an animated sprite instead of a camera. I don't know if it's even possible to manipulate an animated sprite like what I'm wanting, but it's an idea I've had but never bothered attempting. It's easy to trigger the transition if the player crosses a certain coordinate, but basing it directly to position may be tricky and even unnecessary.

Anyway, to steer this back on topic....stencils on none surfaces and/or invisible blocks is my simple request, so I can better realize an aesthetic like this. I just want this title to look different than your average 3D game and/or game period. This has been another ranty novelette brought to you by Orange Brat Shenanigans™.
Posted By: Pappenheimer

Re: Shadows on none surfaces... - 04/09/07 13:20

Quote:

This is the EXACT aesthetic I've been experimenting with for years.




One thing is, what an artist tried to achieve, the other thing is what he gets offered by his efforts and good luck!

From the screens of your level: You already achieved a unique style! Look at the feedbacks. I don't remember anybody saying this or that is missing!
Your style is already complete!

My opinion, based on my experiences with my own game project through the last years, you have to make compromises to get a chance to come near a completing of the game. And the appearance of your levels is already fantastic, or, in other words, its not a bad compromise to keep them as they are - and concentrate on transition of the story to gameplay.

(Watching your project with big sympathy as always! )
Posted By: Orange Brat

Re: Shadows on none surfaces... - 04/09/07 21:04

Sorry about the length of these posts....I'm articulate...I know it can be annoying....sorry...

You're right, but the problem with showcasing only WIP screens is you don't get the full picture (no pun intended..actually it was). The visuals I've discussed in this thread are what I've been wanting all along. What has been shown in screens is mainly my talent at achieving good to semi-good results with 3DGS implementation of lightmaps and some creative ways to USE old school blocks and BSP limitations to establish a visually appealing style. I know I could setup some fantastic stuff with per pixel lighting and projectors, but I don't want to fool around with worrying about compatibility with older machines (because a lot of my target still has them).

A lot of you probably think I hate shaders and change. I don't. I just have to worry about my target, and I have to find ways to do what I want without them. I think Matt's Sphere Engine is a great tool, and if you want standard shaders in your game then go spend the $40 and get it (this is an endorsement ). However, as much as I'd love to implement it, I can't given the genre I chose. I could be a jerk and REQUIRE that anyone who wants to play my game has to upgrade their equipment, but I'm old school, and I live by the mantra that it's the developer that serves the customer and not the other way around. I work with what my target has at this moment and won't play the jackass.

You mentioned compromise. I don't do that, so if this feature never sees the light of day, I'll have to abandon this particularly visual trick and rely solely on detailed blocks and/or models and proper skins/textures.

You also mentioned feedback. I don't get a lot of feedback. Most of my comments are from the same few users. I get A LOT of hits on my main game thread, but I get very few remarks, good or bad. This is somewhat disheartening at times, but I'm a big boy, so it doesn't get under my skin like it would if I were much younger or more "needy."

Regarding lightmaps....this implementation could be a lot better. I'm suggesting to beef them up to give them all the features and capabilities they're capable of that other programs have provided for years. Don't abandon them because AAA games still use them, and they still look better than the best per pixel light shader you can find. Let's be frank....we have a really crappy lightmapper when compared with other applications; thus our collective screams over the years to beef them up. I mean, can't we get a damn static spotlight finally? A real one? Not something I have to fake using invisible blocks? There are other wants, but those are found in any number of other request threads, including two or three of my own over the years. The pending release of A7 is the PERFECT opportunity to introduce a new lightmapper complete with ALL of the features and tweaks that it's capable of. Don't worry about performance (i.e. build times)....let US the user worry about that. But, for Satan's sake give us the luxury of a full featured lightmapper so those of us who prefer this can use 3DGS to make knockout lighting. As is, it's all right, but as you can find all over this forum, it could be much better.
Posted By: Pappenheimer

Re: Shadows on none surfaces... - 04/10/07 17:01

Sorry, for questioning your request. I'd simply thought that it is better to work with the already given features than to wait for any of them.

But, in your case, the request is actually an easy one(means: you shouldn't have to wait to long for it.): to add a flag to none blocks and/or invisible blocks shouldn't be a problem.
And, it indeed adds an important adventure feature to GameStudio!

Quote:

I'd like an option to allow stencil shadows to be visible on either surfaces marked none or if it's possible on invisible blocks.




(I don't know what you were talking about shaders, I didn't say anything about them, and I, me, myself wasted the lot time of my project with them, and won't ever recommand to use them. [exept the ffp for environement mapping, and that one for multitexturing.] )
Posted By: Orange Brat

Re: Shadows on none surfaces... - 04/10/07 20:50

I wasn't being harsh towards you, Pappenheimer. I was just ranting and trying to explain (overexplain) myself for the general audience. It's funny, I said I never compromise, but if you look at my latest post in my game thread, I use the word and in fact compromised on something.

I brought up shaders and lightmapping on my own. I was just going off on a tangent. I got a bit cranky (but not at you) writing that las post.

Anyway, I agree that this at least sounds like it should be easy to implement, but I don't know one way or the other. I guess we'll know when and if it pops up on a future beta list.
Posted By: Orange Brat

Re: Shadows on none surfaces... - 07/16/07 15:28

@jcl:

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 the panels behind the view thread here; however this post belongs in this thread since that's what it's in regards to.

I PM'd the head honcho of the Wintermute Engine on how he handles this in his engine. As I've stated before, WME will allow stencil shadows to render on the invisible collision hulls used for 2.5D games. Here's his response to my question:

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





I'm all for features like these being a part of the engine as some sort of option from WED (or a flag in script), so we can all use it if we find the need for it. Yeah, it's a limited feature for a certain niche, but from reading your posts, it sounds like Conitec is trying its best to include some 2.5D tools for those of us who love this genre.

Anyway, if the information Mneumonic provided is of use (or gives you an idea of how to better implement this), I would like to request that stencil shadows be able to render onto invisible surfaces. One possible solution would be to invent a new flag (similar to None, Shaded, Flat, Smooth, etc) and any surface with this flag set would be a special kind of invisible (or none...whichever is preferable) and shadows would render on these special surfaces. I'm not sure what you'd want to call the flag, but it's an idea. Please consider it because it would make life a whole helluva lot easier for 2.5D game development when it came to dealing with stencil shadows and the collision hull. Thanks.

There's also a discussion regarding this here: http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=769499
Posted By: xXxGuitar511

Re: Shadows on none surfaces... - 07/16/07 21:39

Those three flags can already be set through a shader. (I know, you're trying to avoid shaders), but this technically wouldn't be a shader, as it goes into the technique of the shader for compiling. Simly add these thre lines: example

Code:

technique whatever
{
pass p1
{
AlphaBlendEnable = true;
srcBlend = zero;
destBlend = one;
VertexShader = compile 1_1 VS();
PixelShader = compile 2_0 PS();
}
}



As I said before, I'm gone for 2 weeks (back 25th), so I can't test this, but this is exactly what he said to do. However, by looking at it, I don't think it'll work. Wouldn't it also be possible (though slower) to simply use a shader to draw the model with alpha=0;? Would the model not recieve the shadow even though its alpha is 0?
Posted By: Orange Brat

Re: Shadows on none surfaces... - 07/17/07 01:08

I don't know if it'll work or not. I'm sure the Wintermute's implementation of stencil shadows is going to vary from 3DGS; however those three lines are the key to getting this feature to work. I know we can add an effect of our own and getting that effect correct is one of two possible answers to this request.

The 2nd answer is having it hardcoded into the engine and available as a flag inside WED. Here's a real world example complete with unattractive behind-the-scenes pictures of a level that needs a lot of work :



Pretend that background is the background of the game level and everywhere you see green there is hidden geometry that closely matches the shape of the visible image. In fact the green is the hidden hull and pretend like there's a textured version that can be seen over this. Also, the green parts on that building are the possible locations for the player's shadow to appear; thus the reason why the hidden geometry has to match. The complexity of the hidden hull above this area doesn't really matter.

In WED, I would like to have a new flag and for every green surface, I'd like to be able to check that flag ON. Those green surfaces will be invisible, will not cast any dynamic shadows (if within the sphere of influence of a dynamic light..remember this is ultimately going to be pre-rendered or hand drawn, so any shadows will already be present); however the stencil shadow of any shadow casting models will render onto those areas if the lighting is setup properly for the shadow to cast in the direction of the green section.

I don't think this requires anything shader related or VS1_1 or PS2_0 type stuff.
Posted By: xXxGuitar511

Re: Shadows on none surfaces... - 07/17/07 02:59

The code below does exactly as those other three lines, and WITHOUT a shader. This is simply a material setup, not a shader. I simply added the two shader compiler lines above to show placement.

Code:

material mat_none
{
effect = "
technique whatever
{
pass p1
{
AlphaBlendEnable = true;
srcBlend = zero;
destBlend = one;
}
}
";
}



This is what he sid to do, so try it! If not then.... IDK. Maybe I'm wrong, maybe he didn't give you enough info, maybe 3DGS is just different...
Posted By: Orange Brat

Re: Shadows on none surfaces... - 07/17/07 06:45

@jcl: Could I ask if you are leaning towards a possible implementation of this feature into the engine at some point. I'm not expecting any promises to be made, nor do I even expect a response; however an official maybe/maybe not/hell no would be greatly appreciated by both me and closet adventure game developers and/or lurkers. Also, a time frame is not an issue for me. I'm in absolutely no hurry for this feature, but knowing whether or not it's even a possibility and/or happening is a concrete factor required for future preparations on my part.

Another potential feature is allowing invisible models to cast stencil shadows. I have a crazy idea regarding a lower poly, invisible player that is controlled by the end user, and attaching an animated sprite using a higher poly version as the base art to it. This animated sprite would use a large amount of frames to give the illusion that it is a real time model. An example of a commercial franchise that does this is the Runaway series of games. The characters were all built in a 3D application and toon shaded, but they use a huge number of frames to give the appearance that they are real time. The purpose of using the lower poly invisible model would be for stencil shadow casting and collision purposes. I know transparent models cannot cast them, but is this also true for invisible models. Finally, is it possible in DirectX to make an invisible model cast a stencil shadow and if so could you add this to the todo list, too (assuming it isn't already possible...I'm away from my regular PC, so I can't check).

@XxX: What do I do with this material. Do I need to play with the d3d_automaterial flag and assign this per surface as outlined in the manual? I'm more of a blocks man than a mesh one, and given A7 WED allows for concave geometry, I can build anything I want should I decide to build my levels in WED and use high resolution textures instead of hand drawing them (I believe you came up with the same idea in the other thread). For saving out specific sections of art for specific layers, I can simply "turn off" the sections that aren't needed to be rendered and vice versa. It'll also provide me with an easy to manipulate base/starting point for the invisible collision hull. Perhaps, I might even use shaders (GAAAASSPPPP!!!!!) for more high quality per pixel lighting and shadows; however I'm not sure what kind of results I can achieve with the new light mapper resolution slider, yet so only experimentation will clue me into what it's capable of.

Nah, WME probably isn't that much different, but they are apples and oranges in certain respects. They both use DirectX, and there's that real time component for 2.5D and some real time instructions in its Javascript-like OOP scripting language. WME just moved to a DirectX 9 version of the engine using the DX June update as a starting point (see my recent WME post in Tools). Mnemonic did this to prepare for the future because I think he's heading towards shadersville (toon shaders are popular in adv. games right now, as well as per pixel lighting and shadow mapping effects). I know new editors are in the future, but low priority for now. Here's a snippet from the WME 1.8 update thread Q&A which I didn't post in that tools thread:

Quote:


Q: Why Direct3D 9? What's the benefit?







A: Quite frankly, there's not much of a benefit at the moment. There should be some performance increase when using hardware T&L (see below). But mainly the Direct3D 9 version of the engine brings more possibilities for the future, such as the access to high-level shader language (HSLS), which was impossible with D3D8. Also, the "Games for Windows" guidelines require games to use D3D9.





Just for kicks, here's the latest manual (2.04 MB CHM format) if anyone wants to inspect what WME is capable of. The engine is now donationware, so some of you might want to play around with it for one reason or another. Seeing what it's capable of via reading the easy to follow manual won't hurt if there's an interest:

http://www.mediafire.com/?dbmx1lmj2yn

It contains info on the shadows procedures, so it is useful and relevant to this thread, too. Here's the official WME site if it peeks anyone's interest. To avoid any problems, you'll need to install the 1.7.3 version then then 1.8 beta, as well as the DirectX June update (provided there's no auto-install feature in the WME 1.8 installer process):

http://dead-code.org/
Posted By: xXxGuitar511

Re: Shadows on none surfaces... - 07/17/07 18:34

As much as I love to build with blocks (trust me, I hate building levels from models), in this scenario, I'm going to have to use models. The route I plan on taking will require me to use a different shader on the level, which is too slow with blocks.

I don't remember the exact method of applying this to blocks, but here's an idea:

Save thses lines into an FX file, ex: none.fx
Code:

technique whatever
{
pass p1
{
AlphaBlendEnable = true;
srcBlend = zero;
destBlend = one;
}
}



then, run this line of code in your main function:
Code:

Function Main()
{
effect_load(mat_flat, "none.fx");
...
}



Without the manual, I'm not sure if my syntax/keywords are correct. I they are though, then this will apply the "invisible" material to all blocks with flat shading...
Posted By: Pappenheimer

Re: Shadows on none surfaces... - 07/17/07 20:10

Quote:

Finally, is it possible in DirectX to make an invisible model cast a stencil shadow and if so could you add this to the todo list, too (assuming it isn't already possible...I'm away from my regular PC, so I can't check).




You already can use, or even already use normally, the LOD of your charcter for the shadow in A6.
Just picked up this sentence, so it can be that this already had been mentioned.
Posted By: Orange Brat

Re: Shadows on none surfaces... - 07/18/07 16:49

Quote:

Quote:

Finally, is it possible in DirectX to make an invisible model cast a stencil shadow and if so could you add this to the todo list, too (assuming it isn't already possible...I'm away from my regular PC, so I can't check).




You already can use, or even already use normally, the LOD of your charcter for the shadow in A6.
Just picked up this sentence, so it can be that this already had been mentioned.




Yep, I'm aware that we can use LOD for stencil shadows (Wintermute has this feature too); however I know that SS don't work when a model is transparent, so I was wondering if they worked if they were completely invisible (my.invisible = on;)? The manual states:

Quote:


Stencil shadows are only cast by completely non-transparent models. The model skin must not contain an alpha channel.





I wonder if there's a way to make a model cast the SS and still be completely 100% visible but not render. It sounds much like the hidden geometry issue doesn't it? If his would work, I'd use a lower poly model for the realtime model that projected shadows and attach a 2D animated character with a lot of frames (so it's smooth and looks like a highly detailed model without having to use a normalshader). I would get the visual results I'm after plus a working stencil shadow all within a 2.5ish world.
© 2024 lite-C Forums