shadowmage45 / TexturesUnlimited

KSP Shader, Texture, and Modeling Utilities
GNU General Public License v3.0
29 stars 17 forks source link

(Question) Is it possible to change the max distance at which TU is active? #88

Open jrodrigv opened 4 years ago

jrodrigv commented 4 years ago

I have noticed that a non-active vessel with SSTU recoloured textures parts, is suddenly losing the recolour if the distance with the active vessel (maybe is the camera?) is greater than X meters (I think it can be 1km but not exactly sure).

Is this hardcoded somewhere? Is it possible to increase this range?

Thanks!

shadowmage45 commented 4 years ago

The reflection system is all stock code since KSP 1.7 -- TexturesUnlimited has no influence on it, doesn't touch it, and only interacts with it through the shaders.

With that said, I'm pretty sure I know what you are referring to -- it is the 'area covered by the reflection probe', which in KSP is centered roughly on the camera, and of a preset/fixed size. Anything outside of that range will not receive reflections.

Unfortunately, this is specified by the KSP source code when they setup the reflection probe in the scene and attach it to the camera, and they have not bothered to make the 'range' setting public (only the reflection update speed, and texture resolution). It might be something that I could expose a configuration setting for, but I would much rather keep TU out of the stock reflection stuff.

However -- there is more to it than simply enabling a larger range on the reflection probe. As the reflections seen on any mesh depend on where the probe is located, any reflections on these 'far away' objects would be terribly distorted, unless each 'far away object' had its own reflection probe -- which adds major overhead to the graphics system to constantly calculate the environment reflection maps.

I would say to file a bug report on this in the stock bug-tracker, but due to the above mentioned complexity, I highly doubt that they will do anything about it.


TLDR: Yes, it is hard-coded, but not by TU. It is hardcoded in the stock KSP code. No, it cannot be configured.

jrodrigv commented 4 years ago

Thank you for the answer! I was looking at your source code and I found the exact code where the the reflection probe is created.

It would very nice if it was possible to have a reflection probe per loaded vessel, with a size big enough to cover the distance between the active vessel and the target vessel - not sure if this can actually work.

shadowmage45 commented 4 years ago

If you are referring to this code: https://github.com/shadowmage45/TexturesUnlimited/blob/master/Plugin/SSTUTools/KSPShaderTools/Addon/ReflectionManager.cs It has been disabled for several releases (see the comment lines at the top of the file, commenting out the KSPAddon attribute). Stock does all reflection-related stuff.

With that said -- that is exactly what I used to do; create one reflection probe per-vessel, centered on the vessel. It worked decently, but due to some of the overhead for the hacky way I had to capture reflections, it was very noticeable on performance.

jrodrigv commented 4 years ago

Thank you very much for the explanation I didn't see the comments. Now everything is much clearer now for me.

Regards

El mar., 11 feb. 2020 a las 23:17, shadowmage45 (notifications@github.com) escribió:

If you are referring to this code:

https://github.com/shadowmage45/TexturesUnlimited/blob/master/Plugin/SSTUTools/KSPShaderTools/Addon/ReflectionManager.cs It has been disabled for several releases (see the comment lines at the top of the file, commenting out the KSPAddon attribute). Stock does all reflection-related stuff.

With that said -- that is exactly what I used to do; create one reflection probe per-vessel, centered on the vessel. It worked decently, but due to some of the overhead for the hacky way I had to capture reflections, it was very noticeable on performance.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shadowmage45/TexturesUnlimited/issues/88?email_source=notifications&email_token=AB7IR64ABIQHTKT5SX3FF73RCMPV3A5CNFSM4KTIQXBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELOJZFI#issuecomment-584883349, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7IR64A2OEWDCLE7DIJZJ3RCMPV3ANCNFSM4KTIQXBA .