fatcargo

Members
  • Content Count

    372
  • Joined

  • Last visited

Community Reputation

53 Excellent

About fatcargo

  • Rank
    Spacecraft Engineer

Recent Profile Visitors

1,582 profile views
  1. (Ab)using Commnet to get occlusion data is a good choice KSPIE features a complex dependancy on power efficiency so take care how realistic you want your mod to be. Directionality is interesting feature, but if you can make it optional for short range transmission networks it would work great for small planetary bases. How close to KSPIE wavelength dependancy do you plan to make your mod ? If i may suggest, make beam wavelength dependant on emitter and receiver diameter only for simplicity. Please comment. It is better to resolve this as soon as possible. Ahh also since you published plugin source, please consider moving it to https://github.com/ site so you can recveive bug reports, and patches.
  2. For me, adding "VolumeConfigs.user" made it work, i guess in plugin code didn't account for starting from scratch. I like the UI, hints explain everything and yellow highlight helps keep track of what is edited. As for some of requests for alternate setups that match resource requirements for other mods - that may be partially solved by defining a tank setups by mod makers themselves. If some XYZ LS mod needs food/water/oxygen, than an appropriate preset should be made either by mod author OR a player that needs this. BUT there is a difference to normal presets - these "source presets" (or "base presets" ?) should not be deletable or editable, should be defined as MM patches that are active only if such mod is present in GameData. These presets are only used to generate initial tank setups that can be later edited and saved by player under a different name.
  3. Hoooolly Kraken !!! MY TEST MODEL WORKED. It has a prefab built as "variant" from custom FBX imported model and a vanilla Diffuse shader with custom png texture. Next test is animation driving a custom shader (which is already proven to work since prefab holds a complete compiled shader, does not matter if it is built into KSP ). A noteworthy reminder : in my part config i set model with "mesh" value instead of MODEL{} node so model loading failed every time before i changed it to the above config style. One more thing : i've "discovered" BlendShapes. That thing is really something else. Pretty mych every inflatable part uses this method to show part inflating animation. I'll HAVE to try that next. Oh also i didn't have time to test the code, that's why this reply is soooo late. THANKS @xEvilReeperx , you pretty much wrote the entire plugin for me. This is something i don't see every day !
  4. Ok i think i've analyzed enough of the code to continue discussion. First off, i've got Textures Unlimited 1.5.8.23 from ShadowMage's github repo. Secondly, if there is a more appropriate thread to discuss this (so as to not unnecessarily divide/divert attention) do please point me to it. i've noticed that central part is in TexturesUnlimited-1.5.8.23\Plugin\SSTUTools\KSPShaderTools\Util\SMFBundleDefinitionReader.cs which contains attribute [DatabaseLoaderAttrib((new string[] { "smf" }))] Is "smf" an extension that will trigger this plugin to load it ? I'm not familiar with this attribute. Next, further in source there is local var List<Material> adjustedMaterials = new List<Material>(); which appears not to be used for anything. Materials get added to it and nothing else. And being local it is not usable by anything outside of setupModelTextures(). Maybe some kind of cache used in future ? Why is this asset loading method limited to single model only ? I ask because loading of multiple models from single assets file may have savings in reusing textures and shaders as well. I admit i don't have much expirience with assets beyond some (failed) experiments. Will look into this more. One more thing : in above mentioned forum discussion about assets and models you have used asset's XML file (ending in " _bundle.xml") which i think should be handled in TU plugin as it provides all resources listed by name and type (i personally like this and will use it when i try again to make my loader plugin). What does worry me is if i try to pack multiple files with same name (for example multiple models that use different textures in different directories but otherwise have same filename). And last : is there an example asset file that features a model, shader and texture ? I'd like to have a look at it.
  5. Ohh i've thought that putting the asset file inside GameData is enough so that KSP's loader would take care of the rest. I guess custom loader is still needed. Ok i'll review the post(s) and build this. Its late i'll try again tomorrow.
  6. Sorry to bother you again but i've failed after several variants. This is what i did as a starting point : 1. create empty GameObject, rename to "test" 2. create simple cube named "Cube" 3. drag cube in game object as child 2. create material (resides in "Materials" folder) 3. assign "KSP/Diffuse" shader to material 4. assign material to mesh renderer component of cube object, add PNG texture 5. create "Prefabs" folder in asset explorer 6. drag and drop "cube" object from inspector to "Prefabs" folder to create a prefab 7. select prefab in asset explorer and select AssetBundle as "new" and type "cube" 8. select from menu KSPAssets > Asset Compiler 9. click on "Build" in "cube" row (make sure "auto" is selected) 10. wait for build to complete and then copy "cube.ksp" into folder "ATestCube" inside "GameData" (size is about 0.5 MB, mostly because of texture) 11. in same "ATestCube" folder create "cube.cfg" text file with PART { //... mesh = Cube //... } 12. run KSP and it shows error, says "PartCompiler: Cannot clone model from 'ATestCube' directory as model does not exist", though log file says that "cube.ksp" asset is loaded I also tried with MODEL{} to try and target my model by path PART { // ... MODEL { model = Prefabs/test position = 0.0, 0.0, 0.0 } // ... } But it too failed with message "PartCompiler: Cannot clone model 'Prefabs/test' as model does not exist" So, how do i now reference my model in part config ?
  7. That ... that is GREAT ! It is almost like making a game myself, down to bare metal where i can do it right ! Again thanks !
  8. Thanks for the info. I will use this for models with complex animations. Though one thing still bugs me : what to do with cfg file ? It too needs to go into asset ? If i leave it in GameData, won't PartLoader try to load .mu model (which now resides in asset that i'll have to load later when my shader can be added to KSP), and then fail ? And if i have to load .cfg from asset, then MM won't be able to access it ? Does KerbalKonstructs do something like this ? I looked inside sources for KK and made a small shader loader plugin that was supposed to load shaders prior to PartLoader start and it failed to do anything. To paraphrase linked forum post - the earliest time to load a shader is at MonoBehaviour.Awake() when LoadedScene is MainMenu. What also bugs me how come PartLoader doesn't fail on models containing KSP shaders ? If original KSP shaders are loaded later on, original models should also fail ?
  9. Ok thread restart. I was trying to analyze where i made a mistake but had no luck. @xEvilReeperx question about building assets : is the following link ... ... still a valid method ? I did found one interesting thing : "GameData\Squad\squadcorefx.ksp" is most likely place where shaders are stored, and models have no problem using those assets at loading time. Why is same not true for custom made .ksp assets ?
  10. In another attempt i removed completely animation from model with custom shader and it failed to load again. This time error it clearly showed in debug that unknown shader was used. Relevant lines from debug log: File error: Value cannot be null. Parameter name: shader at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader) at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Shaders\Shader.bindings.cs:118 If i pursue this any further it may be needed to apply both shaders and animations at runtime. For the time being, this thread may be considered to be on pause.
  11. NB: i forgot to say that i want to scroll the mesh over texture's UV space, for a scrolling effect over surface. Maybe all this is not needed to accomplish what i want. The property animation is a text file and uses "attribute" and "path" human-readable strings to specify targeted property. It could be specific to mesh if "path" is directly referencing the mesh in model. I've tried making my own shader loader but it failed (as expected). It was tagged as KSPAddon with instant startup. It appears to have successfully loaded the .ksp bundle, found the shader and loaded it into KSP, but the part using it still failed to load. Debug dump shows PartReader.ReadAnimation, so i'm sure it fails at animation. I've searched for info on custom shaders and seen that mostly they're loaded first, then applied to parts. Which is ok, but i have an animation referencing the shader, and i'd really like not to load that as well separately at runtime, and then apply custom shader. Looks like a lot of crutches propping up KSP API. IF TU can really load shaders before parts with property animations start being loaded and parsed, then i'd like to know more. Note that i did manage to create animation to drive shader property in unity editor. Below are contents of two files used to demostrate this. Here are two text blocks, save them in Unity project for testing in editor. For file "CUSTOMScrollingUnlit.shader" i keep in "Assets\Shaders" folder Shader "KSP/FX/CUSTOMScrollingUnlit" { Properties { _MainTex("MainTex (RGB Alpha(A))", 2D) = "white" {} _Color("Color (RGB Alpha(A))", Color) = (1, 1, 1, 1) [Space] _CoordinateU("_CoordinateU", Range(0, 1)) = 0 _CoordinateV("_CoordinateV", Range(0, 1)) = 1 [PerRendererData]_UnderwaterFogFactor("Underwater Fog Factor", Range(0, 1)) = 0 } SubShader { Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } Pass { ZWrite On ColorMask 0 } ZWrite On ZTest LEqual Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #include "../PartTools/LightingKSP.cginc" #pragma surface surf Unlit noforwardadd noshadow noambient novertexlights alpha:fade #pragma target 3.0 sampler2D _MainTex; float _CoordinateU; float _CoordinateV; struct Input { float2 uv_MainTex; float3 worldPos; }; void surf (Input IN, inout SurfaceOutput o) { fixed2 scrollUV = IN.uv_MainTex ; fixed xScrollValue = _CoordinateU; fixed yScrollValue = _CoordinateV; scrollUV += fixed2(xScrollValue, yScrollValue); half4 c = tex2D(_MainTex, scrollUV); float3 normal = float3(0, 0, 1); float4 fog = UnderwaterFog(IN.worldPos, c.rgb * _Color.rgb); o.Albedo = fog.rgb; o.Normal = normal; o.Alpha = c.a * _Color.a * fog.a; } ENDCG } } For file "test.anim" i keep in "Assets" folder. It drives "_CoordinateU" and "_CoordinateV" properties to move texture across a surface. %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!74 &7400000 AnimationClip: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: test serializedVersion: 6 m_Legacy: 1 m_Compressed: 0 m_UseHighQualityCurve: 1 m_RotationCurves: [] m_CompressedRotationCurves: [] m_EulerCurves: [] m_PositionCurves: [] m_ScaleCurves: [] m_FloatCurves: - curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 value: 0 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 1 value: 1 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 attribute: material._CoordinateU path: classID: 23 script: {fileID: 0} - curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 value: 0.9 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 1 value: 0.2 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 attribute: material._CoordinateV path: classID: 23 script: {fileID: 0} m_PPtrCurves: [] m_SampleRate: 60 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: genericBindings: [] pptrCurveMapping: [] m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 m_StopTime: 1 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 m_LoopTime: 1 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 m_LoopBlendPositionXZ: 0 m_KeepOriginalOrientation: 0 m_KeepOriginalPositionY: 1 m_KeepOriginalPositionXZ: 0 m_HeightFromFeet: 0 m_Mirror: 0 m_EditorCurves: - curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 value: 0 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 1 value: 1 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 attribute: material._CoordinateU path: classID: 23 script: {fileID: 0} - curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 value: 0.9 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 1 value: 0.2 inSlope: 0 outSlope: 0 tangentMode: 136 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 attribute: material._CoordinateV path: classID: 23 script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 m_Events: [] I added "test.anim" to list of animations in Animation component, which is located inside mesh object whose texture i want to animate.
  12. I've found that making a shader, then creating a ksp asset bundle and then copying it somewhere into GameData won't work, mu. model using that shader still won't load. I've looked around for sources on loading custom shaders and i can put something together. What i'm not sure is if a .mu file contains an animation that drives a property inside this custom shader the part will still fail to load if shader is not beforehand loaded/registered into KSP. If the above is true, do i need to write a plugin that loads BEFORE parts start to get loaded ? Like ModuleManager does for example. @Shadowmage Please enlighten me on this. Thanks in advance.
  13. I had a problem with breakpoints not being hit while debugging code. On a line with breakpoint i had a yellow circle with an exclamation mark and a popup text saying "The breakpoint will not currently be hit. Unable to find a corresponding location.". After some struggle i found a solution at https://stackoverflow.com/a/46720817. Basically i did the same but instead using Net 2.0 i switched from original 4.5 to 4.0 and back to 4.5. Each time VS informed to re-save the project. After that i followed instructions with a clean and rebuild and it worked. My breakpoints work again. It may be worth mentioning i had OS and VS on a SSD while project files and game itself are on another HDD. It appears that VS is not properly flushing cached files, causing .pdb to be out of sync with plugin .dll. It also explains why new project had no problems and as time went on it started to misbehave. Cycling between 4.0 and 4.5 may be an overkill but i mention it just in case.
  14. Ohh that's perfect ! That means i can add emissive, not worry about (too much) overhead and it will work in dark ! Yay ! Oh and update : i removed source anims, compiled anim works completely alone but i'm also curious about a possibility of adding curves for animating properties with arbitrarily set animation keys, even if animation with imported mesh does not have reserved time slots for it. Here is a post that hints at this,
  15. THANKS FOR THE PIC ! IT WORKED ! That small thing ... so much difference. And now i can use ModuleAnimateGeneric, no need for exotic stuff (yet ). I have to note that info is scattered across several threads but here is what i found : This is useful reference to see how parts are constructed, i used "light" demo to confirm my Unity install worked properly, "Central" reference with information (there may be smaller bits of info one can miss if tired/distracted), In my case, my mesh was imported as FBX file with Animation component, added to GameObject that holds PartTools. I've added a plain KSP/UnlitColor material to small piece of mesh to be used as color indicator (which is child of other meshes in animation). Then i created a new property animation (i guess this is appropriate name for it) and in "Reference" field wrote path to my color indicator mesh as first_level_child_of_imported_file/child_level_1/color_indicator_mesh. You can see this in yt video posted in Color Animation Editor thread when demonstrating Reference setup to "HierarchyEmissive" part of video. Pay attention at what is going on when watching it, it is easy to miss crucial details as design process is quite quick. This animation is targeting property "_Color" (note the leading underscore) found in KSP/UnlitColor material assigned to color_indicator_mesh. Then i selected my color_indicator_mesh in scene tab and opened Animation tab (menu Window > Animation or CTRL+6) and edited keys as needed. Next step was to, inside Project tab, CTRL+click multi-select both animation imported along with FBX and a newly created property animation, then right-click on any of selected items and from menu choose Animation > Compile Selected. This creates a new animation named "CompiledAnimation" in same folder as source animations. Don't forget to set "Legacy" flag as noted in previous post. Now i added that to a list of animations to root item where original imported animation resides. So there were three animations, original, property and freshly compiled one in animation array (i also added property animation). Finally, i did the usual exporting step and copied to GameData. After that i added CompiledAnimation to ModuleAnimateGeneric in animationName field, tested and that was it. It worked More useful bits of info to ones learning : while i was trying to make it work, i had two types of failures : part compiler failed to compile part and subsequently model was not found. Not much to do here except try again.This error is visible during load. Second failure type was far more dangerous - it made my KSP game eat up nearly all of my RAM, it used up 6.5GB in middle of load. For several times i barely managed to end task before it turned my machine into crawling pile of mud. One more thing : do not be alarmed when editing keys in property animation and see property names in yellow coilor with "(Missing!)" text, it works and it can be tested by dragging animation cursor. I'll try emissives next, they need extra step for creating textures. Which brings me to my next question : @JadeOfMaar some long time ago i've read on forums about limits for number of lights in scene. Does this apply to emissives as well ? I wouldn't want to burden player's machines with even more ultra-deluxe bang-whizz-splash