Jump to content

[1.0.5] Reflection Plugin Continued 2.0


Starwaster

Recommended Posts

The shaders CAN be brought in from a text file if you want. Look at KSP.IO I think. I embedded my shaders simply because it was more convenient. If you want, I can take a look at the shaders to see if I can add translucency to them. KSP is *Probably* using the _Color or _Tint field to determine the highlighting and transparency (though I'd have to look at existing shaders to be sure).

It is using _Color. Be my guest any input is welcome :)

If you have the Unity editor you already have the code for them, if not let me know.

Link to comment
Share on other sites

It is using _Color. Be my guest any input is welcome :)

If you have the Unity editor you already have the code for them, if not let me know.

Ah, so you are using the default reflective shaders. I see! Looks like the Alpha component is used to determine the weight of the reflective component, and the shader isn't set as a transparent type. We can fix this easy. We can do one of two things. Either we move transparency to another channel (r,g or B) or move the reflective off alpha. Thoughts?

EDIT: Hmm... looks like the main tex is also used to get the specularity color. We would probably have to add another texture for transparency mapping. Unless we just want a single all-over transparency.

Edited by rbray89
Link to comment
Share on other sites

Ah, so you are using the default reflective shaders. I see! Looks like the Alpha component is used to determine the weight of the reflective component, and the shader isn't set as a transparent type. We can fix this easy. We can do one of two things. Either we move transparency to another channel (r,g or B) or move the reflective off alpha. Thoughts?

EDIT: Hmm... looks like the main tex is also used to get the specularity color. We would probably have to add another texture for transparency mapping. Unless we just want a single all-over transparency.

Depends on whether we want to be able to mask transparency.

If the answer is no, then the solution gets a lot easier. Having played around with this in both Unity editor and by changing values in the module's settings, it doesn't seem like the alpha channel for main color (not the texture, there's an RGBA color setting), specular color or reflective color actually have any effect. If we're not interested in masking then you could piggyback transparency on one of those channels. And set it easily via the module settings.

The other reflective shader types are setup similarly but I'm not sure the same is true for all of them about the impact (or lack thereof) of alpha...

Link to comment
Share on other sites

What kind of parts do the reflective shaders get applied too? I am unfamiliar with the mod and only have installed it and didn't see immediate results and some more info would be great :D

The parts need to be configured to use it. Look at the first page for example usage. Or download frizzank's FASA mod which uses it in his Mercury Atlas rocket

Link to comment
Share on other sites

  • 2 weeks later...
So I finally had some time to play with your plugin. I made it work. How do I mask all them parts I don't want to shine? What file do I create/change? Is it the map or something else?

It's in the alpha channel.

Alpha controls strength:

kIS3f2Ml.png

Link to comment
Share on other sites

How hungry is this plugin?

If you have multiple individual reflective parts on realtime reflection then it can get laggy. If you turn realtime off and give it a refresh of 300 or so (update every five minutes) then it's quite manageable. I notice very little lag that way, but I should also note that that's in game time so that refresh happens based on ship movement about a planet.

Eventually I want to give it the option of using only a single camera for the entire craft. Maybe tie it to the root part.

Link to comment
Share on other sites

The latest beta works well with the FASA parts. The Atlas is almost all reflective chrome and I have not had any complaints on performance because of it.

I also found out if you have several parts with the same update time it may stutter every few min when it tries to update all of the cube maps. I stagger them so they have a few seconds in between updates for each part. So one part would have a refresh of 290 and the next would be 310 it seams to help.

Link to comment
Share on other sites

  • 2 weeks later...

Looks like a great plugin. Are there any default cfg files out there for stock that stupid and or lazy people can use to get some of these nice reflections without a bunch of work? Not sayin I'm stupid or lazy, I'm just sayin. :)

Link to comment
Share on other sites

Looks like a great plugin. Are there any default cfg files out there for stock that stupid and or lazy people can use to get some of these nice reflections without a bunch of work? Not sayin I'm stupid or lazy, I'm just sayin. :)

This will be bad get more then 6 parts with it, It can get laggy but if you can edit a cfg you will see how this puts it on all parts

https://www.dropbox.com/s/kp7j17u2i7c4r39/Reflection_shader_4ALL.cfg

EDIT LOL I did say it would be bad.

Edited by Mecripp2
Link to comment
Share on other sites

I have found the need for animated emission on engines with reflections. Is this possible? Right now im breaking them up into multiple parts and the emissive parts dont reflect...

Are you sure it's not just washing out the reflection? Parts undergoing reentry seem like they still reflect when they start glowing, up to a point.

Looks like a great plugin. Are there any default cfg files out there for stock that stupid and or lazy people can use to get some of these nice reflections without a bunch of work? Not sayin I'm stupid or lazy, I'm just sayin. :)

Check the second post. Put the example code into a part config file. By default, all meshes on the part on the part will reflect. If it has multiple meshes then you can choose which meshes will reflect, if you know their names. (look at the line that has MeshesToChange in it, commented out)

This will be bad get more then 6 parts with it, It can get laggy but if you can edit a cfg you will see how this puts it on all parts

https://www.dropbox.com/s/kp7j17u2i7c4r39/Reflection_shader_4ALL.cfg

LOL, THAT config is just begging for trouble. I'd be afraid to try that even with realtime reflection turned off, at least with craft having lots of parts.

Link to comment
Share on other sites

Are you sure it's not just washing out the reflection? Parts undergoing reentry seem like they still reflect when they start glowing, up to a point.

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.

Blerg... Guess I Didn't really notice (I still use 3.70)

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

qz5H455.jpg

Link to comment
Share on other sites

  • 3 weeks later...
I'd like to report some issue, I think this isn't compatible with FSTextureSwitcher :( It refuses to switch

I'm not sure it makes sense that it would be compatible. Are you trying to force a texture change to something non-reflective? Or just trying to switch texture itself? Is the normal map being changed too?

Are there logged errors?

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