Jump to content

Strange shader behavior.


Recommended Posts

Decided to rework SSP Mk2 model a bit so it could fit both 1.25m and 2.5m designs. Recompiled, re-added animations, all physics, etc., set back KSP/Specular shader and... got THIS:

Os2dhX9.png

What can cause such... unexpected behavior? I'm still at Unity 4.2.2 with old part tools for this particular task. 

Here's how it looked before.

qEytLUw.jpg

Edited by Dr. Jet
Link to comment
Share on other sites

 

Did you make any changes to the texture? I've sometimes seen parts of the texture turn white if the alpha channel has pure black in those locations. It's inconsistent though. I usually avoid using 0 (black) and 255 (white) in my alpha channel to avoid that, and only use values in the range of 1-254. I'm not sure if that's what's happening here or not.

 

Link to comment
Share on other sites

which shader did you export this with? There seem to be two sets of Unity4 shaders with the new partTools, one in PartTools Legacy, this pack contains a KSP Standard Shader in the Shaders/PBR folder. another set in SquadCore from the assetbundles.unitypackage. The set in squadcore seem to be somewhat broken.. or maybe a special set only for KSPedia content. 

Edited by nli2work
Link to comment
Share on other sites

maybe the case. but so far it seems like assetbundles are for plugins only, and maybe things like FX prefabs, Shaders. things that gets access through code instead of config files. I can get a partbundle.ksp to load, but part compiler seems to only process configs, MUs and textures like it always did before.

Edited by nli2work
Link to comment
Share on other sites

No-no-no. I use OLD PartTools with OLD Unity 4.2.2. I didn't even try to put PartTools 1.1 there.

What is strange, all new experimntal parts I made last month do have Specular or Translucent/Specular shader and don't have such problem. It seems to appear only for old parts I haven't touched since before my Unity crashed and was reinstalled twice, losing cache and all assets metas. 

There was no alpha channel in this particular texture (and it still is not, as I didn't edit it). "Specular" was chosen to simulate metal glossiness and it always worked as expected until now. 

Hm-m-m... Can it be somehow damaged .mat file? I didn't create a new one - just replaced shader in old one.

Edited by Dr. Jet
Link to comment
Share on other sites

damaged mat file maybe the case... any errors or warnings in Unity Console or in KSP debug when this part loads in Editor? from the screencap it almost look like Z fighting between the diffuse and specular passes.

Link to comment
Share on other sites

Hm-m-m... deleting and recreating .mat then using PartTools to export actually produced some debug output.

1) Shader wants texture coordinates, but the mesh doesn't have them

2) Shader wants Tangents but the mesh doesnt have any

How so? UW map is mapped right and texture displays itself right.... in Unity. And what is "tangents" BTW? 

Link to comment
Share on other sites

weird... are there multiple UV sets(channels) on the mesh? I thought KSP shaders always used the first UV set for everything. Never seen anything like this before. Missing UVs would produce the kind of artifact you're seeing though, strange that it's only on the specular pass and not the diffuse. This is in KSP 1.0.5 ya?

Tangent is direction perpendicular to the Normal. every vertex has one. Have you tried setting Tangents to "Calculate" or "Import", or vice verse, on the imported asset's Model Panel?

Link to comment
Share on other sites

You won't believe... Bug persisted even after exporting as ssp2.fbx and re-doing Unity stuff through it...  (I hoped it would force Unity to recalculate normals and tangents... whatever they are... but it didn't) BUT!  Nasty bug disappeared after "Save as" ssp2b.blender... 

It's some weird Unity voodoo black magic that just hated the old file name... Cannot think of any REASONABLE explanation.

Edited by Dr. Jet
Link to comment
Share on other sites

As I said above, re-importing or format change didn't help, bug disappeared after re-saving blender file with different name. It surely was some black magic within Unity cache - maybe undead metadata that supposed to be deleted long ago or something like that.

zKniSKc.jpg

Link to comment
Share on other sites

1 hour ago, Dr. Jet said:

You won't believe... Bug persisted even after exporting as ssp2.fbx and re-doing Unity stuff through it...  (I hoped it would force Unity to recalculate normals and tangents... whatever they are... but it didn't) BUT!  Nasty bug disappeared after "Save as" ssp2b.blender... 

It's some weird Unity voodoo black magic that just hated the old file name... Cannot think of any REASONABLE explanation.

Source of the problem might be in the blender file then... jumbling the UVs on FBX export. I've encountered the similar with Max where UVs get randomized per face, but thought that was a Max issue. Apparently not.

Edited by nli2work
Link to comment
Share on other sites

And again - NO. Blender file was not changed. It's FILENAME was. Both .blender and .fbx with old name did not work. After name change - everything miraculously self-repaired. It's voodoo. :P

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...