Jump to content

[1.0.5] Reflection Plugin Continued 2.0


Starwaster

Recommended Posts

I use fasa's because the one you posted back a couple pages doesn't work. It spammed errors.

I can assure you that fasa parts also start blue during sunrise/sunset. You can see the one tank in that picture is blue. The others aren't because they are in direct sunlight. This has been mentioned in the fasa thread before but nobody has had an answer to it as of yet so I came here. Basically to get the "blue" to go away you just time warp for a while and it vanishes, but it is annoying that it is there in the first place and it comes back after reloading the vessel.

Edited by raidernick
Link to comment
Share on other sites

I use fasa's because the one you posted back a couple pages doesn't work. It spammed errors.

I see, so the blue bothered you enough to tell me, but not a few pages of null reference errors.

I need FEEDBACK or things don't get fixed. I got feedback from exactly one person who said it was working ok. Sigh. Oh well, I guess that means at least one of the reflective shaders in the plugin still works

That's a serious problem though and it has to get solved before I can even begin looking at the blue issue. It means that even more shaders are missing from the latest KSP builds (stock Unity shaders, not KSP shaders) and while I know how to put them back in using Visual Studio on a Windows platform, I'm currently stuck with Monodevelop on a Mac and so far I've been unable to embed resources in the DLL and then successfully retrieve them and turn them into a usable shader.

I can assure you that fasa parts also start blue during sunrise/sunset. You can see the one tank in that picture is blue. The others aren't because they are in direct sunlight. This has been mentioned in the fasa thread before but nobody has had an answer to it as of yet so I came here. Basically to get the "blue" to go away you just time warp for a while and it vanishes, but it is annoying that it is there in the first place and it comes back after reloading the vessel.

The engine underneath is in sunlight but the two tanks on top of it are not? I'm sorry but I'm just not seeing how that's possible, and so far have not been able to replicate the problem. I set up an arrangement just like you have in that picture but it's just not happening. Sorry.

Let's try a little experiment. Copy the following text into a file ending in cfg. (let's call it blue_test.cfg)


@PART
[*]:HAS[@MODULE[ReflectiveShaderModule]]
{
@MODULE[ReflectiveShaderModule]
{
@realTimeReflection = True

}
}

See what effect that has. (besides making things laggy. It might or it might not, depends on your system)

Could it be that the first frame it renders, only the AFG is visible and the PQS isn't, and then it doesn't render again for a while?

It would have to be more than just one frame. AFAIK all of those parts are set to render one face (of the cubemap) per frame. So at least 6 frames have been rendered in those screenshots. And I think he has it set to 45 seconds between re-renders. (6 frames, 45 seconds then another 6 frames)

Link to comment
Share on other sites

Oh interesting, Monodevelop uses the default namespace and not the namespace I'm working out of when dealing with resource streaming.

That would have been so helpful to know :(

Screw you Monodevelop!

Edit: Ok, embedding and retrieving was easier than I thought, but my success was masked by the fact that most of the shaders are being rejected as not supported.

So far I only have

  • Reflective/VertexLit
  • Reflective/Bumped Diffuse
  • Reflective/Bumped VertexLit (but no bumpmap)

I don't get the 'not supported' bit because they're the same shaders loaded the same way. For instance, Bumped Specular (which is probably the best looking and is used by FASA) works in the plugin I compiled for 23.5 works for 24.2 but the one that I compile for 24.2 does not.....

Edited by Starwaster
Link to comment
Share on other sites

NEW UPDATE

https://github.com/Starwaster/Reflection-Plugin-Continued/blob/Dev/ReflectionPlugin.DEV.1.2.zip

Restores all missing shaders (the last experimental did not have them)

Changelog for 1.2.0

  • Restored missing shaders (compiled versions)
  • Increased default FarClipPlane value to 1000000000f (!!!!!)
  • Mark refresh map as dirty when coming of rails.
  • Caps reflection map refresh rate when time warping. (shouldn't lag when time warping now, BUT NEED FEEDBACK SO I KNOW IT WORKS FOR PEOPLE WHO ARENT STARWASTER. THIS MEANS YOU!!!!)
  • Removed unnecessary debug messages.
  • Enhanced exception handling and shader fallback.
  • Added Starwaster/Bumped Specular shader (reflective, WIP, highly experimental, use at your own risk)
  • Fed the cats.

So, #2 and #3 are aimed at reducing 'the blue' except that I have no idea if it will really work because I don't know for sure what's been afflicting those who see the blue. However I did notice when debugging this that the FarClipPlane was being reduced in some circumstances such that if I moved the camera up close and looked into the reflection that the world was missing after a very short distance, causing a lot more of the sky to be visible than should have been. Turns out the default clipping plane was at 100m so the assigned plugin values were probably being lost. So that's one possible cause for the blue.

It's likely not the only one and probably not the one that was reported. I did run into a situation where a part suddenly turned blue when loading that ship. The reflection map camera had not generated a reflection map yet. The ship was orbiting Minmus so there's no way that blue could have been the sky. So I put in additional code to force the camera to refresh when the ship comes off rails but I don't think it helped. I'll have to look at the camera code again because it seems like there's too long a delay before the first reflection map is generated when realtime reflections are turned off.

Finally, I've figured out how to add new shaders and have added the first new one. It's an edited version of KSP/Bumped Specular but with reflection mapping. It works in that the texture behaves more like other KSP textures but has environment mapping. I'm not very happy with it yet because the reflections are too weak. Weaker than the Reflective/* shaders when I intended that it be stronger. So it's very much a WIP. You can go ahead and try it out. The shader name is Starwaster/Bumped Specular

Link to comment
Share on other sites

The good news is the new plugin allows parts that contain the module to load MUCH faster. When spawning a part it used to hang the game and lag the vab. Now it works great. Unfortunately the "blue" is still there.

Ok I'll repost this. Maybe it gets a response this time :)


@PART
[*]:HAS[@MODULE[ReflectiveShaderModule]]
{
@MODULE[ReflectiveShaderModule]
{
@realTimeReflection = True

}
}

try that then FEEDBACK ​(Lag is not unexpected. Just tell me if the blue persists)

Edited by Starwaster
Link to comment
Share on other sites

Still no response. Ok, for the time being, my work here is done. The new shader still needs some work so I'll do that sometime soonish but for now I'm going to go resume work on Ioncross.

If someone with the blue problem tries my suggestion above and reports what effect it does or does not have it might give me some handle on the problem.

Until then, au revoir.

Link to comment
Share on other sites

Still no response. Ok, for the time being, my work here is done. The new shader still needs some work so I'll do that sometime soonish but for now I'm going to go resume work on Ioncross.

If someone with the blue problem tries my suggestion above and reports what effect it does or does not have it might give me some handle on the problem.

Until then, au revoir.

It doesn't fix it.

Edited by raidernick
Link to comment
Share on other sites

  • 1 month later...
Is this still compatible with .25? Because I've installed FASA and i dont get any reflections, even when using the newer Plugin.

Sorry, I haven't had time to get to this plugin yet. It would speed things along if I had an output_log.txt file (or player.log for Linux/Mac)

Link to comment
Share on other sites

WOW, that was fast!

No problem, its still just a hobby ;)

Here it is!

https://dl.dropboxusercontent.com/u/97972142/output_log.txt

I have no life and I must scream.

I guess what I'm trying to say is, you have two ReflectionPlugin.dll floating around. (one in the top level of GameData)

That could be the cause of the problem. I just checked this out and the plugin works in 0.25 (it would actually be a little weird for it not to. Really fundamental changes would have to take place in Unity or KSP to break this. Most of it is just stock Unity code with hooks into KSP events)

Link to comment
Share on other sites

This might sound like a silly question, but what do I need to do to see something reflecting? I put the plugin in Gamedata, but do I need any prepared files? Or did I not install the plugin correctly?

Edited by Camacha
Link to comment
Share on other sites

This might sound like a silly question, but what do I need to do to see something reflecting? I put the plugin in Gamedata, but do I need any prepared files? Of did I not install the plugin correctly?

To show reflection, the part.cfg file needs editing, and the texture file should have an alpha channel. Some mods may already support this plug in by having appropriate texture and part.cfg, such as FASA.

Link to comment
Share on other sites

  • 1 month later...
Can this be used to assign other shaders to meshes? I've got the blended decal shaders used on bac9's space centre and I'd like to use them on my own buildings.

Probably? The shader in question either has to be an existing Unity or KSP shader or its compiled source has to be imported into the Reflection Plugin code which then needs to be recompiled. Given that RP has some hard coded assumptions about the shaders it uses, you might be better off using the source to create your own shader switching plugin. Possibly something more generic.

Has anyone made config files for existing part packs aside from FASA?

Not sure, I think so but I can't name anything specific...

Link to comment
Share on other sites

So I tried the plugin in 0.25 with my old model from 0.23.5. In 0.23.5 it works perfectly, but in 0.25, the reflection works, but it seems to bypass bump and specular. The model uses a "Reflective/Bumped Specular" shader, and is tagged with it in the reflective module in .cfg (ShaderName = Reflective/Bumped Specular). And in 0.25 in both 32 and in 64bit is the same, no difference.

Left = 0.23.5, Right = 0.25

iI2tOYR.jpg

Is this a known issue?

Edited by nothke
Link to comment
Share on other sites

So I tried the plugin in 0.25 with my old model from 0.23.5. In 0.23.5 it works perfectly, but in 0.25, the reflection works, but it seems to bypass bump and specular. The model uses a "Reflective/Bumped Specular" shader, and is tagged with it in the reflective module in .cfg (ShaderName = Reflective/Bumped Specular). And in 0.25 in both 32 and in 64bit is the same, no difference.

Left = 0.23.5, Right = 0.25

http://i.imgur.com/iI2tOYR.jpg

Is this a known issue?

It works for me on bumped speculars, I get a lot of nullrefereceexceptions though from the plugin. They don't seem to affect the game but they are there.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...