KoW - D.R.E.A.M.

A curated forum for compatible and maintained 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.
Post Reply
User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: KoW - D.R.E.A.M.

Post by pango »

pango wrote: Mon May 06, 2019 9:09 pm Modifying the code was easy: https://github.com/petchema/daggerfall- ... map-levels
But I'm not quite sure what to look at :(
Ok, I did more perceptual tests, then some analysis, using DREAM RC4 and no post processing mod on my screen (1080p).

First I checked that a mipmap level of 8.0 looked smooth in the distance: that works.
Then I checked how far the transition between level 7.0 and 8.0 could be pushed away before aliasing appears. In my tests, 50.0 was about right.
Then I checked how far the transition between level 0.0 and 7.0 could be pushed away before aliasing appears. In my tests, 4.5 was close to the max.
But what's the scale between the two? I assume the goal is to keep the angular diameter of pixels about constant. Pixel widths varies according to 1/d, but their height decreases faster because the surface also appears more and more tilted (from camera point of view). I spare you the details, but height seems to vary in 1/d².
Mipmap scale is logarithmic (vs pixel size), so you end up with level = const -2 log2(d)
In other words, you should gain one mipmap level each time the distance increases by a sqrt(2) factor.
And it matches almost perfectly with the two bounds found perceptually!

Code: Select all

			float mipMapLevel;
			if (dist < 4.375f)
				mipMapLevel = 0.0;
			else if (dist < 6.25f)
				mipMapLevel = 1.0;
			else if (dist < 8.75f)
			 	mipMapLevel = 2.0;
			else if (dist < 12.5f)
			 	mipMapLevel = 3.0;
			else if (dist < 17.5f)
			 	mipMapLevel = 4.0;
			else if (dist < 25.0f)
			 	mipMapLevel = 5.0;
			else if (dist < 35.0f)
			 	mipMapLevel = 6.0;
			else if (dist < 50.0f)
				mipMapLevel = 7.0;
			else
				mipMapLevel = 8.0;
However I don't know how my perceptual tests are portable to other systems...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: KoW - D.R.E.A.M.

Post by Nystul »

nice findings!

somewhere in the unity built-in shaders (can be downloaded for each unity version) there should also be the mip map selection mechanism in there I think - but I never had the time to really look through all those files

pretty sure, it will approximately match your values

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: KoW - D.R.E.A.M.

Post by King of Worms »

Thanks for looking at it Pango, I would never be able to do the math behind it :lol:

The most obvious example of too sharp mipmaps can be seen in Daggerfall-biom terrain type, and in the Jungle-winter terrain type.

This could help up the visuals quite a bit if you manage to improve on it.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: KoW - D.R.E.A.M.

Post by pango »

Nystul wrote: Sun Jun 23, 2019 4:16 pm somewhere in the unity built-in shaders (can be downloaded for each unity version) there should also be the mip map selection mechanism in there I think - but I never had the time to really look through all those files

pretty sure, it will approximately match your values
Well, what's a bit specific (but maybe they have functions for that case too? or more general/complex functions that depend on surface normal...) is that in the distance the terrain texture is seen almost tangentially, so LODs should drop faster than standard; From what I understand that was the root problem with using an existing function unmodified.

Distance for mipmap level changes:
lod.jpg
lod.jpg (19.13 KiB) Viewed 2165 times
legend:
  • blue: current DFU function
  • red: my proposed function for DREAM higher res textures
  • yellow: my proposed function modified for classic textures
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: KoW - D.R.E.A.M.

Post by King of Worms »

Seems on point to me .)

Ive grabbed some screens today.

1st - interiors
Spoiler!
03.jpg
03.jpg (501.14 KiB) Viewed 2155 times
02.jpg
02.jpg (508.55 KiB) Viewed 2155 times
04.jpg
04.jpg (473.53 KiB) Viewed 2155 times
Last edited by King of Worms on Sun Jun 23, 2019 7:38 pm, edited 1 time in total.

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: KoW - D.R.E.A.M.

Post by King of Worms »

And some dungeons

Notice the observing small red eyes at the ceiling duct in the 1st screen .)
3rd image is with a hand held torch active
Spoiler!
observing.jpg
observing.jpg (402.82 KiB) Viewed 2153 times
12.jpg
12.jpg (385.37 KiB) Viewed 2153 times
09.jpg
09.jpg (539.16 KiB) Viewed 2153 times

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: KoW - D.R.E.A.M.

Post by pango »

King of Worms wrote: Sun Jun 23, 2019 7:35 pm And some dungeons

Notice the observing small red eyes at the ceiling duct in the 1st screen .)
3rd image is with a hand held torch active
Looking good, I can't wait!
I particularly like the stones and beams walls of the last screenshot, it's nicely uneven :)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: KoW - D.R.E.A.M.

Post by King of Worms »

Thanks, glad you like it!
Ive worked on the rats emissive eyes, made em more darker and they have slight halo around them.
Still not sure if I will use this...
rat.jpg
rat.jpg (384.81 KiB) Viewed 2131 times
Plus the Shedungent witch :)
03.jpg
03.jpg (467.89 KiB) Viewed 2131 times

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: KoW - D.R.E.A.M.

Post by pango »

pango wrote: Sun Jun 23, 2019 7:08 pm Well, what's a bit specific (but maybe they have functions for that case too? or more general/complex functions that depend on surface normal...) is that in the distance the terrain texture is seen almost tangentially, so LODs should drop faster than standard; From what I understand that was the root problem with using an existing function unmodified.
Meh, if you look at the ground from high above (say, on top of a high building), you're no longer looking at the texture tangentially and the formula breaks down, textures below you are too blurry :(
I'm probably reinventing the wheel...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: KoW - D.R.E.A.M.

Post by King of Worms »

pango wrote: Sun Jun 23, 2019 10:03 pm
pango wrote: Sun Jun 23, 2019 7:08 pm Well, what's a bit specific (but maybe they have functions for that case too? or more general/complex functions that depend on surface normal...) is that in the distance the terrain texture is seen almost tangentially, so LODs should drop faster than standard; From what I understand that was the root problem with using an existing function unmodified.
Meh, if you look at the ground from high above (say, on top of a high building), you're no longer looking at the texture tangentially and the formula breaks down, textures below you are too blurry :(
I'm probably reinventing the wheel...
| saw u was able to solve this issue on the github, great job :!:

Post Reply