[REQ] Could someone make this anti z-fighting script for me?

Post » Tue Oct 29, 2013 10:50 pm

Over a year ago I made an identical thread like this one and I got some help which I am grateful for, but the work is not 100 % finished because it has some bugs. Link to old thread where you can see the discussion: http://www.gamesas.com/topic/1375029-req-could-someone-make-this-script/

In short, here's why I request this:

Many people have Z-fighting issues with flickering mountains in Skyrim.
One of the ways to reduce this is to put fNearDistance=23.0000 (default value is 15.0000) in Skyrim.ini under the [Display] section. This reduces the flicker by quite a lot (like 30-35 %), but it also causes clipping issues when you look extremely close to objects. The reason is becasue, I think, increasing the fNearDistance value moves the near clipping plane further away.
So the higher the number, the less the flicker, but also the more clipping-issues when really close to objects.

Here's what I request:

A workaround for this could be to add a script that automatically changes fNearDistance to 15.0000 (which is the default value) when you're in interiors, because then it's much more likely that the player is right next to walls & objects and looking straight in them. In interiors we also don't need to have a higher fNearDistance number, because there is no flicker to reduce since you obviously can't see the mountains from interiors. The script would then automatically change the value back to a preferred one (the one you have added yourself in Skyrim.ini) when you're in exteriors.

So... all in all the script is attached to the fNearDistance .ini setting and automatically changes it. It needs to detect if the player is in interiors or exteriors. The script also needs to remember what value you originally have added in the Skyrim.ini yourself; if this is not possible, then the script could add its own .ini where you can place your preferred fNearDistance value when you're in exteriors.

Could someone make this script? I, and I'm sure many other people, would appreciate it a lot! The mod would be released on Nexus and you would be duly credited.

Here's the previous script and .esp which JustinOther made in the previous thread I linked to, but which still have some bugs:

http://www38.zippyshare.com/v/31818290/file.html

Here's my posts in the previous thread regarding the bugs which this previous script and .esp has:

Spoiler

I tested it and it worked in some ways but not in other ways. Here's what I found out:

- Before I installed the test you uploaded, I saved two new saves. One in exterior and one in interior. When I installed your test, it worked properly when I loaded the save game I last had saved while being in interior space. However, when I loaded the save game I last had saved while being in exterior space, and then moved to an interior space to test the difference, I still got clipping. The pop-up menu script started in both saves though so that worked at all times.

So, in other words, it seemed that I had to load a game where I was in an interior space for the script to work to force the interior value to 15.0000. It didn't work (it wasn't forced to 15.0000 in interiors) when I loaded a game where I was in exterior space, and then travelled to an interior space in the game.

- Also I wonder if it's possible to make it so you change 1.0 point at a time. When I changed the outside values in game through the pop-up menu, it changed 5.0 points at a time.
- And one last thing, I couldn't find a way to change back the settings once the menu had poped up and I had clicked done. Is there any way the pop-up menu could be attached to a spell or an item or something that you are given, so you can change the outside settings several times (for instance if you regret putting the setting to a certain number)?

I tested some more, here's what I found out:
- The forced interior to 15.0000 worked when I loaded the save game in exterior and when I through the pop-up menu changed the outside/exterior value to 15.0000 as well.
- The forced interior to 15.0000 did not work when I loaded the save game in exterior and when I through the pop-up menu did nothing and clicked done (in other words left the outside/exterior value at 25.0000).

User avatar
Dezzeh
 
Posts: 3414
Joined: Sat Jun 16, 2007 2:49 am

Post » Tue Oct 29, 2013 11:52 pm

Re: these comments - what did you have the setting at in your ini before loading the game? Was it 25? I'm looking at the script but knowing this would help to figure out the problem, because it's hard to know what was going on when you say "it worked" or "it didn't work" unless I know the original ini value.

User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm

Post » Tue Oct 29, 2013 9:23 pm

Yes it was 25.000 in my ini as far as I can remember (even though it was over a year ago :P). Give me a few minutes and I'll try again quickly right now.

User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Wed Oct 30, 2013 12:26 am

Okay, tested again and this time I tried with .ini values 15 and 25.
Same thing happened with both .ini settings (when I started the game in an exterior space, and the moved into an interior one, there was still clipping as if the interior value was 25 and not 15 like it was supposed to be).

Also, I tested some more and noticed that if I started the game in an interior space, there was no clipping in both the interior space and exterior spaces, meaning that the value was 15 in both interior and exterior spaces.

Right now I've changed the recommended fNearDistance setting though to 23 instead of 25 I had a year ago, because 25 simply causes too much clipping. It would therefore be good if the .esp allowed you to change values by 1 point at a time instead of 5 like it does now (so you can change it to 23 instead of 25).

User avatar
Sheeva
 
Posts: 3353
Joined: Sat Nov 11, 2006 2:46 am

Post » Tue Oct 29, 2013 7:36 pm

I'm going to post the scripts here so it's easier for others to comment

Spoiler
ScriptName NearDistanceQuestScript extends Quest ConditionalFloat Property fInsideDistance Auto Conditional ;set to 15.00 in the CKFloat Property fOutsideDistance Auto Conditional ;set to 0.00 in the CKMessage Property NearDistanceMESG AutoEvent OnInit()	RegisterForSingleUpdate(5)EndEventEvent OnUpdate()	If fOutsideDistance == 0.0		fOutsideDistance = 25.0		Menu()	EndIfEndEventFloat Function Menu(Bool abMenu = True, Int aiButton = 0)	While abMenu		aiButton = NearDistanceMESG.Show()		If aiButton != -1			If aiButton < 2				If aiButton == 0					fOutsideDistance += 5.0				ElseIf aiButton == 1					fOutsideDistance -= 5.0				EndIf				Debug.Notification("fNearDistance while outside set to " + fOutsideDistance)			Else				abMenu = False			EndIf		EndIf	EndWhile	If (Game.GetForm(0x00000014) As ObjectReference).IsInInterior()		Utility.SetINIFloat("fNearDistance:Display", fInsideDistance)	Else		Utility.SetINIFloat("fNearDistance:Display", fOutsideDistance)	EndIfEndFunction

Spoiler
ScriptName NearDistancePlayerAliasScript extends ReferenceAliasBool bInsideNearDistanceQuestScript Property QuestScript AutoEvent OnLocationChange()	If bInside != GetReference().IsInInterior()		bInside = !bInside		If bInside			Utility.SetINIFloat("fNearDistance:Display", QuestScript.fInsideDistance)		Else			Utility.SetINIFloat("fNearDistance:Display", QuestScript.fOutsideDistance)		EndIf	EndIfEndEvent

From the looks of it, it seems like the script should be working to change the INI values when you move from inside to outside or vice-versa. So there seems to be three possibilities.

  • 1) First is that perhaps the INI setting is only read by the game at boot up (though that seems odd, since you apparently are able to effect changes in the popup that appears right away)
  • 2) The game perhaps only reads the INI setting while it is loading the new area (i.e. during the loading screen) and maybe OnLocationChange only fires -after- the loading screen [this seems most likely to me, since the game is technically rendering and preparing graphics while the loading screen is up]. One way to test if this is true is to go to an interior like a dungeon, and then go through a second load door inside the dungeon that takes you to another interior - the clipping should be corrected in the second area if this is the case.
  • 3) maybe onLocationChange isn't firing in the place you're testing. Probably unlikely, but I've never gotten a satisfactory answer as to when exactly this function is reliably going to happen.

Edit: ahem, I mean 3 possibilities :D

User avatar
Nana Samboy
 
Posts: 3424
Joined: Thu Sep 14, 2006 4:29 pm

Post » Wed Oct 30, 2013 6:50 am

If number two is the case after all, I may need some help coming up with a solution. I have a feeling it isn't going to be easy to script, then. You would have to detect when someone is about to enter an interior, which is much more difficult. The only possibility I can think of is somehow using aliases to dynamically detect when the player activates a load door trigger, and then figuring out what cell that load door is attached to (is there even a function for that?)

User avatar
Austin England
 
Posts: 3528
Joined: Thu Oct 11, 2007 7:16 pm

Post » Tue Oct 29, 2013 8:38 pm

I'll check number two case right after dinner, so in 20 minutes or so, because I haven't tried going into a second interior level before. I've only tried going in a house and then outside again.

I sadly won't be able to help with any scripting because my knowledge is 0 %; I hope someone else might be able to help :P

User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am


Return to V - Skyrim