Jump to content


  • Posts

  • Joined

  • Last visited


279 Excellent

Profile Information

  • About me
    Spacecraft Engineer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The two other cameras are already initialized when I need them, I thought it would be an easy way to get these two cubemap in the final reflection cubemap //Skybox ScaledCamera.Instance.galaxyCamera.RenderToCubemap(rtex); //Scaled space ScaledCamera.Instance.cam.RenderToCubemap(rtex); //Scene //(...) Instead of setting the culling mask and position each time. But I realized this afternoon after testing a bit more that I don't have enough control on these cameras. There's something I didn't tried yet in your snippet. I will make the camera render the terrain before the scaled space, and see how it turns out. Thanks!
  2. Made small progress. It's still a lot of trial and errors at this point. Got inspired by this http://forum.unity3d.com/threads/shadow-fadeoff-approaching-far-clip-plane.356893/ , and found a way to use the original cameras to render cubemaps. So, to get the galaxy skybox, I can use ScaledCamera.Instance.galaxyCamera.RenderToCubemap(), and to get the ground skybox, I can use ScaledCamera.Instance.cam.RenderToCubemap(). If I replace my reflection probe by a camera, I'll have three cubemaps... And no idea on how to make them blend nicely (I need to blend day/night cubemaps, then add the local reflections over it). The blending factor will depends on the rotation of the planet, and the position of the player on it. To makes things a bit more complicated: the ground skybox is way brighter than the other reflections, and it's worse at night, where it turns white/yellowish. And yet I still haven't found the camera who will be able to render the ground. I'm looking for the "far" camera mentionned in the link above, if this one does not render the ground, I don't wich one will. If you have any lecture on cubemap blending / know a mod who use the game's cameras, it'll be appreciated. Thanks!
  3. Hard to explain (my poor english level don't help). For me it's normal to modify these variables, because I know exactly how they will react, and how the engine will (or should) render them. But I'm afraid that modifying some contrat and brightness values to get a mask could be confusing. Should've mentionned the mask is created in real-time, so you can see your changes directly, and save it from the game. You probably won't use it if you make your textures in an external editor. This is not a intended to give perfect results, but it should be good enough to convert simple parts mods. Invert the colors. I don't have that yet. Noted. It's an approximation, based on the assumption that parts will mostly be gray/black in KSP. Black being the painting (less reflective, more occlusion), lighter areas will have slightly higher values, making them more reflective/shinier. It does not work with engines textures, where this logic is inverted (painting is lighter than the metal), that's also why I'm looking for another way to make masks. Edit: how it looks on the FT-400 texture No values, actual values, High values, Extreme values.
  4. Thanks. I've read this article already, but it kinda contradict the Unity's materials charts, Where the charts advice is to keep this value pretty low (light-grayish). The idea is the same, though. The code above, despite being simple, can provide this kind of results. I guess my question should be : What kind of parameters should be able for modders to use?
  5. I'm rewriting pretty much everything, to include the changes from the latest parttools release. It means this mod will be able to replace more parts shaders (like the OscarB fuel tank), but this also means the shaders will need KSPLighting.cginc to be compiled, and I can't include this file with the sources. I'll add another readme file to explain how to set up the editor folder to compile them. I have a quick question regarding the tool I want to implement: Where can I find some decent algorithms to convert a diffuse texture to metal/gloss/occlusion values (I can also have access to bumpmaps and emission if it's necessary)? What I have right now is a very basic function that will probably provide basic results. It's a port of what I've used for the stock parts so far: you set a range of values, contrast, brightness, then it returns a value based on the texture's grayscale. float GetGloss(float min, float max, float4 color, float brightness, float contrast) { float range = max - min; return ((range * pow(Grayscale(colot), contrast)) + min) * brightness; } Same for Metallic and Occlusion values at the moment. If not algorithms, anything relevant will be appreciated.
  6. I hope you've got a backup of you original Squad folder... To install it, you just need to unzip the archive in the GameData folder, like any other mod. the masks textures should stay there, otherwise the mod won't load them. You can check if the mod is loaded correctly in the main menu (it should log some infos), and in a flight scene (the "PBR SL" icon in the toolbar). The current masks are made to look like the vanilla game. I plan to add some tools to modify them in-game shortly, but until then you'll have to make them by hand.
  7. The sky is reflected on the launchpad and the runway, where the vessel spawn. It happen on a small distance, the sky stop being reflected once the probe get out of this cube. I guess this one is the "atmosphere" sky box. I suppose it's always placed at vessel's position when a flight scene start, but after that it doesn't move (the position is probably refreshed with scaled space). If I can make it follow the vessel, it could solve the skybox problem, but I'm not sure if the game will like it.
  8. That's what it looks like, but it shouldn't be happening: at the moment, it's still a simple reflection probe, supposed to be attached to the vessel's root part... I realize the last updates were only to make it work, without success so far. I'll focus a bit on something else for the next release(clean the code and add a few functions). Got a bit bored of trying to make reflections work with vessels, so I'd make them not work with planets, too! (glitches may have been cropped from this screenshot)
  9. The renderprobe object itself is the most "transparent" way to get this working, but it seems to have too much limitations at the moment, compared to a camera, to render a cubemap. I tried to render a cubemap following this script http://docs.unity3d.com/ScriptReference/Camera.RenderToCubemap.html but it got the same problems( rotated textures, and terrain not reflected). Though I probably should've used TR sources instead, I really didn't expect it to work on first try... @nli2work What's happening in this last vid? V0.04 Changelog : -Added an UI in flight scene (still WIP). Added the possibility to refresh shaders masks after reloading the game database. Download : https://www.dropbox.com/s/qh714b3p6an1e9i/PBRShaderLoader_v0.04.zip?dl=0 Sources : https://www.dropbox.com/s/a2jeqd5a2jg8fd6/PBRShaderLoader_v0.04_src.zip?dl=0 Edit: Already found a bug, sorry : the reflection probe can't be reenabled via the UI. I'll fix it for next release.
  10. GlobalBrightness and saturation should affect only albedo, not reflections. In the original standard shader this line is just "o.Albedo = c.rgb;". It's not really color saturation, either. more of a contrast. And the the textures tends to become dark with this, hence the GlobalBrightness value. The default in the config file should be "1.0" for these two variables. To compile a shader, import it in Unity, select it, and you should have "Compile and show code" in the inspector. Click on the arrow next to it to select only the platforms we need (OpenGl & DirectX9/11/11_9x), and compile. The compiled shader will be saved in your project directory, in the "temp" folder. I'll add a way to reload masks at runtime. I also need to make a small interface to set the reflection probe's properties, instead of the config file.
  11. Thanks, I'm looking for this kind of snippets right now. I'm getting better with Unity but I still have a lot to learn about KSP scenes. I made a quick modification on specular shaders Forgot to include them in the last build, but I'll do it for next version. You can extract the compiled versions to the mod if they work as you expect (instead of being "globalShininess * Specularcolor", the specular output is now "diffuse.alpha * SpecularColor"). https://www.dropbox.com/s/si0df9kd4glirfc/specularshaders.zip?dl=0 Small update, so it does not get a real version incrementation. V0.031 changelog : -Changed the reflection probe's culling mask to hide vessel reflection -Fixed the background color value from config file (and changed it to black by default) Download : https://www.dropbox.com/s/0t3vq8uo7gs5d5p/PBRShaderLoader_v0.031.zip?dl=0 Sources : https://www.dropbox.com/s/jmfvc662b56sxll/PBRShaderLoader_v0.031_src.zip?dl=0
  12. That's some useful informations, thanks! I does not solve the problem of the terrain's reflection, but now I can prevent it to render the navball, the IVA view, and ship's parts (this also means close ships won't be reflected...) The reflection probes will use layer 9 (atmosphere), 10 (Scaled scenery), 15 (local scenery), and 23 (not in the link, but it's used for distant celestial bodies) . Also not in the link, the navball is on layer 25. It's a bit better now, if it wasn't for the terrain and flipped faces glitches. I made a quick search for the flipped faces, Surprinsingly it's a common problem. I'll probably have to create the cubemap from a camera, and get rid of reflection probes (the idea is to render each face, then flip the two wrong faces, it can't be done with probes). This will look a lot like TR's visors reflections function... In fact, since the shader loader is almost the same too, this plugin might become a fork of TR at some point. That adds layer 18 to the current culling mask, thanks. Maybe I can find this skybox camera and render the cubemap to a rendertexture, then assign it as a skybox of the probe's camera? I'll see how it turns out.
  13. I haven't found a proper way to avoid this yet. The part itself isn't reflected, thanks to the backculling, but all attached parts are. The culling mask for the probe can be set to ignore them, but then most elements of the scene are not reflected. The solution until I can get something to work is to set the "near clip plane" value pretty high. The RPSize values did nothing in 0.022, but it found a purpose again. It uses to be very small when I ran some tests with a probe per part (I wanted the probe to contain only the part's meshrenderer). Now it needs to cover the whole vessel (50 by default, wich is pretty low). Thanks for your patience! V0.03 changelog: -more stable (fingers crossed) -add reflection probe when switching vessel (without crashing, most of the time) -use highest probe resolution only for active vessel (other are refreshed less often, with a 1/4 resolution) -added a "Near Clip Plane" value in the config file. Set it higher if inside of the vessel is reflected. Temporary until I figure it out. Download : https://www.dropbox.com/s/dmt8uhcnog3vdpo/PBRShaderLoader_v0.03.zip?dl=0 Sources : https://www.dropbox.com/s/a47ho8yn1sq1n0i/PBRShaderLoader_v0.03_src.zip?dl=0
  14. DDS4KSP try to detect if a texture is a normalmap, it might be wrong sometimes. check the log file to see if your main texture has been converted correctly. If not, use the option to convert a single file and uncheck "Flag as normal".
  15. Yep. The R channel is not really broken in specular shaders, They use the StandardSpecular lighting model, where the Metal value isn't needed. http://docs.unity3d.com/Manual/SL-SurfaceShaders.html I kept their appearence order, but I can change it, or even separate these three values in their own textures (with 32 bits precision, this time), if needed. Maybe not a single shader for everything, but I can definitely reduce their count. I can do that for stock parts, but I'll let the specular shaders available, if someone want to use them. For coherence between parts, we will probably need a "materials chart", with reference values, too. I'm still experimenting with masks values. Still need to do some testing before another release, so here's a screenshot to keep you waiting.
  • Create New...