Jump to content

[1.0.5] Reflection Plugin Continued 2.0


Starwaster

Recommended Posts

Didn't really check the logs, I removed it already for now, I should check it anyways, it doesnt switch if it has the module of this on. Well I think it makes sense if you want to change textures, This one relies on alpha so it shouldnt be a problem because it should depend on the texture's alpha. I have proven the alpha works because the Specular works only where the alpha says it to be.

Link to comment
Share on other sites

Didn't really check the logs, I removed it already for now, I should check it anyways, it doesnt switch if it has the module of this on. Well I think it makes sense if you want to change textures, This one relies on alpha so it shouldnt be a problem because it should depend on the texture's alpha. I have proven the alpha works because the Specular works only where the alpha says it to be.

There seems to be some miscommunications.

lets go over some basics:

reflectivity is not a texture, it is a shader. if you apply it to something, that something will always be reflective no matter what the texure is but masked by the texure's alpha channel.

the plugin exercises little control over the texures themselves. it doesn't do anything to the base texture or the normal texture so it shouldnt be preventing texure changes unless the shader has to be a ksp shader but I'm unaware of such limitations.

I cant say more without knowing a lot more specifics about what you tried to change including whether you tried to change the normal texture and whether any aspect of the texture change succeeded at all (ie did main texture change at all? did normal change at all? were there any errors at all)

just telling me you think its not compatible without providing some details, I cant do much except shrug. then you say it shouldnt be a problem because alpha works.... what?

Link to comment
Share on other sites

Hmm yeah, sorry about that, I was trying to see if it had errors yet and it seems to have none. What I was trying to say is yes, the RP is always applying textures but here's the case, I have two textures, the other has all of its texture covered by alpha and the other has only some parts masked. When I try to "Next Texture", normally it would switch but whenever I add RP module, it doesn't. What I mean about it shouldn't be a problem is because the other texture has all of its parts masked so it shouldn't reflect and the other has another alpha so if they were applied in two different parts, they should work. Except if it has FSTextureSwitcher, it wouldn't switch.

Link to comment
Share on other sites

Hmm yeah, sorry about that, I was trying to see if it had errors yet and it seems to have none. What I was trying to say is yes, the RP is always applying textures but here's the case, I have two textures, the other has all of its texture covered by alpha and the other has only some parts masked. When I try to "Next Texture", normally it would switch but whenever I add RP module, it doesn't. What I mean about it shouldn't be a problem is because the other texture has all of its parts masked so it shouldn't reflect and the other has another alpha so if they were applied in two different parts, they should work. Except if it has FSTextureSwitcher, it wouldn't switch.

I want you to try something.

Try to switch texture on something that is reflective.

Assume that it worked even if you didn't see anything happen.

Launch.

Then come back here and tell me if the texture at launch is what you expected it to have been switched to.

Edit: Some clarification. Be sure you are switching it in the VAB / SPH before launch. Do not try to switch after launch. Switch in VAB, then launch.

Edited by Starwaster
Link to comment
Share on other sites

The reflection shader overwrites the shader that's on the part correct? The animated emisive shader is applied in Unity on export of the part, so if you give it a reflection, no more emissive. The reentry effect is more of a post effect I thought.

You don't know what your missing....

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

Wow THAT looks sexy!

Link to comment
Share on other sites

blackheart, you may need to reevaluate how you're setting up your textures or the FSTextureSwitch module.

I am successfully able to switch textures. Or at least normal maps. I havent actually tried switching the main texture because I ddidnt have any suitable to test with. (was testing it out on my Copernicus droptank. so thanks for spurring me to test this because now I can allow for texure switching on ypthe droptank)

Edited by Starwaster
Link to comment
Share on other sites

Switching works now whenever I launch. So I'll change my issue then, it doesn't visually change the texture when I have RP. :P

Thanks for the btw

These shots are bad examples because of the high amount of reflectivity, but main texture replacement works fine with FSTextureSwitcher when I tried it. I don't know what else to tell you. (first picture texture is plain. second is more textured)

3KnfYxil.pngnTZ2hznl.png

What happens if a part uses a texture with an alpha channel and this plugin is not installed?

Depends on the shader. In specular shaders it controls the strength of specularity. Or masks it off entirely. Take for example a texture that's meant to have letters painted onto a fuel tank. Copy the main texture over to the alpha channel (which will desaturate it in the process). Maybe invert it. Adjust contrast. And suddenly your fuel tank is a little less flat and more painted on. Or use it on shiny surfaces that are meant to appear dirty. Shiny parts could be white and dirty parts dark gray or black.

In general, use it as a mask.

Link to comment
Share on other sites

Depends on the shader. In specular shaders it controls the strength of specularity. Or masks it off entirely. Take for example a texture that's meant to have letters painted onto a fuel tank. Copy the main texture over to the alpha channel (which will desaturate it in the process). Maybe invert it. Adjust contrast. And suddenly your fuel tank is a little less flat and more painted on. Or use it on shiny surfaces that are meant to appear dirty. Shiny parts could be white and dirty parts dark gray or black.

In general, use it as a mask.

So it's best to use the diffuse or bumped shader for parts that use this? Or does it not matter?

Link to comment
Share on other sites

So it's best to use the diffuse or bumped shader for parts that use this? Or does it not matter?

It doesnt matter too much but it depends on what specific reflective shader you configure the plugin for.

If you're going for bumped specular then make sure the original shader you set the part up with has a diffuse map with alpha (controls reflective strength) and normal map.

I'm noticing problems still with some of the other reflective shaders such as Bumped Parallax which makes parts look translucent and I dont know why. So best to stick with diffuse, bumped or bumped specular reflective shaders when configuring the plugin.

Link to comment
Share on other sites

Hey, sorry to be a massive noob here but, would it be possible, and how might one, go about applying this effect to the stretchy tanks chrome texture so that it may be applied to any of the tanks in use? Also the Foil that can be seen on the OP, there's a texture like that too for stretchys

Link to comment
Share on other sites

Hey, sorry to be a massive noob here but, would it be possible, and how might one, go about applying this effect to the stretchy tanks chrome texture so that it may be applied to any of the tanks in use? Also the Foil that can be seen on the OP, there's a texture like that too for stretchys

I have not successfully been able to apply reflective shader to stretchy tanks.

I forget why, I think maybe because Stretchies were changing materials on the stretchies....

I intend to revisit it at some point, but I think it might actually require specialized code in the stretchy plugin. Or implementing reflection there outright. We'll see.

And, yay. I got my computer working again. Too bad I had to pull my newest and bestest GPU and replace it with an older less powerful one.

Link to comment
Share on other sites

Hey, sorry to be a massive noob here but, would it be possible, and how might one, go about applying this effect to the stretchy tanks chrome texture so that it may be applied to any of the tanks in use? Also the Foil that can be seen on the OP, there's a texture like that too for stretchys

OK, I just tried again and it does work with stretchies with the following caveats:

  • Changing textures turns off reflections.
  • Mousing over the tank at all turns off reflections.
  • Most of the textures lack alpha channels and normal maps resulting in flat looking reflections and speculars.

Once you launch you will have reflectivity.

Link to comment
Share on other sites

I have not successfully been able to apply reflective shader to stretchy tanks.

I forget why, I think maybe because Stretchies were changing materials on the stretchies....

I intend to revisit it at some point, but I think it might actually require specialized code in the stretchy plugin. Or implementing reflection there outright. We'll see.

And, yay. I got my computer working again. Too bad I had to pull my newest and bestest GPU and replace it with an older less powerful one.

I want to point out that Stretchy Tanks and Stretchy SRBs are largely being phased out in favor of Procedural Parts. I so very much want reflectivity in these... but I'd hate to see you spend tons of effort on parts that aren't being used.

Link to comment
Share on other sites

It should be possible. Are there shots anywhere illustrating the effect?

No sorry, it was merely something I thought was missing in unity and looked for it, the thread with the code being the only source I found. KSPI uses self-illumination on it's thermal generators and antimatter reactors, so when I apply reflections I loose the self illumination texture, I can make some shots of that if that helps.

Link to comment
Share on other sites

No sorry, it was merely something I thought was missing in unity and looked for it, the thread with the code being the only source I found. KSPI uses self-illumination on it's thermal generators and antimatter reactors, so when I apply reflections I loose the self illumination texture, I can make some shots of that if that helps.

I see. Ok to answer the original question literally, yes it's probably possible to get the shader code you referenced to work.

However I don't think that by itself would solve the problem you're describing. I'm assuming that KSPI is using KSP shaders and that what you're talking about is the emissions.

What would probably have to happen is that the KSP shaders would have to be modified to accept environment mapping, which is how reflections work. It's just rendering 6 views from a camera to create an environment map.

Link to comment
Share on other sites

I want to point out that Stretchy Tanks and Stretchy SRBs are largely being phased out in favor of Procedural Parts. I so very much want reflectivity in these... but I'd hate to see you spend tons of effort on parts that aren't being used.

Procedural Parts are definitely the future, and when official release happens, I really doubt stretchy tanks will be relevant. However, as far as I can tell, Proc Parts are based on the same principles behind stretchy tanks, so if reflections work for one, then surely they'll work for the other... Either way I do desire this feature for Proc Parts for sure. I'd love to be able to build some nice vintage aircraft with some polished aluminum skins using pwings & proc parts.

I worked with the plugin applied to some various other parts, and forgot to take as many screenshots as I should have.. but I found the effect rather compelling:

Javascript is disabled. View full album

EDIT: totally forgot to ask, Star, do you plan to, or would you consider adding some other visual effects to the functionality of the plugin? Also, and this might be a feature too far, would in-game toggle-ability be a possibility? Sometimes I find myself going nuts with the reflections only to find that i've killed my framerate, also, it'd be nice to add the plugin to alot of parts without making duplicates (one with one without reflections) in order to preserve performance. Effects like transparency, or translucency as a feature would be cool, something to give a glassy refracted effect. Im sure there are others too, but I was just curious. Great work with this thing, and hope to see it continue, its a really nice asset to have available!

Edited by Dirt_Merchant
Link to comment
Share on other sites

How, exactly, did you get this to work? Please share.

It's not terribly difficult. Not nearly as difficult as I feared it would be.

Did you see my post here? http://forum.kerbalspaceprogram.com/threads/70089-Reflection-Plugin-Continued-0-23-5?p=1142035&viewfull=1#post1142035

It might appear to fail at points in the VAB but will work once you get the craft out in the 'real world'. That is, when you launch. In the VAB (or SPH) it might not work or it might seem to work but then fail when you

  • Switch to a new texture OR
  • Mouse over then move mouse away. (because stretchy/PF will update textures)

This is the code I stuck in the stretchies: (it's MM code; not sure if it will catch Procedural Parts; not sure if the Module is named the same.... assuming it's changed. have to see)


@PART[*]:HAS[@MODULE[StretchyTanks]]:FINAL
{
MODULE
{
name = ReflectiveShaderModule
CubeMapSize = 128
FarClipPlane = 500000000
//NearClipPlane = 10
OneFacePerFrame = True

ShaderName = Reflective/Bumped Specular
realTimeReflection = False
updateRate = 300.0f


// The height of the parallax map. Values are accepted between 0.005 and 0.08.
ParallaxHeight = 0.005

// How reflective the reflection will be (Weakest 0.0 - 1.0 Strongest).
// -1.0 means use ReflectionColor instead
ReflectionStrength = -1.0
ReflectionColor = 1.0, 1.0, 1.0, 1.0
_Color = 1.0, 1.0, 1.0, 1.0
//MeshesToChange = polymsh_detached,polymsh_detached1,polymsh

// How shiny the specularity will be (if specular).
// This value will be automatically set if it already exists on the previous shader and is not defined here.
Shininess = 1.0

//SpecColorR = 1.0
//SpecColorG = 0.8
//SpecColorB = 0.0
//SpecColorA = 1.0
//rimFalloff = 5.0
//rimColor = 0.8242, 0.6445, 0.1914, 1.0
}
}

And, it bears repeating, end results can be greatly improved by careful application of an alpha channel, which controls reflection strength. So you could have something like really polished aluminum but then a glossy painted on surface that is only mildly reflective. Unfortunately you share specularity strength with the same alpha channel, which is unavoidable until we get a shader that accepts an additional texture to control that separately.

BTW, near future I'm going to update with improved performance when timewarping. I'm sure someone must have noticed when timewarping that it lags a good deal more than otherwise. Maybe people just thought it was unavoidable but there doesn't seem to have been a whole lot said on the subject.

EDIT: totally forgot to ask, Star, do you plan to, or would you consider adding some other visual effects to the functionality of the plugin? Also, and this might be a feature too far, would in-game toggle-ability be a possibility? Sometimes I find myself going nuts with the reflections only to find that i've killed my framerate, also, it'd be nice to add the plugin to alot of parts without making duplicates (one with one without reflections) in order to preserve performance. Effects like transparency, or translucency as a feature would be cool, something to give a glassy refracted effect. Im sure there are others too, but I was just curious. Great work with this thing, and hope to see it continue, its a really nice asset to have available!

Oops didn't see that. Not really planning on additional visual effects but that's not to say that I won't. I'm not really planning on getting into doing custom shaders for KSP right now. (though, I did for Crysis years back and was recently surprised to find Google auto-completing search requests for Starwaster with 'Starwaster Water Shaders' as I thought I'd been forgotten. Sadly, the chia tanks and pink furry nanosuits didn't get the same treatment)

On making reflection toggleable in-game; not planning on it. I'd rather try to improve overall framerate. The main place I notice that is during warp and that can definitely be corrected. If I hit a dead end and it's still a problem then I'll see about putting in a toggle to allow it to be shut off.

Edited by Starwaster
Link to comment
Share on other sites

you can through the config apply the shader to specific sections of the part. So for instance a non reflicive pod could have reflective windows (Called out in the .cfg)and still keep its spec values for the non reflective pod.

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...