Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change TexClampMode in BSEffectShaderProperty #96

Open
Candoran2 opened this issue Oct 7, 2022 · 3 comments
Open

Change TexClampMode in BSEffectShaderProperty #96

Candoran2 opened this issue Oct 7, 2022 · 3 comments

Comments

@Candoran2
Copy link
Member

TexClampMode in BSEffectShaderProperty is currently interpreted as an integer rather than an enum value. It cannot be intepreted as an member of the existing TexClampMode due to that being stored as an uint and the adjacent fields in the BSEffectShaderProperty.

Preferably, it should be possible to find a way to keep the access to the tex clamp mode uniform across the BSLightingShaderProperties and return the same type.

One possible solution would be to create a bitfield to be used in both places.

<bitfield name="TextureProperties" storage="uint">
    <member width="1" pos="0" mask="0x01" name="wrap t" type="bool" />
    <member width="1" pos="1" mask="0x02" name="wrap s" type="bool" />
    <member width="8" pos="8" mask="0xFF00" name="Lighting Influence" type="byte" />
    <member width="8" pos="16" mask="0xFF0000" name="Env Map Min LOD" type="byte" />
</bitfield>

or even two, with the second one missing the extra members like so:

<bitfield name="TextureProperties" storage="uint">
    <member width="1" pos="0" mask="0x01" name="wrap t" type="bool" />
    <member width="1" pos="1" mask="0x02" name="wrap s" type="bool" />
</bitfield>

In order to prevent access to members that the rest don't have/are non-functional.

However, I want to hold off on this while the niftools addon is being overhauled. Also, since I don't actually know what the extra bytes do other than going off their name, I don't yet know of a meaningful name to assign to the field.

@hexabits
Copy link
Member

hexabits commented Nov 1, 2022

I believe this came directly from the engine serialization, looking at the decompiled EXE. Just because I followed Bethesda's byte alignment and packing from their serialization doesn't really mean it has to stay that way for the nifxml spec. Pretty sure there are fields all over the nifxml spec that don't follow their exact read operations because splitting them off was better conceptually for the spec.

@hexabits
Copy link
Member

hexabits commented Nov 1, 2022

If they're kept grouped to align with Bethesda serialization, not really sure what it should be named though. Lighting Influence and Env Map Min LOD very loosely fit into "Texture Properties". Env Map Min LOD chooses what cubemap convolution to choose from i.e. a cheap way of blurring reflections (e.g. chrome vs a rougher metal). Lighting Influence is how much the ambient lighting gets taken into account for lit effects.

@Candoran2
Copy link
Member Author

Thanks for the response. "Texture Properties" makes sense, I'll probably update once the other major xml changes are out of the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants