Starwaster

[1.0.5] Reflection Plugin Continued 2.0

Recommended Posts

If you want to do alpha stuff in GIMP, set up your alpha channel as a layer mask to your texture/diff, then never ever ever apply it, export to PNG.

Share this post


Link to post
Share on other sites
The cube has a texture in the diffuse channel. The inset image shows the RGB above and the alpha channel below. The black stripe corresponds to the yellow paint on the reflective surface. It is completely non-reflective there. The gray areas to either side are the reflective surfaces (0.5 in RGB if I remember correctly)

TGA was used. You can use PNG if you have a graphics program that can correctly handle the alpha. Photoshop does not. However, there is a SuperPNG plugin which is supposed to give control over the alpha channel. I haven't had a lot of luck with it myself, though others do use it.

I've heard conflicting stories about GIMP and its abilities to handle PNG with alpha.

Thanks for the information. So photoshop doesn't handle PNG correctly? That would explain why I've had no luck with changing the alpha channels. So both PS and Gimp have trouble with alpha with PNG? I'll give that plugin a try or switch to TGA.

Share this post


Link to post
Share on other sites
is there a Transparent/Reflective shader?

Talk to RBray, I think he did something along those lines; I'm not sure if it was a standalone shader or if it depended on this....

Share this post


Link to post
Share on other sites

This plugin is causing massive lag and fps drops on 0.24.x to any ship its on especially when timewarping. Removing it instantly fixes the issue

Share this post


Link to post
Share on other sites
This plugin is causing massive lag and fps drops on 0.24.x to any ship its on especially when timewarping. Removing it instantly fixes the issue

More so than on 0.23.x?

And 64 bit or 32 bit?

Share this post


Link to post
Share on other sites

64 bit, and it wasn't having any issues on 0.23.x. On 64 bit when you timewarp it locks the game up completely for a second every 1-2 seconds making timewarp take ages. When not in timewarp it is barely noticeable.

Share this post


Link to post
Share on other sites
64 bit, and it wasn't having any issues on 0.23.x. On 64 bit when you timewarp it locks the game up completely for a second every 1-2 seconds making timewarp take ages. When not in timewarp it is barely noticeable.

On 0.23.x, did you ever have occasion to run it with the 64 bit hacked version?

Have you tried it on 32 bit 0.24.x? (for comparison purposes)

I'm trying to see if I can get a new version built but it involves embedding resources (missing shaders) and I'm not set up to do that with MonoDevelop. I assume it can be done but I haven't done it successfully. Without the embedded shaders, it will fail if trying to use a shader that has been removed from KSP (because they're stock Unity shaders and not KSP shaders)

I could try pushing an unembedded version that renders less often during timewarp. (I think I know what's going on there, I know there's some loss of performance but it didn't seem very bad before)

Share this post


Link to post
Share on other sites

I did use it with the hacked 64 bit but I never flew a rocket that had the module on it out of the atmosphere, only on first stages so I never used timewarp. It's possible it had the same problem then. It works fine on 32 bit.

Share this post


Link to post
Share on other sites
I did use it with the hacked 64 bit but I never flew a rocket that had the module on it out of the atmosphere, only on first stages so I never used timewarp. It's possible it had the same problem then. It works fine on 32 bit.

Well that might be a problem then because it's going to be awhile before I can try KSP on a 64 bit system...

but I put together an experimental version, I just tested it for an hour or so flying a ship with reflection to different planets and it feels smoother to me on my Mac but someone's going to have to try it on a Windows system, 64 bit, so we can see how it behaves there. This is lacking the embedded shaders that that the current one has but that's hopefully not a problem. It depends on if Squad stripped the Unity shaders out of the last build. At the very least they've left in the Reflective and Reflective Bumped.

The other thing is that there is a minimum of a 5 second delay between reflective rendering frames even if real time reflections are enabled, but that also shouldn't be a problem because I doubt anyone is trying to do real time reflections with this.

So, try this out please and let me know how it does: https://github.com/Starwaster/Reflection-Plugin-Continued/blob/Dev/ReflectionPlugin.DEV.VERSION.zip

If you have the reflection plugin in any other folder in GameData, make sure to delete it, or copy the DLL in the one above over the old one. (other modders really shouldn't be putting the plugin in folders of their own creation but they do and there's definitely some opportunity there for trouble....)

Share this post


Link to post
Share on other sites

I gave the experimental build a run on Win8.1 64-Bit in KSP-64.

Ran a ship from Kerbin to Duna and landed. Nothing unusual to report. Seems to be working fine.

Oh, one thing I have noticed (not sure if this is covered somewhere on this forum, if so, I missed it), but if a part has multiple meshes, the reflective plugin only applies the reflection to the first mesh. Not only the experimental, but your earlier builds as well.

Share this post


Link to post
Share on other sites
I gave the experimental build a run on Win8.1 64-Bit in KSP-64.

Ran a ship from Kerbin to Duna and landed. Nothing unusual to report. Seems to be working fine.

Oh, one thing I have noticed (not sure if this is covered somewhere on this forum, if so, I missed it), but if a part has multiple meshes, the reflective plugin only applies the reflection to the first mesh. Not only the experimental, but your earlier builds as well.

You can configure it to cover multiple meshes..

The large drop tank was three meshes for the reflective parts. two domes and the center.

Share this post


Link to post
Share on other sites
You can configure it to cover multiple meshes..

The large drop tank was three meshes for the reflective parts. two domes and the center.

Oh yes. Found the entry in your example config.

MeshesToChange = foo1, foo2, etc.

Thanks :)

Share this post


Link to post
Share on other sites

I'm having trouble understanding the difference between ReflectionStrength and ReflectionColor. I'm using the 1.1 beta .dll.

I'm testing with this .cfg. I've removed the extra space to shorten it for the post, and bolded the spots I'm having trouble with at the moment:

@PART
[*]:Final{
//Reflection shader plugin
MODULE
{
name = ReflectiveShaderModule
CubeMapSize = 256
FarClipPlane = 500000000
NearClipPlane = 0.5
OneFacePerFrame = true
ShaderName = Reflective/Bumped Specular
realTimeReflection = False
updateRate = 20
ParallaxHeight = 0.005
[B]ReflectionStrength = 0.125[/B]
MeshesToChange = all
Shininess = 0.8
SpecColorR = 0.5
SpecColorG = 0.5
SpecColorB = 0.5
SpecColorA = 0.5
}
}
@PART[fuelTank_long]:Final
{
@MODULE[ReflectiveShaderModule]
{
[B]@ReflectionStrength = -1[/B]
[B]ReflectionColor = 1.0, 0.0, 0.0, 0.0625[/B]
}
}

@ReflectionStrength = -1 is to enable the ReflectionColor paramater; this is what I thought was meant by this:

If ReflectionStrength is less than 0 then ReflectionColor is used instead.

ReflectionColor = 1.0, 0.0, 0.0, 0.0625 is to set the reflection red with an alpha of 1/16

I am assuming that the color is formatted as RGBA - if this is an incorrect assumption or I am misinterpreting the OP, please tell me.

My understanding was that this would make all parts reflective, but the FL-T800 (fuelTank_long) would have a subtle, red reflection. This is what the .cfg actually does:

47CD15F2D4AEC00B10CAE69220FBFDF18E469CE5

This is not red, and it is not 6.25% strength, but I'm not sure why.

I don't intend to use this config, but I'm trying to figure out what everything does so I can make a proper one.

Thanks (BTW, I love aesthetic mods, and this is no exception -- great work continuing this).

EDIT: One other yes/no question: Is it possible to apply this to the kerbonauts' visors?

Edited by TangibleLight

Share this post


Link to post
Share on other sites
I'm having trouble understanding the difference between ReflectionStrength and ReflectionColor. I'm using the 1.1 beta .dll.

I'm testing with this .cfg. I've removed the extra space to shorten it for the post, and bolded the spots I'm having trouble with at the moment:

@PART
[*]:Final{
//Reflection shader plugin
MODULE
{
name = ReflectiveShaderModule
CubeMapSize = 256
FarClipPlane = 500000000
NearClipPlane = 0.5
OneFacePerFrame = true
ShaderName = Reflective/Bumped Specular
realTimeReflection = False
updateRate = 20
ParallaxHeight = 0.005
[B]ReflectionStrength = 0.125[/B]
MeshesToChange = all
Shininess = 0.8
SpecColorR = 0.5
SpecColorG = 0.5
SpecColorB = 0.5
SpecColorA = 0.5
}
}
@PART[fuelTank_long]:Final
{
@MODULE[ReflectiveShaderModule]
{
[B]@ReflectionStrength = -1[/B]
[B]ReflectionColor = 1.0, 0.0, 0.0, 0.0625[/B]
}
}

@ReflectionStrength = -1 is to enable the ReflectionColor paramater; this is what I thought was meant by this:

ReflectionColor = 1.0, 0.0, 0.0, 0.0625 is to set the reflection red with an alpha of 1/16

I am assuming that the color is formatted as RGBA - if this is an incorrect assumption or I am misinterpreting the OP, please tell me.

My understanding was that this would make all parts reflective, but the FL-T800 (fuelTank_long) would have a subtle, red reflection. This is what the .cfg actually does:

http://cloud-4.steampowered.com/ugc/37472115419525047/47CD15F2D4AEC00B10CAE69220FBFDF18E469CE5/

This is not red, and it is not 6.25% strength, but I'm not sure why.

I don't intend to use this config, but I'm trying to figure out what everything does so I can make a proper one.

Thanks (BTW, I love aesthetic mods, and this is no exception -- great work continuing this).

EDIT: One other yes/no question: Is it possible to apply this to the kerbonauts' visors?

I think it might be an ordering problem between the two configs. The second one might actually be executing first. If that's the case then ReflectionColor is still 0.125

You also would have run into trouble because the second config lacks a splice operator for ReflectionColor, so technically it would try to add a second field by that name. I'm not sure what the outcome of that would be.

Try removing :Final from the first config and change the second one so that it says @ReflectionColor = 1.0, 0.0, 0.0, 0.0625

Finally, not all of the shaders necessarily respect the alpha channel. (it's even possible that none of them respect it anymore but I'm not aware of such a change in Unity)

Edit: Re: Visors, I'm not sure how you would apply this to visors, but there is a mod out there that applies a modified version to visors... Texture Replacer maybe? I'm not sure, I don't use it myself but someone already expressed interest in that and worked together with rbray to make it happen. I don't know what the technical procedure was

Share this post


Link to post
Share on other sites

Hey everyone. How do you install this mod? Ive tried copying the folder into the gamedata file but it doesn't work. Ive also taken the dll. file out of the folder and put it into the gamedata folder but it still doesn't work. I'm actually hoping to use this mod to create a reflective cover for the fasa CM pod in my realism ksp install.

Share this post


Link to post
Share on other sites
Hey everyone. How do you install this mod? Ive tried copying the folder into the gamedata file but it doesn't work. Ive also taken the dll. file out of the folder and put it into the gamedata folder but it still doesn't work. I'm actually hoping to use this mod to create a reflective cover for the fasa CM pod in my realism ksp install.

It's just a plugin you have to edit or make a CFG to add it to parts.

Share this post


Link to post
Share on other sites
Hey everyone. How do you install this mod? Ive tried copying the folder into the gamedata file but it doesn't work. Ive also taken the dll. file out of the folder and put it into the gamedata folder but it still doesn't work. I'm actually hoping to use this mod to create a reflective cover for the fasa CM pod in my realism ksp install.

I thought FASA already came with this installed and configured...???

I'll take a look and write up a config for it if I have to

Share this post


Link to post
Share on other sites

I was wondering if there was a way to fix the "blue" that you get on reflected parts at night or during sunrise. I appears on every part that uses this plugin and it only disappears once the sun is fully up. Also, the plugin seems to stop working if you tab out of the game once coming back.

Share this post


Link to post
Share on other sites
I was wondering if there was a way to fix the "blue" that you get on reflected parts at night or during sunrise. I appears on every part that uses this plugin and it only disappears once the sun is fully up. Also, the plugin seems to stop working if you tab out of the game once coming back.

Can you post a screenshot please?

As for the alt-tab issue, there's probably nothing I can do about that... but how long have you stayed in the game after tabbing back in? Suggest you try time warping and see if it starts reflecting again after tabbing back.

Share this post


Link to post
Share on other sites

Ok here are my parts which contain the plugin. They are only blue like this during sunrise/set and night.

LVkdkr6.png

And to show it's not an isolated problem, here are pictures of FASA parts with the same issue.

nYbdesM.png

The angle that the sun is touching the parts seems to be a large factor as sometimes only some parts will be blue while others in direct contact with the sun won't be.

Share this post


Link to post
Share on other sites
Ok here are my parts which contain the plugin. They are only blue like this during sunrise/set and night.

http://i.imgur.com/LVkdkr6.png

And to show it's not an isolated problem, here are pictures of FASA parts with the same issue.

http://i.imgur.com/nYbdesM.png

The angle that the sun is touching the parts seems to be a large factor as sometimes only some parts will be blue while others in direct contact with the sun won't be.

FYI, I did see this but haven't had a chance to look at it yet. (I didn't actually have anything installed that reflects)

I'll be taking a look at it later today once I have FASA installed.

Edit: Not sure what's happening in your pictures and I'm not seeing that happening here. In your top picture I see that there's a lot of objects there so maybe I need to set up more reflecting things than I'm testing with..

The second picture with the FASA parts it looks like it's just rendering the sky but it should be showing the same thing as the Atlas part that you have attached to it radially... and you say it doesnt always look like that, just when the sun is rising/setting?

Which plugin are you using? The one that came with FASA or the one that I posted a page (or two) back? (not that it should really make a difference... but maybe you might want to give that one a try and see if the results are same or different.)

Edited by Starwaster

Share this post


Link to post
Share on other sites
FYI, I did see this but haven't had a chance to look at it yet. (I didn't actually have anything installed that reflects)

I'll be taking a look at it later today once I have FASA installed.

Edit: Not sure what's happening in your pictures and I'm not seeing that happening here. In your top picture I see that there's a lot of objects there so maybe I need to set up more reflecting things than I'm testing with..

The second picture with the FASA parts it looks like it's just rendering the sky but it should be showing the same thing as the Atlas part that you have attached to it radially... and you say it doesnt always look like that, just when the sun is rising/setting?

Which plugin are you using? The one that came with FASA or the one that I posted a page (or two) back? (not that it should really make a difference... but maybe you might want to give that one a try and see if the results are same or different.)

Edit: Ok, actually don't use the one I posted a page back with FASA because I'm getting a lot of null ref errors. Not sure why because I tested that version with other reflective parts..... ????

Share this post


Link to post
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.