[MOD] Realtime Reflections

A curated forum for approved mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
User avatar
Interkarma
Posts: 3207
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Sun Sep 18, 2016 11:30 pm

Cool! Send it when you're happy, I'm looking forward to it. :)

ifkopifko
Posts: 118
Joined: Thu Apr 02, 2015 9:03 am

Re: Investigations on Realtime Reflections in Unity

Post by ifkopifko » Mon Sep 19, 2016 6:21 am

Hi there, the new lighting model looks very good, and I can't wait to see the "tuned light sources". :)

Is it intentional that the "day_sphere"/"player_torch" also casts shadows? I mean, it looks cool, but a bit weird in my opinion (since the player character does not really carry a torch, and also, the shadows suggest that the light source is positioned somewhere slightly below the camera, but is not visible). If possible, I would consider disabling shadowcasting for that particular light source.

The "day_spehre" also casts shadows in the exterior... not sure if it has any considerable performance impact, just wanted to point it out.

User avatar
Interkarma
Posts: 3207
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Mon Sep 19, 2016 7:00 am

The point light effect surrounding player at night and in dungeons is also present in vanilla Daggerfall. The player does indeed appear to be carrying a torch of some kind, and it's a matter of preference whether this should cast shadows or not. I had previously disabled shadows for this light source (my preference matches yours), but re-enabled again with the recent changes to see what others thought. I'll wait for more feedback before disabling by default. An INI option is probably ideal.

The day sphere is a totally different light source used to simulate indirect lighting during daytime hours only. It does not cast shadows. You can confirm this by checking the properties of Exterior/SunlightRig/IndirectLight in game scene with Unity.

ifkopifko
Posts: 118
Joined: Thu Apr 02, 2015 9:03 am

Re: Investigations on Realtime Reflections in Unity

Post by ifkopifko » Mon Sep 19, 2016 7:35 am

I do not argue that the effect was there also in vanilla DF... I only meant the shadows. I was not sure whether shadowcasting was intentional or not, I do not have a problem with it either way. :)

Could be a mistake on mi side, I have no knowledge as to when the day_sphere changes to player_torch, and in the savegame I used it was evening (sun was above the horizon and have cast shadows). :oops: Maybe it was already "the_torch_time".

User avatar
Interkarma
Posts: 3207
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Mon Sep 19, 2016 8:44 am

Sounds like the torch, it switches on at dusk before the sun goes down fully. By then the indirect lighting will have been scaled down to almost nothing.

I'll add some additional shadow options soon to go with the dungeon shadow option, including disabling torch shadows.

User avatar
Arl
Posts: 199
Joined: Sun Mar 22, 2015 10:57 am

Re: Investigations on Realtime Reflections in Unity

Post by Arl » Mon Sep 19, 2016 12:09 pm

I think the shadow is nice, but an option for disabling the player torch completely would be also nice, since you never feel you are in the dark when you're always illuminating your surroundings, and I think there are some spells that also lit your environment to make you see in dark areas.

Or maybe that's something for mods to handle.
My Deviantart page, I have some Daggerfall stuff in there.

User avatar
Nystul
Posts: 1122
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Mon Sep 19, 2016 3:18 pm

pull request is issued.

take a seat and have a rest.

Image


dungeon floor textures reflection properties need to be fixed whenever we encounter one that is not tuned right.
It also seems that not all dungeon lights are spawned right now. And some additional lights are spawned somewhere else (daggerfall castle main hall has 4 lights not in positions of light sources, and some light sources do not have lights spawned)

User avatar
Interkarma
Posts: 3207
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Mon Sep 19, 2016 10:06 pm

Phobos Anomaly wrote:I think the shadow is nice, but an option for disabling the player torch completely would be also nice, since you never feel you are in the dark when you're always illuminating your surroundings, and I think there are some spells that also lit your environment to make you see in dark areas.

Or maybe that's something for mods to handle.
I'm happy to do this. Will add an option to disable auto-torch entirely.
Nystul wrote:pull request is issued.

take a seat and have a rest.

Image
Looks great! :)

I wonder if we should add a light to fireplaces? For better flame effect, will need to make light jump around a little. What do you think?
Nystul wrote: dungeon floor textures reflection properties need to be fixed whenever we encounter one that is not tuned right.
It also seems that not all dungeon lights are spawned right now. And some additional lights are spawned somewhere else (daggerfall castle main hall has 4 lights not in positions of light sources, and some light sources do not have lights spawned)
Dungeon lights are an entirely different kettle of fish. Interior maps don't define lighting positions at all, whereas dungeons define a simplified model of their light positions that is discrete from their nearby billboards. For a good example, look at the triplet of torches on the throne platform in Privateer's Hold. The dungeon light itself sits in the centre of the three torches, effectively casting light from all three as a combined light source. The two statues only have one dungeon light each, despite there being two torches. There are also light billboards which are "unlit" and have no light source and no emissive properties (up ramp past exit room is an example).

This isn't so obvious in vanilla Daggerfall, and even not that bad in DF Unity until shadows get involved. The subtle jump in realism makes those shortcuts stand out even more.

The obvious answer is to generate lights in the same way interiors do now, and completely ignore the light positions in RDB data. Then you can tune up in a similar manner to interiors. It will look a lot better overall, but will have a performance impact, especially where there's lots of overdraw, which is the Achilles heel of deferred rendering on cards with low fill rates. Some examples of high overdraw are in PH throne room and Direnni stair room, which both benefit from Daggerfall's shortcut lighting.

I don't really have a better solution right now. Deferred lights are very cheap until you get lots of them overlapping, then it's down to how quickly your card can pump out pixels because there's lots of overdraw. With shadows enabled, the number of rendering passes goes up, which adds even more per-frame time. It should perform fairly well on a reasonable GPU (say a 660 or 760) but will drag on cards with poor fill.

Something to look at later I guess. Dungeon lights are just a very different beast with a whole set of new problems. :)

User avatar
Nystul
Posts: 1122
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Tue Sep 20, 2016 7:50 am

Interkarma wrote: Looks great! :)

I wonder if we should add a light to fireplaces? For better flame effect, will need to make light jump around a little. What do you think?
thank you!

We would have to try it and test if it works out.
My main concern would be that a point light might not work so well for the fireplaces.
Floor textures currently are tuned in a way that the sizes of the lights' reflections look reasonable on them. This depends mainly on the smoothness value of the textures together with the light intensity. Light intensity is also coupled with how the general room looks after receiving lighting. So one can not just increase the value until the size of the light's reflection is large enough to match the light source (It will as a side-effect also get over-bright pretty fast). So it's always a compromise.
So I would expect some difficulties to try to make the point light reflection look approximately the same size as the fireplace but let's give it a try.
Interkarma wrote:
Nystul wrote: dungeon floor textures reflection properties need to be fixed whenever we encounter one that is not tuned right.
It also seems that not all dungeon lights are spawned right now. And some additional lights are spawned somewhere else (daggerfall castle main hall has 4 lights not in positions of light sources, and some light sources do not have lights spawned)
Dungeon lights are an entirely different kettle of fish. Interior maps don't define lighting positions at all, whereas dungeons define a simplified model of their light positions that is discrete from their nearby billboards. For a good example, look at the triplet of torches on the throne platform in Privateer's Hold. The dungeon light itself sits in the centre of the three torches, effectively casting light from all three as a combined light source. The two statues only have one dungeon light each, despite there being two torches. There are also light billboards which are "unlit" and have no light source and no emissive properties (up ramp past exit room is an example).

This isn't so obvious in vanilla Daggerfall, and even not that bad in DF Unity until shadows get involved. The subtle jump in realism makes those shortcuts stand out even more.

The obvious answer is to generate lights in the same way interiors do now, and completely ignore the light positions in RDB data. Then you can tune up in a similar manner to interiors. It will look a lot better overall, but will have a performance impact, especially where there's lots of overdraw, which is the Achilles heel of deferred rendering on cards with low fill rates. Some examples of high overdraw are in PH throne room and Direnni stair room, which both benefit from Daggerfall's shortcut lighting.

I don't really have a better solution right now. Deferred lights are very cheap until you get lots of them overlapping, then it's down to how quickly your card can pump out pixels because there's lots of overdraw. With shadows enabled, the number of rendering passes goes up, which adds even more per-frame time. It should perform fairly well on a reasonable GPU (say a 660 or 760) but will drag on cards with poor fill.

Something to look at later I guess. Dungeon lights are just a very different beast with a whole set of new problems. :)
Ah this explains some effects I see inside of dungeons ;) Yeah let's keep that in mind for the moment. I expect some testers to come across some light/shadow/reflections issues in dungeons - so I just wanted to make sure we are all aware of these issues beforehand.

User avatar
Interkarma
Posts: 3207
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Tue Sep 20, 2016 9:07 am

Two of the new shaders are giving me a little grief in cloud build (on Windows for D3D9 variants only).
shader-error-onbuild.JPG
shader-error-onbuild.JPG (70.33 KiB) Viewed 2082 times
I think the below thread has a good solution, using a pragma to just build shader for D3D11.

http://forum.unity3d.com/threads/shader ... ld.325829/

Code: Select all

#pragma only_renderers d3d11
Are you happy for me to quickly make that change to those two shaders, rather than use a PR?

Daggerfall Unity's minimum spec is technically D3D11 anyway, but I am semi-attempting to keep D3D9 alive for those few WinXP holdouts. I think it's fair to lose something like reflections though if someone hasn't updated to D3D11 by now.

Post Reply