GeneCash Posted September 13, 2013 Share Posted September 13, 2013 So I noticed that some of the YouTube videos had shadows! And I don't! That's not right. This is a big issue for trying to land as it makes it really difficult to judge height. It also makes EVAs harder, at least for me.Now this is for people running Linux on Ivy Bridge, so I hope I can help both you guys out there.DISCLAIMER:I'm running 64-bit Debian Testing (Jessie) on a Core i7 CPU. This may help other folks that don't have the exact same setup, like people using 32-bit or Ubuntu, etc. but I can't make any guarantees. If it breaks, you get to keep both pieces. It's only changing 1 byte, but hand-editing an executable is life on the edge. This is a nasty hack and I'm a bit surprised that such a simple fix worked. Your mileage may vary. Stunts performed by professional driver on closed course.THE ISSUE:I'm assuming you can run KSP fine, you just don't get shadows. The problem is the Intel graphics hardware is blacklisted by Unity3D, so in your Player.log file you end up seeing this line:GL: disabling shadows on Intel 9xx (buggy)As far as I can tell, you can't make Mesa/OpenGL lie about the graphics cards, so what I do is edit the KSP.x86_64 binary to no longer match the "Intel" name.I tried the "hexedit" mode in emacs, and that corrupted the file, so I used a program called "wxHexEditor", from the wxhexeditor package (do "apt-get install wxhexeditor")THE FIX:Go to where ever you have KSP installed and copy your binary to a backup:~/KSP_linux # cp KSP.x86_64 KSP.x86_64.oldEdit your binary:~/KSP_linux # wxHexEditor KSP.x86_64 &Click the spyglass search icon, and click the "search as text" setting, then type "intel" as the search string. You should hit an area mentioning graphics card brand names like Nvidia, Radeon, ATI, and Intel.There should be an "Intel" string. Ignore the one in all uppercase. Click the right hand part of the screen and change this to "Intxl" or something else that won't match.0e8e180: 61be 993f 3baa b83f 2f73 7973 2f64 6576 a..?;..?/sys/dev0e8e190: 6963 6573 2f00 7063 6900 2573 2f25 7300 ices/.pci.%s/%s.0e8e1a0: 2f63 6c61 7373 0030 7830 3300 2f64 6576 /class.0x03./dev0e8e1b0: 6963 6500 2f76 656e 646f 7200 2f72 6573 ice./vendor./res0e8e1c0: 6f75 7263 6500 5369 5300 436f 6d70 6174 ource.SiS.Compat0e8e1d0: 6962 6c65 2056 4741 0036 3330 2f37 3330 ible VGA.630/7300e8e1e0: 004e 5649 4449 4100 4e76 6964 6961 0052 .NVIDIA.Nvidia.R0e8e1f0: 4144 454f 4e00 5261 6465 6f6e 0049 4e54 ADEON.Radeon.INT0e8e200: 454c 0049 6e74 656c 0025 692e 2569 2e25 EL.Intel.%i.%i.% <---- this one here0e8e210: 6920 4e56 4944 4941 2025 692e 2569 0025 i NVIDIA %i.%i.%0e8e220: 7320 5261 6465 6f6e 2048 4420 2569 2025 s Radeon HD %i %0e8e230: 2a00 4154 4920 5261 6465 6f6e 2037 3030 *.ATI Radeon 7000e8e240: 3020 4f70 656e 474c 2045 6e67 696e 6500 0 OpenGL Engine.0e8e250: 4154 4920 5261 6465 6f6e 2037 3530 3020 ATI Radeon 7500 0e8e260: 4f70 656e 474c 2045 6e67 696e 6500 5333 OpenGL Engine.S30e8e270: 2000 474c 5f45 5854 5f74 6578 7475 7265 .GL_EXT_textureClick the save icon, exit wxHexEditor, and you should be done.TESTING:Now in the loading screen where Jeb is standing on the Mun, you should see an immediate difference. There should be a long shadow behind Jeb and a shadow behind the rock on the left side of the screen. If you go to the launch pad and load up a rocket, it should cast a shadow. In the loading screen with the 3 Kerbals on EVA, you should now see shadows inside the helmets.If you get "segmentation fault" then you corrupted your binary. Restore it from the copy and try again. You can check the binaries to see if your hex-editor did something bad:~/KSP_linux # xxd KSP.x86_64. >KSP.x86_64.dump~/KSP_linux # xxd KSP.x86_64.old >KSP.x86_64.old.dump~/KSP_linux # diff *.dump953889c953889< 0e8e200: 454c 0049 6e74 786c 0025 692e 2569 2e25 EL.Intxl.%i.%i.%---> 0e8e200: 454c 0049 6e74 656c 0025 692e 2569 2e25 EL.Intel.%i.%i.%If you get any other output, then yeah, it did...OTHER ISSUES:I started off without rocks, trees, and other terrain features. To enable these, go to the graphics settings and set "Fallback part shaders" to false, and enable "SM3 Terrain Shaders" and "Terrain Scatters (WIP)" - this is probably already known, but I went for a while without knowing it myself. Link to comment Share on other sites More sharing options...
gerner Posted January 25, 2014 Share Posted January 25, 2014 FYI, I just gave this a try and it seems to work!More specifically, my steps were:0) make a backup!$ cp KSP.x86_64 KSP.x86_64.bak1) figure out the byte offset where the particular Intel string shows up:$ cat KSP.x86_64 | xxd | grep "Intel"0f01f00: 454c 0049 6e66 6f6f 0025 692e 2569 2e25 EL.Intel.%i.%i.%0f024f0: 2049 6e74 656c 2039 7878 2028 6275 6767 Intel 9xx (buggThat first line is the one you want (as GeneCash points out), figure out what that is:$ printf "%d" 0x0f01f0015736576then add a few bytes to get exactly into that "Intel" string, in this case about 5 bytes should do it2) replace those bytes (thanks to StackOverflow: http://stackoverflow.com/questions/4783657/cli-write-byte-at-address-hexedit-modify-binary-from-the-command-line)printf 'foo' | dd of=KSP.x86_64 bs=1 seek=15736581 count=3 conv=notrunc3) profit! as GeneCash points out, you should see a shadow behind the kerbal on the Mun at startup. Link to comment Share on other sites More sharing options...
koen.db Posted April 30, 2014 Share Posted April 30, 2014 This is an ugly hack, but it works! Haven't found any 'buggy' behaviour on the shadows though. Link to comment Share on other sites More sharing options...
GeneCash Posted May 1, 2014 Author Share Posted May 1, 2014 Horribly HORRIBLY ugly indeed! I've since discovered a less ugly hack is to install an nVidia GTX 750Ti card... No more yellow MET numbers. Link to comment Share on other sites More sharing options...
Eleven Posted May 8, 2014 Share Posted May 8, 2014 FYI, I just gave this a try and it seems to work!More specifically, my steps were:0) make a backup!$ cp KSP.x86_64 KSP.x86_64.bak1) figure out the byte offset where the particular Intel string shows up:$ cat KSP.x86_64 | xxd | grep "Intel"0f01f00: 454c 0049 6e66 6f6f 0025 692e 2569 2e25 EL.Intel.%i.%i.%0f024f0: 2049 6e74 656c 2039 7878 2028 6275 6767 Intel 9xx (buggThat first line is the one you want (as GeneCash points out), figure out what that is:$ printf "%d" 0x0f01f0015736576then add a few bytes to get exactly into that "Intel" string, in this case about 5 bytes should do it2) replace those bytes (thanks to StackOverflow: http://stackoverflow.com/questions/4783657/cli-write-byte-at-address-hexedit-modify-binary-from-the-command-line)printf 'foo' | dd of=KSP.x86_64 bs=1 seek=15736581 count=3 conv=notrunc3) profit! as GeneCash points out, you should see a shadow behind the kerbal on the Mun at startup.I just downloaded a fresh copy of 0.23.5 and trying this now does not result in the same output. Just making a change of 5 bytes does not work with this different output. Any help? Link to comment Share on other sites More sharing options...
gerner Posted July 27, 2014 Share Posted July 27, 2014 I just downloaded a fresh copy of 0.23.5 and trying this now does not result in the same output. Just making a change of 5 bytes does not work with this different output. Any help?Strange. I just downloaded 0.24.2 did the steps above and it worked. The byte offset is different, but the steps above (with the xxd and the grep for Intel) gave me the right spot. You need to change the instance of Intel that looks like "EL.Intel." above. Link to comment Share on other sites More sharing options...
sal_vager Posted July 27, 2014 Share Posted July 27, 2014 Different offsets is not surprising, as not only has Unity changed since this was first posted, more lines of Squad code have also been added so the offsets have moved.What offsets did you use gerner? Link to comment Share on other sites More sharing options...
Recommended Posts