Grozz

[HELP]Light and shadow mapping with shader

Recommended Posts

I just want to make shadows in MTA, like in this video: (at 2:33)

There is a dynamic light shader with shadows, but it has so many bugs.
mta-screen_2017-01-26_09-47-49.png

Share this post


Link to post

What resource is the second one? with some work those so called "bugs" could likely be fixed.

Also one thing I can think of, of how to do something like this would be something like a reverse green screen effect, in other words

  VNf5nrl.png

Pretty much you render the object with a different color view point behind it, using a matrix from the camera to the object, after that you use some sort of shader to drop the green background, and then you tint it black; then render that on the surrounding objects with the right set up. This is likely a very bad example; because it'd require each object to have a view point, and massive lag would occur, and it wouldn't be pretty. Just something I thought of off the top of my head, something similar but way less laggy could probably be done through a fx file and all you'd need to do is supply cords, but I haven't any experience with fx.

Edited by CodyJ(L)

Share this post


Link to post

I've made the second resource about 2 years ago. Way before MRT in shaders option was introduced. The whole purpose was to check if things were possible. That one required 1 frame to get scene depth (haven't used a proper orthographic projection matrix yet) and another to draw the outcome. The resolution is low proportionally to screen resolution and shadow range. Right now there are more possibilities. I'll try to release something decent in the near future.

Share this post


Link to post

The issue that will remain is object culling. It might be seen in cam2rt resource (mirror effect) when objects off screen disappear when certain distance is met (sa:render has this issue as well). MTA:Eir was supposed to  have custom cameras, this could solve most of the problems.

Edited by Ren_712

Share this post


Link to post

The object culling would cause shadows to suddenly appear/disappear as soon as objects are rendered / no more rendered by GTA, however maybe there is a way to prevent the shadows from just disappearing and fade them softly out as soon as the parent object is no longer on Screen...

This mod has some .fx files and an .asi file to bring the enhanced Android/IOS shadows to the PC version. So it would be theoretically possible to implement this natively in MTA.

 

Share this post


Link to post

Well it is possible with lua, just not as pretty.

Doesn't render ware have Dynamic shadows by default? Because if so I would if it'd be possible to some how unlock the dynamic lighting and the dynamic shadows aspect of render-ware in MTA.

  • Like 1

Share this post


Link to post

the gtasa shadows are a whole different thing. What i meant (and what is seen in the first video posted by Grozz) is shadowmapping. You even see 1 frame lag - fixable if you take changes in cameraPosition into the account. So the limit adjuster has nothing to do with it.

https://en.wikipedia.org/wiki/Shadow_mapping

It is fairly possible to implement that. Even shadow blurring.

 

Edited by Ren_712

Share this post


Link to post

SA has shadow cols; which is how it generates its shadows by default but they are often in accurate; and present a lot of issues if used on bigger objects (Rockstar were being absolutely -well, stupid as hell with their implementation of these, or in other words, shadow cols are a smart way of doing it, but they weren't thinking right when they actually added  them.)

 

(Also Ren, if you could implement these properly without alot lag that'd be awesome)

Edited by CodyJ(L)

Share this post


Link to post
On 28.1.2017 at 20:42, Ren_712 said:

...So the limit adjuster has nothing to do with it....

I know, i just wanted to say that the implementation would be similar to the limit adjuster:
The MTA team would have to implement mods like SA Shadow extender or SA:Render natively.
BTW Shadow cols seem to bug sometimes, however it could be a 3ds max export issue for me... Currently the best way for me is to ignore shadows at all.

Share this post


Link to post

It's not an issue for you, shadow cols in SA are junk if you read what I said above.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.