Starwaster

[1.0.5] Reflection Plugin Continued 2.0

Recommended Posts

missed this because I was replying when you were posting.

yes it's possible, that's one of the things I was talking about earlier. Having the option to base update rate on how much of your orbit you've covered in a given period.

How about using a coefficient like: mainBody.radius / (altitude + mainBody.radius) or something similar? That way it will have higher refresh rate when being closer to the ground.

Share this post


Link to post
Share on other sites

I hope KW Rocketry uses this I'm having ago now at modding a KW Rocketry fuel tank with Hydrogen GAs and this reflection mod. I'm noob at it though. And I won't be able to share it as the tank model is not mine.

Share this post


Link to post
Share on other sites

What combination of settings would be best for a blurry brushed-metal kind of reflection?

Share this post


Link to post
Share on other sites
What combination of settings would be best for a blurry brushed-metal kind of reflection?

Just lower the reflection resolution to something like CubeMapSize = 16 . Lower the resolution, more blury it will look like, The caveat is only that you can see the sharp seam of the cube map. But only if you look carefully enough =)

Share this post


Link to post
Share on other sites
Edit: Confirmed that the missing shaders are actually not present in KSP 0.23. (They were apparently available up to KSP 0.22) I'm currently working towards incorporating the missing shaders directly into the plugin.

Contact me on IRC if you need info for that :)

Share this post


Link to post
Share on other sites
How about using a coefficient like: mainBody.radius / (altitude + mainBody.radius) or something similar? That way it will have higher refresh rate when being closer to the ground.

Something like that could work but it would need to take into account speed.... otherwise you could end up with a high refresh rate when nothing's really changing?

I hope KW Rocketry uses this I'm having ago now at modding a KW Rocketry fuel tank with Hydrogen GAs and this reflection mod. I'm noob at it though. And I won't be able to share it as the tank model is not mine.

So share the config :)

Better yet do it as a ModuleManager config so you don't even have to distribute part files.

What combination of settings would be best for a blurry brushed-metal kind of reflection?

In addition to the answers given I would try playing around with the alpha channel and/or normal map. (bump map)

But probably more alpha technique as using the normal map approach would probably leave it too lumpy looking. What you do is have a brushed looking texture using higher values of alpha combined with more brushed texture using lower values. Give something like that a try. Combine two such images and copy it into the alpha channel.

Contact me on IRC if you need info for that :)

I actually have something working right now using EmbeddedResources and StreamReader. But if I get some spare time today I'll hit you up in IRC and see if that's where you were going or if you had something else in mind.

All we need is more crash and you are doing good .

I'll see your crash and raise you MOAR BOOSTERS.

(remember, when all you have is boosters, everything looks like gravity...)

Share this post


Link to post
Share on other sites

As I was putting the settings in the config file, I was thinking if someone had a lower or higher end machine they would have to change each config manually to adjust the settings.

Would it be possible to get a global config file that would push all the setting up or down?

That way I could set up the defaults in the part config and if you had a higher or lower end machine you could tweak the values globally.

Share this post


Link to post
Share on other sites
As I was putting the settings in the config file, I was thinking if someone had a lower or higher end machine they would have to change each config manually to adjust the settings.

Would it be possible to get a global config file that would push all the setting up or down?

That way I could set up the defaults in the part config and if you had a higher or lower end machine you could tweak the values globally.

It's possible, yes. It's probably also possible just to check and see what their graphics settings are at and change configuration based on that.

That's assuming that the game graphics settings don't already affect the the reflection shader to begin with. (which it might not if its KSP specific settings vs stock Unity shader...)

Share this post


Link to post
Share on other sites
As I was putting the settings in the config file, I was thinking if someone had a lower or higher end machine they would have to change each config manually to adjust the settings.

Would it be possible to get a global config file that would push all the setting up or down?

That way I could set up the defaults in the part config and if you had a higher or lower end machine you could tweak the values globally.

Try something like this


@PART[myPlugin_*]:HAS[ @MODULE[ReflectiveShaderModule] :HAS[#LowUpdateRate[half]] ]
{
@MODULE[ReflectiveShaderModule] {
@updateRate = 150
}
}
@PART[myPlugin_*]:HAS[ @MODULE[ReflectiveShaderModule] :HAS[#LowUpdateRate[quarter] ] ]
{
@MODULE[ReflectiveShaderModule] {
@updateRate = 75
}
}

Edited by rhoark

Share this post


Link to post
Share on other sites

HI I've always been a lover of shiny things and this is a little dream come true, works beautifully on mbms, well enough to keep me very happy, still experimenting with various settings, but i thought if you don't mind I'd share this here as it sort of shows the plugin working to insane levels of shininess and thats only 0.5!!!! Cheers for a great addon.

shinyTiebySMSE_zps732d909f.png

Share this post


Link to post
Share on other sites
HI I've always been a lover of shiny things and this is a little dream come true, works beautifully on mbms, well enough to keep me very happy, still experimenting with various settings, but i thought if you don't mind I'd share this here as it sort of shows the plugin working to insane levels of shininess and thats only 0.5!!!! Cheers for a great addon.

http://i1007.photobucket.com/albums/af199/V12Tony/Kerbal%20Space%20Program%20pics%20and%20model%20renders/shinyTiebySMSE_zps732d909f.png

OMG it's a blinged out TIE fighter...

Share this post


Link to post
Share on other sites

Amazing ! There are really pretty examples here :).

@Starwaster: do you think you can use your work to add also transparency (with another shader I guess) ?

Share this post


Link to post
Share on other sites
Amazing ! There are really pretty examples here :).

@Starwaster: do you think you can use your work to add also transparency (with another shader I guess) ?

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.

Share this post


Link to post
Share on other sites

Are you rendering to texture in the DLL, rather than doing stuff GPU-side? If so, have you considered rendering single cubemaps per *vessel*, not per part?

Share this post


Link to post
Share on other sites
Are you rendering to texture in the DLL, rather than doing stuff GPU-side? If so, have you considered rendering single cubemaps per *vessel*, not per part?

Eventually, yes. That sort of optimization is later down the road as I need to get back to Copernicus and start pushing parts out the door. I have another update or two here first.

Share this post


Link to post
Share on other sites

Updated example usage post.

Also note numbers in the MODULE node should not have an 'f' after them. That was something that has proven to be necessary elsewhere but doesn't work right here. So updateRate should have been 300, not 300f.

(the f denotes a float but apparently it doesn't get read properly in a MODULE{} declaration and would cause the update rate to default to a value of 60)

Share this post


Link to post
Share on other sites

I have noticed another bug. Meshes with the shader no longer highlight green when selected or on mouse over.

Share this post


Link to post
Share on other sites
I have noticed another bug. Meshes with the shader no longer highlight green when selected or on mouse over.

That's either because the reflection is applied as emmissivity or because highlighting doesn't work with non-KSP shaders.

reflective parts also dont turn translucent when picked up either. same cause probably. not sure if I can do anything about that. Except for the picking up thing... maybe...

Share this post


Link to post
Share on other sites
Any idea how to integrate this with a single StretchySRB texture/Is it possible?

Do you use TGA or PNG? And in any case: Do you use PNG transparency or TGA alpha for effects in StretchySRB?

Share this post


Link to post
Share on other sites
Well, I use PNG for that matter.

In that case, if you want to use this, you should change to TGAs and add an alpha channel (which gonna be the reflections, replacing what you get now with transparency using PNG).

I wish this could be used only in a specific added layer (to use it only in the glass, for example) but I don't know if that is possible.

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.