Jump to content

[0.21.x] ReflectiveShader Plugin (Version 1.2)


Razchek

Recommended Posts

I'm trying to get it working with my 762 part boat...

I'm guessing I'll be lucky to get at most 0.5 FPS :P

Edit: I found my problem, I had a } in between the end of the config and the reflection module, whoops.

Edit 2: Another quick question, does the shader use the CPU or the GPU more?

Check out the performance tips on the first post. They may help. :)

Also the next update should be up soon, there are a couple of optimizations that increase the FPS (for me) by 10-20 frames.

The reflection code impacts the GPU more than the CPU.

Link to comment
Share on other sites

Is it possible to have this only affect panels and windows, as that will bend my processor over and burn it.

Only if you make them separate pieces. I wanted my windows to be shiny and nothing else, but because it's implemented in the part.cfg and not in unity, you sort of need to make seperate parts to apply this shader to - but thats not a big deal, at least we now have the option..

you guys should see what im working on now, and its all thanks to this mod :)

Link to comment
Share on other sites

Only if you make them separate pieces. I wanted my windows to be shiny and nothing else, but because it's implemented in the part.cfg and not in unity, you sort of need to make seperate parts to apply this shader to - but thats not a big deal, at least we now have the option..

you guys should see what im working on now, and its all thanks to this mod :)

Using the Reflective/Specular shader will let you map reflectiveness using the Alpha channel on your textures (ref http://docs.unity3d.com/Documentation/Components/shader-ReflectiveSpecular.html).

But, you could also add it to single meshes if your model consists of multiple meshes (use the MeshesToChange variable). :)


The plugin is now updated. See the first post for more information. :)

Here are some pictures

First 3 are Reflective/Bumped Specular, last 2 are just Reflective/Specular

Javascript is disabled. View full album
Edited by Razchek
Link to comment
Share on other sites

Pretty cool work. Have you thought about gloss-dependent reflection blurring? It's an essential parameter for every specular material, as only extremely glossy surfaces like chrome would give off such sharp reflections. Shaders with static cubemaps are usually just grabbing low-resolution mip level when blurry reflection is needed, but I guess that won't work for you as blurring or downsampling images on the fly is too slow.

How about making only one global resolution variable (for example, set to 512), which is then altered per material basis to give properly blurry reflections? For example, if it's a concrete material with glossiness property set to 0.1, cheap 32x32 cubemap is created and reflection stays blurry as it should. If it's a painted metal material with glossiness set to 0.5 (rough blurry objects and horizon are visible), then 256x256 is created.

Some sort of basic filtering would be needed to hide pixelization, but overall it would look very good and consistent.

It will also solve the problem of relying on part config resolution values (I bet someone will eventually make a bad config with e.g. 4096x4096 resolution, who needs that). One global variable is how it's done in most games. User can alter global variable if he wants higher resolution, but you are not relying on configs that can break stuff anymore.

Another optimization technique would be to share low-resolution cubemaps between multiple parts. For example, anything lower than 128 would look proper on every part of the craft as there are no features discernible enough to spot improper origin point of reflection - horizon, sun and sky are practically all that is visible anyway. That would give enormous performance boost.

Edited by bac9
Link to comment
Share on other sites

Pretty cool work. Have you thought about gloss-dependent reflection blurring? It's an essential parameter for every specular material, as only extremely glossy surfaces like chrome would give off such sharp reflections. Shaders with static cubemaps are usually just grabbing low-resolution mip level when blurry reflection is needed, but I guess that won't work for you as blurring or downsampling images on the fly is too slow.

How about making only one global resolution variable (for example, set to 512), which is then altered per material basis to give properly blurry reflections? For example, if it's a concrete material with glossiness property set to 0.1, cheap 32x32 cubemap is created and reflection stays blurry as it should. If it's a painted metal material with glossiness set to 0.5 (rough blurry objects and horizon are visible), then 256x256 is created.

Some sort of basic filtering would be needed to hide pixelization, but overall it would look very good and consistent.

It will also solve the problem of relying on part config resolution values (I bet someone will eventually make a bad config with e.g. 4096x4096 resolution, who needs that). One global variable is how it's done in most games. User can alter global variable if he wants higher resolution, but you are not relying on configs that can break stuff anymore.

Another optimization technique would be to share low-resolution cubemaps between multiple parts. For example, anything lower than 128 would look proper on every part of the craft as there are no features discernible enough to spot improper origin point of reflection - horizon, sun and sky are practically all that is visible anyway. That would give enormous performance boost.

Those suggestions are sound!

I was thinking about the second suggestion already and implementing the shared cube map in the part module initializer.

As for the first suggestion, I would be silly not to consider it. In fact I think it would be ideal.

Cheers for the good suggestions. :)

Link to comment
Share on other sites

Hello, as I use this file?, Is downloaded as txt. You have to make?

I'm guessing that you're asking, "what do I do with this?" You have to save it as a .cfg file and place it in the "GameData\B9_Aerospace" folder. (I think thats it, otherwise you should check http://forum.kerbalspaceprogram.com/showthread.php/31342-0-20-ModuleManager-1-3-for-all-your-stock-modding-needs )

Link to comment
Share on other sites

look great, but my poor old PC is undoubly going too blow up if i use this mod :P

Still the screenshots looks awesome..

I will be posting an update in a couple of days once I narrow down some bugs. The performance increase is conditionally large and I'm sure that will help. :)

Very nice, now I can have my silver SciFi rockets!

Thank You.

You're welcome, and as with anyone using this mod I would love to see what you come up with!

Link to comment
Share on other sites

You're welcome, and as with anyone using this mod I would love to see what you come up with!

I had some fun playing with it this morning and used the Octagon Corporation Mod for the rocket.

It looks great in the VAB, but had some issues with it greying out at some angles.

I also tried different base colors like gold. Think Flash Gordon and War Rocket Ajax. :)

EYRSlNt.png

0L7530M.png

Left to right: Gold base; White base; Gray base

M3CmB5o.jpg

Link to comment
Share on other sites

Hey Raz,

Tried this on a prototype engine I'm toying with... seems the shader only makes it onto one object within the part. This part has roughly 22 separate elements. Not sure if you ever tried it on a part like this or not before.

Link to comment
Share on other sites

Hey Raz,

Tried this on a prototype engine I'm toying with... seems the shader only makes it onto one object within the part. This part has roughly 22 separate elements. Not sure if you ever tried it on a part like this or not before.

Hey,

Try setting MeshesToChange to all in your part config:

MeshesToChange = all

        // Use this variable to specify which meshes to apply the shader to.
// Not using this variable will default to the first found mesh.
// Use the actual mesh name for the value. Or you could use:
// all - to replace the shader on all meshes in the model.
MeshesToChange = meshName

I hope that helps!! :)

If not, could you PM me the prefab or model and I'll see if I can figure out what's wrong.

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