-
Posts
2,719 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by rbray89
-
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Hmmm... the zip download is giving you trouble? Just tried it and it seems to work... -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
I'll post an update tomorrow morning. The video is being uploaded as we speak. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
oh, and there a Game Object folder in the source link if you want to give it a go yourself Once the scene loads, select the Generate button to perform the magic. This will be automated in the future, but for now it is nice for debugging. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
No, I didn't have to do anything... I just added some GUI code to adjust it. My co-ordinate system is phase shifted by 1/4 it seems. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
I'm aligning the texture up as we speak! (This could take a while.) This happens WAY more than I'd care to admit. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Good News! My updated shader fixes the lighting bug! I'll be posting a new vid once I get my hands on that sweet, sweet texture from 5thHorseman. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
haha, PNG or TGA is good. Any reasonably large size should be good (2K+). It looks FANTASTIC BTW. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Is this the one? http://forum.kerbalspaceprogram.com/entries/971-Doing-Science-Celestial-Body-Biomes!/page5 -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
This looks fantastic so far! -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Yeah, I think I know the issue... as for the shader, this is my surface lighting function: inline half4 LightingNone (SurfaceOutput s, half3 lightDir, half atten) { half NdotL = dot (s.Normal, lightDir); float lightIntensity = _LightColor0.a * (NdotL * atten * 32); float satLight = saturate(lightIntensity); float invlight = 1-satLight; invlight = invlight*invlight; half4 c; c.a = s.Alpha * invlight; c.rgb = s.Emission * invlight; return c; } The problem I think I am having is that the lighting wants to use some alternative lighting model at times. Could be as simple as a pragma directive. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
It probably will be, though at the moment, the same mod is my test-bed for everything. Right now I'm mostly toying with shaders to get the lights right, but I have a bit of a tendency to bounce to whatever I find to be more interesting at the time. The other option would be to simply have it configurable, ie. Lights only, cities only, etc. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
It's all shader magic. I created a surface shader that uses a modified light mechanism to crank the alpha up/down depending on light intensity. I have a feeling there is something up with the lighting models I'm not handling properly that I have to fix to get rid of the glitchyness. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
I had a glimpse at them earlier, and I think that those should work really well. -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Anyone will be able to use this alongside any other mods... so it should play nicely, and they can just replace/update the texture. The lights are a completely seperate Game obect with it's own mesh. Could be used with Universe Relpacer without It uses a custom shader to adjust the Alpha and Emmissive properties when exposed to light. I have a few ideas about why it seems to "Flicker" when the view is panned quickly or time is dilated Yeah, I think I'll let the community decide that one. Thanks! -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
That would be fantastic! Something LARGE. The texture that is 1778x889, but the resolution kinda stinks. Should probably be twice that size. Anything should work provided it maps to kerbin well. Anything transparent should have low alpha. The emissive property comes directly from the rgb component, so if there is enough alfa to keep it from being invisible it will show up as lit. Thanks! -
[PLUGIN][ALPHA-10] City Lights and Clouds on Kerbin/Others
rbray89 replied to rbray89's topic in KSP1 Mod Development
Thanks! I aim to please! Sorry the video is so long/boring. -
So I think I have mosty worked out the city lights: http://forum.kerbalspaceprogram.com/threads/52159-PLUGIN-ALPHA-Cities-and-City-Lights-on-Kerbin I have also given city placement some thought, and I will proably use a texture to generate them... That would make it much easier to align the light texture with the actual cities.
-
This is an alpha release, but getting much closer to a Beta stage. City Lights for Kerbin and Clouds for Any planet you wish! The config file can be modified to add any number of cloud layers to any planet. I will be updating all builds here: http://forum.kerbalspaceprogram.com/threads/55905-0-22-Beta-1-City-Lights-and-Clouds
-
It looks like it will work well for above views: I still have to tweak the render distance and the values i'm using in the shader. If you are interested, this is it: Shader "AlphaSelfIllum" { Properties { _Color ("Color Tint", Color) = (1,1,1,1) _MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white" } Category { Lighting On ZWrite Off Cull Back Blend SrcAlpha OneMinusSrcAlpha Tags {Queue=Transparent} SubShader { Material { Emission [_Color] } CGPROGRAM #pragma surface surf Lambert vertex:vert sampler2D _MainTex; fixed4 _Color; struct Input { float2 uv_MainTex; float3 fooAlpha; }; void vert (inout appdata_full v, out Input o) { // Transform to camera space float dist = distance(float3(0,0,0), mul(UNITY_MATRIX_MVP, v.vertex)); float alpha = dist * .00005; alpha = alpha*alpha; alpha = min(.85,alpha); o.fooAlpha = alpha; } void surf (Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgba; o.Alpha = min(c.a, IN.fooAlpha); o.Emission = c.rgba; } ENDCG Pass { SetTexture [_MainTex] { Combine Texture * Primary, Texture * Primary } } } } Fallback "Self-Illumin/VertexLit" } I'm not using any texture with it, but eventually it will be a halogen lamp color with a conical shape. It works fairly well with varying from distance, but it could be better. It is mostly the float alpha = dist * .00005; line I'm tweaking at this point. Though I may make it a cubic distance function instead of a square.
-
One thing I did notice is that all the buildings are edge to edge. Is this also intentional? You don't have any alleyways, and you generally don't see taller buildings right up next to each-other. I do like how the smaller buildings are connected though. That is closer to reality then having those all separated.
-
I think I figured out a good way to emulate areal city lights at night... it also has the bonus effect of creating a "light pollution" effect when looking up from within a city. I'll be posting it when I'm done working everything out, but essentially it is a custom distance-sensitive emissive/transparent shader that fades as the camera nears it. What I hope to do is place two quad planes above the city. One at ~200m and the other at ~800m. The lower one would be the exact size of the city, maybe a little bit extra to provide a good "higher res" "light source" at lower altitudes. The upper layer would have a circular gradient texture and would cover ~2x the size of the city to provide a "light dot" that would be seen at much higher altitudes. ie. _ _ _ _ _______ _ _ _ _ ---------------- ..|..(CITY)|..|.