Page 13 of 15

Posted: Wed Mar 03, 2010 3:58 pm
by Scarecrow
Ooooookaaaaay...

So, now I'm in full shader mode. That certainly helps, though it's still refusing to load the specular map.

I have this code:

Code: Select all

materials = 
			{
			"seraphim.png" = {shininess = 100;
					normal_map = "seraphim_n.png";
					specular_map = "seraphim_s.png";
					};
			};
and it only loads the diffuse and normal maps.

Crow

Posted: Wed Mar 03, 2010 4:04 pm
by Scarecrow
hmmmm...

I added an emission map to that list and it loaded in the diffuse, normal and specular. It's as if it loads in all but the last map, nomatter what that map is.

Crow

Posted: Wed Mar 03, 2010 4:17 pm
by Scarecrow
Oops. I had the emission map set to load the specular map.

It appears to be working now but It's so small in the title screen, I need to run debug and look at it in-game I think to get a good look at it.

Crow

Posted: Wed Mar 03, 2010 6:06 pm
by Commander McLane
Don't think that it's working. Apart from the already squashed bugs there is another fatal one:

subentities is an array, not a dictionary. The elements within an array are seperated by commas, but it makes no sense to add another comma after the last entry. Therefore

Code: Select all

			...
			"*FLASHER* -25.0 0.0 -20.00 310.0 0.5 0.5 8",
			"*FLASHER* -13.5 -9.00 -25.0 310.0 0.5 0.5 8",
		);
breaks your plist (the log should complain about this, and probably has). It has to be

Code: Select all

			...
			"*FLASHER* -25.0 0.0 -20.00 310.0 0.5 0.5 8",
			"*FLASHER* -13.5 -9.00 -25.0 310.0 0.5 0.5 8"
		);

Posted: Wed Mar 03, 2010 6:18 pm
by Eric Walch
And probably will firing forwards (most used direction) also be problematic

Code: Select all

      weapon_position_aft = "0.0 0.0 -27.5"; 
      weapon_position_forward = "2.1 -5.5 23.5.33"; 
      weapon_position_port = "-12.5 0.0 0.0"; 
      weapon_position_starboard = "12.5 0.0 0.0"; 
One decimal point to much

Posted: Wed Mar 03, 2010 8:18 pm
by Scarecrow
So let me see, Commander McLane, you are saying that I need to remove the comma from end of the last 'FLASHER' line, yes?
And Eric, you are saying that I need to remove one of the decimal points? I assume you mean this one: 23.5.33

<edit>Yes, checking the position in Maya, it's the .33 that shouldn't be there.

I didn't notice any errors relating to these in the logs whilst I was studying them today. Thanks for pointing them out.

I ran it again earlier and used debug to get a look at it. I tried spawning but nothing seemed to happen so I targeted the Police Viper that follows you out of the station and used that instead. According to the log, the textures are loading but I'm really not sure they're doing anything. If they are, the effect is VERY subtle as the surface looks no different from the rest of the sub objects that don't have the material applied. The emission_map is definately working though, I can see it clearly illuminating the lights in the cockpit and the engine exhaust.

I'll try again in the morning. I'll put in those bug fixes and I'll try making the diffuse texture a flat mid-grey so that I can see clearly if the normal map is actually having an effect.

Cheers,

Crow

Posted: Thu Mar 04, 2010 9:48 am
by Scarecrow
Goooooood morning Ooliters!

Okay, then. Today's conundrum:

I made the corrections to the code that the Commander and Eric spotted. I imagine that's probably fixed the position of the laser on the ship if nothing else.

My primary concern this morning is the specular map, specular and shininess settings.

I could quite clearly see the diffuse and emission maps working. I couldn't tell if the Normal map was working, so this morning I made the diffuse map a mid-grey. When I ran the game, I could clearly see the normal map lines on the hull, so I know now that the normal map is working.

The specular, on the other hand doesn't seem to be doing anything.

I made the Specular map a black and white chequer pattern so that I could see it obviously. It clearly isn't there. Also, no matter what I set the shininess and specular settings to it makes no difference. I've tried making them both zero and I've tried ramping them both up to full and all I get is a flat, mid-grey.
I read that in some more recent versions of Oolite, if a specular map is used, then the specular and shininess settings would default to full, so I removed the Specular map and it made no difference.

According to the log, it's not actually loading the Specular map which goes back to a problem I was having yesterday. I have double-checked and the texture is definately named correctly and is in the correct place and it is a PNG file. So it's not that it can't find it.

I'm stuck (again!).

The code I currently have is thus:

Code: Select all

materials = 
			{
			"seraphim.png" = {
					shininess = 64;
					specular = (0.5, 0.5, 0.5, 1.0);
					normal_map = "seraphim_n.png";
					specular_map = "seraphim_s.png";
					emission_map = "seraphim_e.png";
					};
			};
Cheers,

Crow

Posted: Thu Mar 04, 2010 2:45 pm
by Griff
Just noticed this on the wiki page
Materials in Oolite wrote:
shininess value is scaled by the alpha channel of the specular_map
It looks like the alpha channel is important, maybe try flood filling it with white to see if that has an effect?

Posted: Thu Mar 04, 2010 3:07 pm
by Eric Walch
Griff wrote:
Just noticed this on the wiki page
Materials in Oolite wrote:
shininess value is scaled by the alpha channel of the specular_map
It looks like the alpha channel is important, maybe try flood filling it with white to see if that has an effect?
Yes, you need to have both. The normal drawing for the specular colours and the alpha channel for the intensity.

Posted: Thu Mar 04, 2010 3:20 pm
by Griff
i just had a quick skim through the oolite default shader, oolite-default-shader.fragment Lines 310-317

Code: Select all

#if OOSTD_SPECULAR_MAP
	vec4 specularMapColor = texture2D(uSpecularMap, texCoord);
	float specularExponentLevel = pow(specularMapColor.a, 2.0) + 0.001;
	specularMapColor.a = 1.0;
	#define APPLY_MAPPED_EXPONENT exponent = (exponent - 1.0) * specularExponentLevel + 1.0
#else
	#define APPLY_MAPPED_EXPONENT exponent += 0.001
#endif
it looks like the alpha channel is being used for the specular exponent (the highlight size or the 'glossyness' of the surface), i'm just wondering if it might be better to make it control specular intensity instead, or change the 'shininess' name to 'glossyness' or something like that? shininess sounds more like a specular intensity setting i think ? <- i'll put a question mark there because i'm not entirely sure myself!

Crow, maybe try setting your specular colour to something brighter, eg
specular = (1.0, 1.0, 1.0, 1.0);
and see if it shows up then?

Posted: Thu Mar 04, 2010 3:56 pm
by Scarecrow
iiiiinteresting....

but sadly, no!

PNG's don't have an alpha channel as such. They just sort of remember when something is transparent. So my spec map is at 100% opacity by default. I tried a chequered pattern with red squares and transparent squares but it made no difference.

The log is saying (and this does seem to be the problem) that it's still not loading the Specular map at all. Or at least, it's listing the diffuse, normal and emission maps but not the specular.

Either there's something with my spec map that it doesn't like, or something is wrong with my code.

Is it concievable that this is a bug with Oolite's material code that hasn't been spotted before?

Crow

Posted: Thu Mar 04, 2010 4:05 pm
by Scarecrow
WAIT!

I had shininess and spec set to zero. I just ramped them up and it's now loading the spec map. Let me just have a play with it in game and I'll report back!

Crow

Posted: Thu Mar 04, 2010 4:26 pm
by Griff
hmm, i just used your materials example to make a cobraIII, no matter what specular color i used or shininess settings, it always looked like this for me
Image

Posted: Thu Mar 04, 2010 4:59 pm
by Scarecrow
That's what I'm finding. I'm running out of time for today, but the testing I've done so far has proven that the actual colour or tone on the Specular map is irrelevant. The more solid the alpha channel, the darker grey the specular.

Crow

Posted: Thu Mar 04, 2010 5:04 pm
by Scarecrow
You can see here. The spots are solid white, the squares are solid black and they look exactly the same.

The bright areas are transparent on the spec map.

Crow

Image