Starwaster

[1.0.5] Reflection Plugin Continued 2.0

Recommended Posts

Thank you. I was looking for that too but what I was asking was, how do you code a cfg that just modules a single texture?

Share this post


Link to post
Share on other sites
Thank you. I was looking for that too but what I was asking was, how do you code a cfg that just modules a single texture?

I'm afraid this only works (at least for now) using whole parts, not single textures. If I'm wrong, please someone correct me.

That's precisely why I can't use it only for glass... :(

Share this post


Link to post
Share on other sites

I have been experimenting with adding this to some of the Procedural Parts textures (namely the Atlas texture) and with a couple of the ones from your pack as well, blackheart. Needless to say, I have not had much success considering with my novice skills.

Share this post


Link to post
Share on other sites
Thank you. I was looking for that too but what I was asking was, how do you code a cfg that just modules a single texture?
I'm afraid this only works (at least for now) using whole parts, not single textures. If I'm wrong, please someone correct me.

That's precisely why I can't use it only for glass... :(

By no means!

You don't target textures. You target meshes. I don't think you're going to run into a situation where a mesh has multiple textures. If there's more than one texture then there's more than one mesh.

Let's say I have a massive fuel tank that's made of five separate meshes. Tank side, top, bottom and two 'tank braces'

In my ReflectiveShaderModule it looks like this


MeshesToChange = polymsh_detached,polymsh_detached1,polymsh

And the result is

8N0RMVnl.png

If you need to only apply the shader to a specific section of a given texture, then mask off the parts you don't want reflecting with black in the texture's alpha channel. (be sure to save as tga, 32 bit to ensure preservation of your alpha channel. png won't work unless it's SuperPNG. Maybe.)

kIS3f2Ml.png

Share this post


Link to post
Share on other sites

Hmmm, I understand. But does this change the fact that we can't apply these on a single texture for stretchy tanks? (Module is applied per tank, textures have a different cfg)

Share this post


Link to post
Share on other sites
Hmmm, I understand. But does this change the fact that we can't apply these on a single texture for stretchy tanks? (Module is applied per tank, textures have a different cfg)

I think there would be conflicts with Stretchy Tanks. They would both be trying apply textures when the tank spawns....

the texture modification part of Stretchy would have to be rewritten... ideally you would want to be able (as player) to have full control over both. Where the user could select reflective textures but also to be able to pick up the ball and switch back to stretchy tank textures.

Share this post


Link to post
Share on other sites

Would a quick and dirty fix not be to make non-reflective stretchies and reflective stretchy tanks of the same diameter?

Edited by Camacha

Share this post


Link to post
Share on other sites
Would a quick and dirty fix not be to me non-reflective stretchies and reflective stretchy tanks of the same diameter?

Sorry, could you please rephrase or elaborate? I don't get what you're suggesting...

Share this post


Link to post
Share on other sites
Sorry, could you please rephrase or elaborate? I don't get what you're suggesting...

Stretchies now come in different diameters, say 1,25, 2,5 and 3,75 meter. Might it be an idea to create another set of the same diameters, but with reflectiveness applied? It is not the nicest way of fixing things, as a solution that comes from the plugin itself would be much preferable, but just as an intermediate fix.

Just to be clear, this means that every diameter would appear twice in the VAB parts list.

Share this post


Link to post
Share on other sites

Would it be possible to get a camera facing angle based (Fresnel) falloff for this reflection shader? I imagine it would be a bit more expensive to render, but it would look sweet.

Share this post


Link to post
Share on other sites
Stretchies now come in different diameters, say 1,25, 2,5 and 3,75 meter. Might it be an idea to create another set of the same diameters, but with reflectiveness applied? It is not the nicest way of fixing things, as a solution that comes from the plugin itself would be much preferable, but just as an intermediate fix.

Just to be clear, this means that every diameter would appear twice in the VAB parts list.

If we're talking about two sets of stretchies, it wouldn't work. It doesn't matter how many sets of stretchies there are because the stretchy code will be trying to apply materials when it starts up. It either has to be prevented somehow, ideally by being updated to detect the presence of the reflection plugin and work with it by having one of its texture cycling options call the reflection plugin to apply its material or maybe have the reflection code rolled in the Stretchy code.

Would it be possible to get a camera facing angle based (Fresnel) falloff for this reflection shader? I imagine it would be a bit more expensive to render, but it would look sweet.

Not without coding a new shader. And incorporating the compiled shader code into the dll.

Share this post


Link to post
Share on other sites
Would it be possible to get a camera facing angle based (Fresnel) falloff for this reflection shader? I imagine it would be a bit more expensive to render, but it would look sweet.
Not without coding a new shader. And incorporating the compiled shader code into the dll.

There's a tutorial here that may be useful:

http://packtlib.packtpub.com/library/9781849695084/ch04lvl1sec34

attachment.php?attachmentid=8662&stc=1&d=1261527436]

Share this post


Link to post
Share on other sites
If we're talking about two sets of stretchies, it wouldn't work. It doesn't matter how many sets of stretchies there are because the stretchy code will be trying to apply materials when it starts up. It either has to be prevented somehow, ideally by being updated to detect the presence of the reflection plugin and work with it by having one of its texture cycling options call the reflection plugin to apply its material or maybe have the reflection code rolled in the Stretchy code.

Ah, okay. I am not too familiar with the inner workings of the plugin. I thought the idea was worth a shot, but I guess it would not work :)

Share this post


Link to post
Share on other sites

Would it be possible to make a version that rather than targets globally by changing part configs was able to target individual textures by single address i.e.

KSP_win\GameData\your_folder\individual_texture?

Share this post


Link to post
Share on other sites
That's actually only linking to a picture, not the tutorial itself :P

(But I have seen that one)

The PacktLib link takes a while to load: "Unity Shaders and Effects Cookbook: Fresnel reflections in Unity3D"

The picture is from a separate tutorial because shiny. :)

Share this post


Link to post
Share on other sites
Would it be possible to make a version that rather than targets globally by changing part configs was able to target individual textures by single address i.e.

KSP_win\GameData\your_folder\individual_texture?

It doesn't target anything globally. It affects only the part it is placed on either the entire part or selected meshes on the paerto and replaces whatever shader it uses with a reflective shader using whatever texture the part has as a base.

Share this post


Link to post
Share on other sites
It doesn't target anything globally. It affects only the part it is placed on either the entire part or selected meshes on the paerto and replaces whatever shader it uses with a reflective shader using whatever texture the part has as a base.

Ahh now I understand. I misunderstood how it works - effecting the material not the texture... Every time I learn something new it pushes some old stuff out of my brain. Doh!

I would really like to see reflective visors on kerbals in EVA. Sadly I do not know where the required mesh is located :(

Share this post


Link to post
Share on other sites
Ahh now I understand. I misunderstood how it works - effecting the material not the texture... Every time I learn something new it pushes some old stuff out of my brain. Doh!

I would really like to see reflective visors on kerbals in EVA. Sadly I do not know where the required mesh is located :(

I think Universe Replacer is a good start. Doesn't it change Kerbal textures?

Share this post


Link to post
Share on other sites
I think Universe Replacer is a good start. Doesn't it change Kerbal textures?

Yeah universe replacer does change the texture but unfortunately if you change the helmet visor texture it stays translucent as it mostly seems to turn green :(

He needs a shiny visor ;)

kosmonaut7_zps09b3af14.png

Share this post


Link to post
Share on other sites
Yeah universe replacer does change the texture but unfortunately if you change the helmet visor texture it stays translucent as it mostly seems to turn green :(

He needs a shiny visor ;)

http://i1332.photobucket.com/albums/w615/greenskullinc/kosmonaut7_zps09b3af14.png

Ok but the point is that the answer as to how to change the visor is probably there.

Share this post


Link to post
Share on other sites
It should be able to support adding in any shader. Currently the shaders have to be are added in as embedded resources. I'm not sure if that can be changed or not. Which means they're actually added when the dll is compiled as part of the dll.

What would be ideal is if I could take any shader source, compile it and turn it into an asset package and have it loaded up when KSP starts up. Unity does support that but I'm not sure if it's possible for US to do with the tools provided....? (i.e. it's a Pro feature, meaning that the game has to be using the Pro license which KSP is but is the toolset available to us the same as what Pro users get?)

BTW, the next update to this will fix a bug that is in the current download which is that realTimeReflections aren't properly turned off. But when I fix that bug another creeps in which is that the shader is not properly reflective on the launchpad or when first switched to.... It takes about a minute worth of updating before it kicks in. That's actually something that was plaguing me before and I thought I fixed it but apparently only replaced it with a different bug. Not really sure what's happening, as near as I can tell the update function is being properly called but just doesn't produce or apply the cubemap immediately. Either it's sitting there updating for the entire minute or just doesn't work the first time or something. And I can't programmatically determine whether it's worked or not, I only know by watching it in-game.

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

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.