Jump to content

[Skyrim] CTD when reading modified Note mesh from floor


DanielCoffey

Recommended Posts

I have been struggling to understand the cause of a reproducible CTD when reading a modified Note from the floor and I need some expert help.

 

I should stress that it is a modified Notes mesh that is causing this issue. The vanilla Note mesh works perfectly but is constrained to be single-sided and I am trying to understand and circumvent that constraint if possible. We are talking about the Inventory mesh here, not the World mesh. Let me give you the details...

 

===

 

The vanilla Notes mesh contains two visible objects - a back surface and a front surface. Both share the same BSShaderTextureSet. This Note can be read in the inventory and can also be read when on a surface in the world.

 

My modified Notes mesh is very similar. I used the "Duplicate Block" function in NIFskope to create an identical BSShaderTextureSet and assigned it to the back surface of the Note which allows me to use two textures. This Note displays perfectly when folded in the Inventory. When you read it you can see the game engine apply the text to the inside of the Note and then begin the NoteOpen animation to display the Note and it is then opened fully for the player to see. If, however, the Note is on the floor (you can drop any Note using my modified mash to test this) and the player selects the "Read" option, there is an *almost* immediate CTD every time.

 

The sequence of events is as follows...

 

Player clicks on "Read" on the World view of the Note.

The UI layer appears with the "Take/Steal" option.

The Inventory View of the folded Note appears.

The text is applied to the front surface of the Note.

The NoteOpen animation begins to play but only gets a tiny way through the animation.

The CTD occurs.

 

Hanaisse from TES Alliance has examined the modified double-sided mesh and declared that it is well-formed. It works perfectly when read from your inventory. If you drop the same Note on the floor and Read it you get the CTD.

 

She thinks that when you click "Read" on the World view of the Note, certain hard-coded values are passed to the UI layer for display using the Inventory mesh of the Note. When the vanilla mesh is used, this step works correctly but in the case where the Inventory mesh has additional blocks, they are not in the hard-coded data sent to the UI so the animation fails and causes the CTD.

 

Both of us have pored over the Note01.hkx behaviour file (passed through hkxcmd.exe to make the components human-readable) and there is nothing in there or it's sub-files that even mentions blocks or the number of blocks. She is of the opinion that Havok does not care what you are passing it - it just displays the mesh and moves the bones.

 

My question is this... is there any way to get our hands on the information that is being passed here and "correct" the defect so that ALL blocks in the Note mesh are either passed or initialised? It only occurs at the moment of handover from the World to the UI layer. Is this handshake visible to us or is it locked inside the engine somewhere?

 

The reason I am attempting to do this in the first place is that I really want to create double-sided Notes for the Book Covers Skyrim mod and also to provide new Treasure Maps. I have had to pull all my mods that came with the double-sided Notes mesh until I can either get this fixed or write it off completely.

 

Personally I find it incredibly frustrating that this constraint is preventing a creative improvement to the game... not to mention the several weeks spent creating art assets for the Treasure Maps.

 

If any of you would like to take a look at this I would be very grateful. Here is a small ZIP of the modified mesh and all associated textures... http://www.dcoffey.co.uk/images/misc/data.zip

 

Thanks in advance,

 

Daniel.

Link to comment
Share on other sites

Yeah, that's me here too. :)

 

I'm going to try one more thing, Daniel (I hate giving up without a good explanation). But I really hope someone else can throw some ideas out.

 

Just to add, I've dissected the mesh extensively, I've even tried using TES5Edit to change the "note" to a "book" type. The issue is not the new meshes, this behaviour will occur on the vanilla notes as well if you change one of the textures. So, I'm stumped. :shrug:

Link to comment
Share on other sites

I'm not an expert but this puzzles me.

 

What will happen if you read an open book on the floor that you have just dropped from your inventory?

 

The reason I mention this because in Morrowind there is both *open*, *closed* books and some of them are also *copies* of both *open*, *closed* appearance when viewing them on the floor.

Link to comment
Share on other sites

I'm not sure what you're saying, Leo, as I've never played Morrowind.

But in this case there is two note objects. One you see in the world, folded and static, and the one you see in your inventory that's animated and opens to read it. This is the one we're having issues with.

Link to comment
Share on other sites

You haven't?  Well then just ignore what I just said about the books in Morrowind.

 

IIRC you can move a static object if it's a moveable object.  Correct?

 

I assume the folded one generates a CTD.

 

Also, does the books have the same behavior in Skyrim as it has in Oblivion (except for those books that have a Papyrus script attached if there are any books in Skyrim)?

Link to comment
Share on other sites

We haven't touched the World view of the Note at all. You can even get the vanilla Inventory mesh to do this if you give it a second BSTextureShaderSet.

 

While it is triggered only when you try to Read a Note that is on the floor, the CTD only occurs when the modified Inventory Mesh then tries to play its NoteOpen animation. By that point we are already in the UI screen with the Inventory mesh correctly displayed. It is as the NoteOpen plays that the CTD is observed.

 

The frustrating thing is that when you Read the exact same Note in your Inventory, it works perfectly. Drop that same Note on the floor and Read it - bang, desktop.

Link to comment
Share on other sites

We haven't touched the World view of the Note at all. You can even get the vanilla Inventory mesh to do this if you give it a second BSTextureShaderSet.

 

While it is triggered only when you try to Read a Note that is on the floor, the CTD only occurs when the modified Inventory Mesh then tries to play its NoteOpen animation. By that point we are already in the UI screen with the Inventory mesh correctly displayed. It is as the NoteOpen plays that the CTD is observed.

 

The frustrating thing is that when you Read the exact same Note in your Inventory, it works perfectly. Drop that same Note on the floor and Read it - bang, desktop.

Perhaps you need to touch the Notes World view, because I think I know what the problem is so just bare with me.  Okay I'm just gonna to think out loud for a second or two.

 

Since I've played all three games (Morrowind, Oblivion, Skyrim) and know how things works in-game.  Thus I also know what difference there is between Morrowind and both Oblivion, Skyrim.

 

The inventory for Morrowind is very different in comparison to both Oblivion and Skyrim, because you need to click on the "Take" word after you have read a book if you want to pick it up and put it into your inventory.

 

So perhaps that's your problem.

 

It seems if I understand it correctly, your note doesn't have the "Take" option once you drop the note from your inventory and then the game engine thinks that the *dropped* note on the ground still is an item of your inventory.

 

 

Does that makes sense to you?

Link to comment
Share on other sites

I am afraid that this is not the problem.

 

In Skyrim, Notes and Books in the World have the "Read" option only, whether you have just dropped them or whether they are a placed object from the vanilla game or a mod. There is no distinction between a book that you have just dropped or a book that a developer has put on a counter top via the Creation Kit. Only once you have "Read" the book can you see the Take or Steal options.

 

This problem does not appear to be anything to do with whether the book has ever been in my inventory or not.

Link to comment
Share on other sites

OK, this is definitely a "too much cheese before bedtime" idea borne of a sheer stubbornness to lose my work on the Treasure maps. Let me run this one past you all...

 

At the moment the Notes consist of a square Front and a square Back which share the same texture, yes? How about I JOIN the square Front and square Back to make a single RECTANGULAR mesh with a sharp crease at one edge? I might still need to keep a single vertex on the old "Back" object to prevent crashes but as long as the weight painting was done right, it should still crease properly when playing the NoteOpen and NoteClose animations, yes?

 

I can already see an issue with how the writing is going to be applied to the Note so this idea might have to be just for the treasure maps which now have none. Currently the text is rendered into a square texture of the same resolution as the Front texture and added to a copy of the front of the Note before being applied to the mesh (which is why my current textures are not the same aspect ratio on the front as the back one). We have a little control over where on the front texture this square of text is applied but I can fiddle with that.

 

If all this does is allow me to use the Treasure Maps I will be happy. If we can finagle the writing into the correct place without it looking to stretched, then great.

 

===

 

EDIT : I have been thinking about this and there is a simpler way of doing this but I am not sure about its efficiency.

 

I could keep the current front and back objects in the mesh unaltered and discreet but since they share a single texture, I can make the texture a rectangle and UV map the back to one half and the front to the other half. The texture is only referenced once in the NIF so in theory there should be no wasted VRAM? It is only for the Inventory view after all.

 

This would involve no change from the vanilla mesh apart from UV mapping. I will still have trouble with the Notes that have writing because of how the text is painted onto the front but for the Treasure Maps it should be fine.

Link to comment
Share on other sites

IT WORKS... for the Treasure Maps at least!

 

A rectangular texture with one half used for the Back and the other half for the Front displays perfectly in the inventory and also when you read a Note that is on the floor. I have not deleted any of the objects in the mesh - I have just redone the UV mapping to use different halves of the one shared texture.

 

Now all I have to do is see how the text behaves with that UV mapping.

Link to comment
Share on other sites

Ok, I see what you did there. It certainly sounds like a viable workaround, although not ideal.

 

I would really love to understand the root of the issue though, so I'm going to play with it in Blender and try some things.

 

If you want to test your above idea with actual notes, you could probably just scale down the PageText and reposition it.

Link to comment
Share on other sites

It might not be ideal but it works, even for the Notes with text.

 

It seems that when the text is rendered into an image, it is rendered to a square texture of the same size as the width of the page texture. Since my paper texture is now 2048x1024, it renders the text to a 2048x2048 square. Fortunately it shares the same origin as the paper - top left is 0,0. If I move the UV Set of the PageText object to be 0,0 to 0.5, 0.5 then it maps perfectly to the Front of the Note since it is now scaled back by 50%.

 

I do have to change the UV Map of the front of the Note to be a square too, just like we discussed when you helped me get the Notes double-sided in the first place but that is fine. All I have to do now is finesse the UV coordinates of Page Text so that it displays in the correct place on the page.

Link to comment
Share on other sites

Alright, if you're satisfied with that then I'm happy. :)

 

Perhaps one day we'll discover the reason behind this, but I just can't see it now.

Link to comment
Share on other sites

As far as I am concerned, it is resolved.

 

The rectangular texture idea worked to get round the fact that we are tied to one BSShaderTextureSet. The back surface maps to part of one half in a perfect aspect ratio to the note itself. No distortion. The front surface is stretched horizontally to map to a square area of the texture and the square of text is dropped on top of it.

 

I have found the values in the Page Text UV Set that control the left edge and the pair of values that control the top edge and scale (at the same time which was fun!).

 

I am now clear to do the Mesh and Texture work to get Book Covers Skyrim back on track and to re-release the Treasure Maps of Skyrim.

 

Thanks all for throwing ideas around and thanks Hana for all the time you spent on this. I know it is frustrating when you are trying to understand how something works (or doesn't work in this case) by trial and error.

Link to comment
Share on other sites

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
×
×
  • Create New...