Alright, so I'm trying to clean up some art assets that just haven't transitioned to Sins very well. Unfortunately, I'm more of a programmer instead of a computer graphics person, so I quite simply do not know about this kind of stuff. The most I've ever done is change the color scheme of some textures in Rome:Total War, and I've done nothing with 3D modeling.
Anyways, here's my issue. Some of the ships, when zoomed out in game, tend to get a lot of annoying white pixels that clearly shouldn't be there. This is somewhat present in the Vanilla units, but with a handful of the new ships it is clearly worse. See the little ones near the center.
With 4x antilasting it is somewhat improved, but I think it is just because it is a greyish white instead of pure white.
Does anyone have any idea what is to be blamed here (bad texture/mesh points), and what would I have to do to fix it?
I'd be interested to learn this as well. It's somewhat of a problem on some of my ships.
It is part of the specular lighting, It is not really bugged, and Vanilla Sins ships suffer from the same problem. The specular map is the Red channel of the ships "-da", or data texture. Which contains the bloom, specular, reflection, and self illumination data for the ship model. It is only in 8 bit grayscale for each of the textures color channels, and the resolution is not that great in that format. Plus DDS uses mip maps so the resolutions get lower the further out you zoom. However it is far better than having a separate specular texture that will eat up your system memory, and 2 gig crash the game. I am a modeler, and i have had no luck with this issue. It is how the the engine renders the ships.
I'm not sure anyone can give you an answer for certain, but I can definitely say it deals with the model itself in addition to textures.
I've come up with two possible causes, though there might be more. Before I really knew what I was doing with modeling and texturing, I used to weld all of the vertices together before exporting. I had a ton of those white artifacts. Now that I'm much more fluent in modeling techniques, when I create a ship from scratch or even when I import a 3rd party model I make sure all elements are detached from each other. In addition, my UV map supports these separated elements because each one has a separate UV group.
Which brings to my second and favored hypothesis: the tangent maps. Once upon a time I used the old 3ds Max importer/exported without realizing that it didn't support a second set of UV coordinates. Thus, no tangent map. Now that I use a new/improved tool, my tangent maps are present (and quite good) with a much lower artifact count.
I think the tangent maps in combination with the specular map are the root of the problem. Ultimately, it all has to do with how the lighting effects are interacting with your model and the smoothing aspect of anti-aliasing. If you turn AA to off, I think you'll notice a significant decrease. Personally, I'm loathe to turn off smoothing, so I deal with it.
I really wish I could be of further help (because it would mean I could get rid of the artifacts that still plague my models), but my best advice is make sure your UV/tangent maps are set up to reflect every separate face on the ship.
Yes I agree with what everyone has said here. Personally I have found that these dots are most prevalent in areas were you have a lot of small meshes. Limiting those will help though it is not always possible for things like cylindrical bends and the like. Some times it is possible to do some of those smaller features with the normal map, so that may help also.
Has anyone tried to turn off each channel of the texture (all but one black) to see if its speicifcally tied to one of them?
Yeah, I've done that. That's how I came to the determination that it's how light interacts with the model and not just a texture or mesh issue. It involves the tangent map, the specular texture channel, and the glossiness setting in the mesh file. It might also include the reflective texture channel. Unfortunately, I've yet to find the perfect combination. Apparently, the developers haven't either.
Thanks Mystic. Even the veteran modders learn something new. I agree now that it is a combination of many things. The Tangents could be the main source of the problem. Especially on a 3rd party model. The modding documentation does not go into very much detail on how to edit them. Vanilla sins ships have the very same problem, but like you said turning off anti aliasing fixes it. I run 1680x1050 anyway so i dont really need AA.
The Iron engine is great because it can run lots of polys even on lower end machines, but the little nags like this is the drawback.
Alright guys, thanks for the thoughts. Unfortunately a lot of this is probably beyond the ability to do, especially as these are not my meshes, but I'll do what I can and see if I get any improvement.
Oh well this is just annoiyng me now. If only I was better at maths, lol.
Okay, something for you guys to try. It seems to be caused by shallow angles and since Mystic said it was specular I had a closer look at the shaders.
this is the ship specular function (in GS_Ship.fx, in pipleline effects dir)
float4 GetSpecularColor(float3 light, float3 normal, float3 view, float4 dataSample){ float cosang = max(dot(reflect(-light, normal), view), 0.00001f); float glossScalar = dataSample.r; float specularScalar = pow(cosang, g_MaterialGlossiness) * glossScalar; return (g_Light0_Specular * specularScalar);}
I want you to mod it to look like this (add the red line):
float4 GetSpecularColor(float3 light, float3 normal, float3 view, float4 dataSample) { float cosang = max(dot(reflect(-light, normal), view), 0.00001f); cosang = min(cosang, 0.95f); // reduce the smallest possible angle by 5 percent - Aractain float glossScalar = dataSample.r; float specularScalar = pow(cosang, g_MaterialGlossiness) * glossScalar; return (g_Light0_Specular * specularScalar); }
On mine it reduces most of the problem but I only did a small test (note that the planets and other things have different shaders so only look at ships). I make backups and modify the one in the main directory for speed but I guess this works in a mod?
EDIT: More explanations
This only stops the situations where this occurs the most btw, I still don't know why its making the edges so white (I would have though the AA would blend them in more not make high brightness pixels).
When the values of the dot product between the light reflection vector and the lookat vector (the direction your camera is) go over 0.95 (max is 1.0) it makes white pixels for some reason (not sure if its always or there is some other modifier).
I thought the white pixels were 'random' on edges but it seems to be only on edges whows normal in facing such a way that it crates a reflection vector pointing very close to the camera and thus the bright pixels, the fact they appear as they do must be a bug with the AA or something.
Anyway I can't find any better ways to fix this atm other than limit those very close angles.
Brilliant find, Aractain! I think this might have come up in one of our IM conversations, but I never got around to actually looking into it. I'll give your fix a go tonight and let everyone know the results.
Edit: Bless you. All white artifacts have been removed from my ships! Tiny surfaces still stick out a bit because they obviously reflect light at a different angle, but all of the bugged graphics have disappeared. You're my new hero!
We will make a mod community of this place yet Outstanding!
There are other shaders that have this function which should also benifit from the change I think. Doing a quick find in files serach they would be:
GS_Asteroid.fxGS_ShipPhasedOut.fxGS_ShipBuilding.fxGS_Ship.fxGS_Planet.fx
Just checked them all and its just the same function so the same 'fix' should work on them all.
I've seen improvement with my ships as well. Here's an after picture.
Did anyone else try this?
Yes, I just tried GS_Ship.fx fix with a new model and it did work well for me. I'll need to look at the other files mentioned too. Nice find!
Curious,
does this fix help to reduce lag in the game or is this just cosmetic?
Should be purely cosmetic.
This would be cosmetic only, from what I understand. It does make a noticeable improvement so for that reason alone its well worth doing. Great work "Aractain"
For what mod?? Noticed Imperial Carrack there.
It works for me also thanks a million.
Hey guys.
You seem to know alot of info about how the textures are mapped to the ships etc. My interest is in the light maps. Which files are these? I have Irfanview dds viewer and I can see all the textures in vanilla, plus the mod Sacrifice of Angles. I wanted to be able to change the glow of the ships from blue to purple or red or whatever. What I think are the light map textures though are all in shades of greenish / yellow. I don't know how bringing them into photoshop and changing the hue will affect them.
Can you suggest a good course of action?
Do the ships themselves have lights attached to them? Or is it all done through the dds textures?
Blinking lights are added just like weapon points using a modeling program. Other than that they are part of the texture.
http://soase.weebly.com/texturing.html
I assume you're looking at data (_da) textures. Those contain various data in red, green and blue channels + alpha as follows:
Green: illumination, more green, more illuminated that part of the texture is
Blue: reflection, more blue means more reflection of the environment
Red: specular, controls the amount of specular reflection of the model
Alpha: bloom, controls the strength of the bloom effect (glow)
So, if you want to change the illuminated parts of the ships to whatever color, you should actually take a look at the color texture (_cl) and change it there. The data texture just controls which parts of the model are illuminated.
Ah that explains it nicely thanks! I will do exactly that and see what the results are. I was looking at the _da textures. I did not know what the different naming conventions are for the texture files.
There are many great features available to you once you register, including:
Sign in or Create Account