Jump to content

Lilleman

Members
  • Posts

    242
  • Joined

  • Last visited

Everything posted by Lilleman

  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.
  16. That'd be great. I posted here because at the moment it's mostly a plugin intended to part modders, but it'd be more relevant in the plugin development section. On an unrelated note, there's still some bugs when switching vessel with this last version. I'll fix it asap.
  17. I thought it would fix my findVesselBounds() function, but no... At least it fix the crash with launchlamps, so here's a quick update. V0.022 changelog : -Fixed the crash when switching from a vessel to a launchclamp. Download : https://www.dropbox.com/s/6u7uk2ni3xxh4rq/PBRShaderLoader_v0.022.zip?dl=0 Sources : https://www.dropbox.com/s/91pa99h3dtxmata/PBRShaderLoader_v0.022_src.zip?dl=0
  18. Looks like the plugin tried to locate an unactive object. It crashed the game when you switch from a vessel to a launchclamp, but not when you switch from a vessel to another... I didn't noticed that. edit2 : found the problem, should've used Part.GetPartRendererBound(), instead of Part.gameObject.GetRendererBounds() in my previous function. I'll take a closer look at it tomorrow.
  19. At the moment, bounds are calculated once, on vessel loading. I planned to resize/change the position of the reflection probe each time the vessel is modified (on stage/crash/dock), and also add a low-res probe to debris (refresh rate and resolution should be defined depending on camera's distance). For now it adds a reflection probe when OnVesselChange is called. Some changes needs to be made here. I want to clean the code first, and check if it's compatible with other mods (I suspect my shader loader class to be incompatible with Texture Replacer). Here's the function I use to find a vessel bounds. It's a bit naive, but it should do the trick for what I want to do: http://pastebin.com/m4gQQdQc
  20. If it was just for the ambient lighting, Planetshine is doing just fine. But PBR shaders are not looking as good without reflections. Jool's reflection on Kerbal X. Plus, I never used light probes. I just took a quick look on Unity's documentation, and I don't really see how it could be applied to KSP. I'll learn a bit about it. FAR's solution to calculate bounds seems overly complicated for my needs, I've got a function to do that (wich is just testing parts renderers bounds). I should try to attach the probe to the closest part to bounds center, instead of the root part.
  21. It's still not working exactly as it should, but it looks a bit better. v0.02 Changelog: -Fixed the Alpha Cutoff shaders, to get rid of a somehow good-looking glitch http://imgur.com/OMxXrir -Use a single reflection probe per vessel. -The backgound color in the config file is now an hex value -The "reflection probe size" value now does nothing (the reflection probe should be scaled from the ship's size) That's about it. I'm still trying to figure out how to hide a vessel's meshrenderers before updating the cubemap. Also, whatever I try, the probe seems to be located in the root part, I can't find a way to attach it to the ship bounds center... Download : https://www.dropbox.com/s/6f36nv5iaxvqvjh/PBRShaderLoader_v0.02.zip?dl=0 Sources : https://www.dropbox.com/s/mrj2znkt8atj0p8/PBRShaderLoader_v0.02_src.zip?dl=0
  22. I was trying to get the most accurate reflections possible, but a probe per part is definitely too much. Unity handles it, though, it just refresh them very slowly. Still, I need to use something else. I tried that because there's no way to set the probe's culling mask to ignore parts, and it leads to some weird reflections (IVA view is reflected, for instance). I don't think I can change the parts rendering layers to fit my needs. As for the skybox, I was thinking of making my own (make a cubemap from a camera). I'm not sure how it will turn out. No problem.
  23. Nobody tried it yet? I'm counting on feedbacks to improve this. Maybe it'll get more visibility in the "Add-on development" section? I'm having a small problem with probes: at the moment they are assigned automatically by Unity: the closest probe to a mesh's face is used. It can lead to some weirdness, so I need to use the "anchor override" MeshRenderer's option. The problem is: reflection probes are added to parts prefabs, when the MeshRenderer component is not yet initialized. Is there a way to assign the anchor override on a prefab?
  24. Yep. For now it can replace KSP/Alpha/Cutoff, KSP/Alpha/Cutoff Bumped, KSP/Alpha/Translucent, KSP/Bumped, KSP/Bumped Specular, KSP/Diffuse, KSP/Emissive/Bumped Specular, KSP/Emissive/Diffuse, KSP/Emissive/Specular and KSP/Specular. It should cover most parts. Shader's sources are in the archive, you can check in Unity's editor if they work as you want. The shader will be replaced only if a mask texture is available. They are stored in the mod folder, I wanted to keep them separated for convenience. Also, it add a reflection probe component to each part. You can set basic properties for it in a config file.
  25. 'Got a first "proof of concept" release to make. It's very basic, but you can already have an idea of what it will look like, and mess with it. I'm not sure about the license for the compiled version : it use some masks made from Squad's textures, can I redistribute them with the current license (WTFPL)? They are made from a script, so at the moment they are not looking as nice as they should. Most of them are looking somehow similar to the stock game. As mentioned earlier: the red channel set the "Metallic" value, green is "Smoothness", alpha is "Occlusion". Red channel isn't necessary for Specular shaders. Anyway, some parts still don't have a new shader (like the OscarB fuel tank): it seems they use the "KSP/ScreenSpaceMask" one. As it wasn't in the 1.1 parttools package, I'm not sure how it should behave. Here's the compiled version : https://www.dropbox.com/s/0l70289yyipkoym/PBRShaderLoader.zip?dl=0 Sources : https://www.dropbox.com/s/isc2yjsgs4l1rpe/PBRShaderLoader_src.zip?dl=0 This is an extreme case. Do not try this at home Edit : forgot to mention : Expect some glitches. It does not look as nice in movement...
×
×
  • Create New...