Header
HomeRegisterSearchFAQMemberlistUsergroupsLog in
Demon now in-game (PU)

 
Reply to topic    Wing Commander Nexus Forum Index » Fan Projects & Modeling View previous topic
View next topic
Demon now in-game (PU)
Author Message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Demon now in-game (PU) Reply with quote
Done and committed.

Unless you download PU for the first time, you'll need to delete the demon's cache entries from the .pu/generatedbsp folder and .pu/serialized/xml subfolders, for the mesh and csv data to update.



There's weird specularities and whatnot, but it's not the texture's fault, I don't think. Well, it is and it isn't. The texture is alright, but it suffers great losses when compressed to DDS, and those losses are amplified by the shader, because of this terrible extraction of shininess from specularity. These problems will go away with the next generation shaders. And I couldn't make the gray paint look like paint and NOT metal, again, because I can't specify the shininess (nor fresnel) to the shader. Next gen will be better.

Also, the exhausts are matte white but they look black here, and that's because my ambient light is baked into the glow texture; at an arbitrary low level 18%; but in this system (Junction) the background is very bright, so one would expect the exhausts to look a lot brighter, even though they are in shadow. But to have ambient light modulation we'd need a separate, ambient occlusion shaded version of the diffuse texture, or else to give up ambient occlusion, which looks like ogl crap, or else to burn the ambient occlusion onto the diffuse, which makes ships look smokey... All alternatives are worse. Well, in the next gen shaders we'll pass the ambient occlusion to the shader via the alpha channel of the glow texture, and that will allow us to have ambient occlusion AND modulation of the ambient light contribution.











Let there be credit where credit's due: The original mesh was donated to WCU by Brad Mick. I worked on it a bit: Removed invisible polies, welded some parts, and re-unwrapped it. My original texturing was while still working for WCU, and was done in Gimp. The new texturing is mostly a re-mix of the old, and was done using Blender node networks.

This Demon release heralds the start of PU's remodelathon and retexturathon. All ships and bases will be redone. Next are the Tarsus, Orion and Galaxy, which Nate and Dual Joe are working on. I think I'll split my time between bases and ships. High in my priority list, though not necessarily in any particular order: Centurion, Talon, Drayman, mining base, refinery, Dralthi, KF-100 Dralthi, CF-117 Rapier, Rapier II, Paradigm, Diligent/Errant...

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Mon Apr 28, 2008 12:43 pm View user's profile Send private message
Maverick
Big Boss


Joined: 21 Jun 2007
Posts: 103
Location: CA

Post Reply with quote
An improvement on the previous version, definitely. The most noticeable improvement IMO being the cockpit.

Were those "paint scrapes" on the wings in the previous version? I don't remember them. Or maybe I'm just seeing something weird in the angle/lighting or something.
Tue Apr 29, 2008 12:04 am View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
You mean in the second picture mostly? Those are shininess artifacts. They are visible at certain angles. That's the kind of stuff that will be gone with the next generation shaders. I'm just waiting for Klauss to put in one new variable in the xmesh format: TexturePackingVersion. Then I can develop the new shaders. That's all it takes, but it's taking forever to happen.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Tue Apr 29, 2008 1:23 am View user's profile Send private message
Maverick
Big Boss


Joined: 21 Jun 2007
Posts: 103
Location: CA

Post Reply with quote
Yeah, that's exactly what I was seeing. At first I thought it was intentional. Are the dark grey areas supposed to be dark blue? Or did you change that? I seem to remember one version having blue trim.

I really like the first shot, the back of the ship looks really cool.
Tue Apr 29, 2008 3:48 am View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
I don't remember any version being anything but grey, but the lighting can play many tricks with your eyes. In the system where I took these shots, Junction, the background is bright grey, and the star is orange. Our brains are used to white light from the sun, so they compensate to make the light white, which pushes grey things over to the blue side. Just optical illusions and bad lighting.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Tue Apr 29, 2008 10:59 am View user's profile Send private message
Maverick
Big Boss


Joined: 21 Jun 2007
Posts: 103
Location: CA

Post Reply with quote
Oh, I see. I'm just crazy. Razz
Tue Apr 29, 2008 5:17 pm View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
Well, maybe not; I now remember that once I did have the gray paint on the sides being bluish.
Is that what you were referring to? Of course it is! Sorry, I'd forgotten.
It's all gray, now, for canonical reasons (I did like the blue paint, I remember).

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Tue Apr 29, 2008 5:52 pm View user's profile Send private message
gevatter Lars
Cadet


Joined: 09 Feb 2008
Posts: 28

Post Reply with quote
This one looks very close to the original and I like that. Only thing is that it looks like a brand new ship. It seams to be very shine. The effect looks good on the cockpit but I would lower it for the rest of the hull.
On the other hand thats just my personal opinion. I just like the "matt" look like I did for the Excalibure textures. (I only did the specular mapping and put some grain on the original texture)


_________________
Yes
Sun May 04, 2008 8:43 am View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
The problem representing metal is that, other than for polished mirrors and chrome plating, most metals have very high specularity but very low shininess. Glass and glossy paints, on the other hand, --and, more generally, all glossy dielectrics--, have a different kind of reflectivity: High shininess and low, gray-scale specularity... PLUS Fresnel...

Is this a render or a screenshot from a game? My question is, are you making this model for a game or for artistic renders?

For artistic renders you should be able to define your materials for the raytracer.
I can't remember now which modeling package you use. In Blender, shininess is called "hardness". In some other packages it's called "gloss".

Best way to represent metal is with very dark diffuse color; almost black. Most metals have NO diffuse reflectivity whatsoever. Pure specular.
But you need to bring the shininess/hardness/gloss way, way down, to like 20 or 30.

Paints come of many types, but the three most common are 1) sprayed matte, 2) normal brushed or baked paint, and 3) high gloss.
Matte paints are usually used as bases for high gloss finishes. Otherwise they are best represented with a color in diffuse, and black in specular.
Regular brushed paints have specular color that has the same hue and saturation as diffuse, while varying in the diffuse/specular balance --baked enamels favoring the specular balance. A common mistake game modelers make is to create the specular texture by desaturating the diffuse texture. This is really bad because only high gloss paints and plastics actually have desaturated specularity; which is why the ships of many mods out there end up looking like plastic toys. Glossy paints have low specularity but high definition (high shininess). But if you create the specular texture by desaturating the diffuse, what happens is that bright colors acquire high gray-scale specularity, which no paint has; and only plastics have. If you look at reflections of the environment on a glossy, blue plastic chair, you'll see red and green objects reflecting as red and green, NOT blue. This is definitely what defines "plastic look".
Common paints have a somewhat higher shininess or gloss than most metal surfaces, maybe 50 to 100.

High gloss paints, such as car paints, work differently: They are two-layered, with a rough, diffuse (and/or low shininess specular) base underneath, (but usually purely diffuse), fully colored; and a glossy lacquer on top, which being a dielectric, has "white" (gray-scale) reflectivity (and fresnel). Best way to represent them is with their color coming from the diffuse texture, and having a slight amount of desaturated specularity... --say about 0.15, 0.15, 0.15 dark grey in specular. Or up to 0.2, 0.2, 0.2. BUT, the shininess should be very high, like 200 or 250, same as for glass. Otherwise, again, it will look like plastic rather than high gloss paint.
Ideally, you also need Fresnel, both for high gloss paint and glass.

And what's Fresnel?
If you stand in front of a store window, you see yourself reflected at about 10% strength. If you look to the sides at an angle, the reflectivity of glass stays pretty much constant at about 10% reflectivity (90% transparency) up to about 40 degrees. As you look at shallower angles, reflectivity starts to increase slowly towards 45 and 50 degrees, then it rises faster and faster, until, at 90 degrees it reflects 100% (and transflects nothing). This is Fresnel reflectivity; a property of dielectrics (non-metals), and the shape of the curve depends on the dielectric constant of the material.
For the Vegastrike engine I managed to squeeze Fresnel into the fragment shader, and it makes a huge difference when representing glass. Notice how reflectiviy increases as the angle gets shallower at the top:



Our next generation shaders will allow specifying that a material is dielectric through the textures, so I will be able to use Fresnel for high gloss paints and not just glass. The way I'm handling glass right now is by making it a separate mesh and specifying low alpha diffuse color in the mesh file... a hack...

But to get back to metals and shininess, IF you want the Excalibur to have low shininess metal in some game, that gets a little bit more complicated, because shininess, in OpenGL, is something that is only applied when computing spotlight reflections --the famous Phong shading formula, but not to environment mapping...
So the problem is that environment mapping reflections stay sharp, even when you specify ultra-low shininess for your material. So it looks like your ship is wrapped in shrink-wrap, glossy plastic or latex.
The only way to get environment mapping reflections to reflect the low shininess of a material is to blur it inversely proportionally to shininess. But how can you blur the environment map?
It's actually very easy; just a matter of using the texture2DLOD() GLSL function, instead of the traditional texture2D(), and to specify an LOD level that increases roughly with the square of the inverse of the material shininess. (Actually, the correct formula would be power 1.7, but square is cheaper to compute for the gpu.) What texture2DLOD does is to bias the trilinear filtering towards lesser mipmaps (lower resolution), which effectively works like a blur.

Very nice model, BTW; and excellent texturing.

EDIT:
A popular mistake out there is to confuse low shininess specularity with diffuse reflectivity.
Specular and diffuse reflectivity are totally different animals. Low shininess specularity looks completely different from diffuse reflectivity. Consider this:
Say there's a cylinder in front of you, and a light source straight to the right of the cylinder.
If the cylinder's material is a purely diffuse material (e.g. paper), the brightest band of illumination on it will be all the way to the right: the area whose normal points towards the light.
If the material of the cylinder is purely specular, though, (e.g. metals), regardless of its shininess or gloss, the brightest band will look half way (or 70% of the way, rather) to the right, at the point where the normal of the surface lines up with the median between the eye and light vectors. If the metal is highly polished, the band will be sharp. If the metal is very un-polished, the band of light will look very blurred, but the position of the brightest point in the band will not change; --it is a "constant" for specular reflectivity, regardless of gloss or lack thereof.
So, diffuse and specular are totally different animals.
Physically speaking, specular reflections occur when light bounces once off a surface before reaching your eye. Diffuse reflectivity occurs when light bounces multiple times before coming back out, so that the direction at which it comes back out is totally random. This is certainly the case with papers and many fabrics, as incoming photons are typically deflected by one microscopic strand of cellulose after another, and another, until it at last it breaks free, but with a totally random direction.
For some reason, however, most modelers and texturers pay more attention to the diffuse texture than they do to the specular; when in all truth, diffuse reflectivity is more the exception than the norm. Is it any wonder so many ships in so many mods out there look like they are made of paper and plastic?
There's really no alternative to high specularity and low shininess to make metal look like real metal; and for games there's no alternative but to use LOD bias based on shininess for environmental reflections.

EDIT2:
Here's my most recent shader version, if it helps:
http://vegastrike.sourceforge.net/forums/viewtopic.php?p=97244#97244

EDIT3:
Don't take my Demon as a flagship for well represented materials. Making metals black in diffuse (purely specular) is a conclusion I arrived at in the last few days. The Demon's "metal" is darker in diffuse than it is in specular; but not black in diffuse, as it should be. From now on I will improve my texturing jobs a lot; you'll see...

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Sun May 04, 2008 2:32 pm View user's profile Send private message
gevatter Lars
Cadet


Joined: 09 Feb 2008
Posts: 28

Post Reply with quote
Well that shot is a screenshot from our mod.

Most of the stuff you posted I know but this is new to me
Quote:
But to get back to metals and shininess, IF you want the Excalibur to have low shininess metal in some game, that gets a little bit more complicated, because shininess, in OpenGL, is something that is only applied when computing spotlight reflections --the famous Phong shading formula, but not to environment mapping...
So the problem is that environment mapping reflections stay sharp, even when you specify ultra-low shininess for your material. So it looks like your ship is wrapped in shrink-wrap, glossy plastic or latex.
The only way to get environment mapping reflections to reflect the low shininess of a material is to blur it inversely proportionally to shininess. But how can you blur the environment map?
It's actually very easy; just a matter of using the texture2DLOD() GLSL function, instead of the traditional texture2D(), and to specify an LOD level that increases roughly with the square of the inverse of the material shininess. (Actually, the correct formula would be power 1.7, but square is cheaper to compute for the gpu.) What texture2DLOD does is to bias the trilinear filtering towards lesser mipmaps (lower resolution), which effectively works like a blur.


I am no coder so I don't quite get everything. I just take the original textures, make some scratches and add a specmap to it. I haven't added a envo-map till now because of the "to clear" effect you discribed.
If I understand it right what you are saying I create a blured texture of the specmap and it to the existing maps and that it?

_________________
Yes
Sun May 04, 2008 9:07 pm View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
No, the environment map is usually either a cube-map or spheremap, representing the look of space around you (stars, nebulas). You don't apply it to the ship, but rather it is applied to ships at run-time. But instead of using the ship's UV coords (texture coords) from the mesh, environment mapping picks the spot in the environment texture by reflecting your eye vector off the surface of the ship. This is all done in the fragment shader.

The function usually used to read a texture is texture2D() (in GLSL); but texture2D picks the mipmap level for you behind the scenes. texture2DLOD() allows you to specify the mipmap level you want. The higher, the more blurred the reflection will appear. So, if you have a material with very low shininess, your shader formula would call texture2DLOD with a third argument value of like 6 or 7 or 8, and the environment map reflections appear extremely blurred, as they should. Just pass my shader to your coders. If they have any questions, all they have to do is ask.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Sun May 04, 2008 11:17 pm View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
Let me try to explain it again, hopefully more clearly this time:

Environment mapping is what allows models to look reflective in a game. You got 6-sided, cube-map texture; or a spheremap, representing the sky; otherwise known as the "sky box".
The fragment shader computes a "reflection vector", essentially, the eye vector mirrored across the surface normal at the point in the mesh it's currently processing. This reflection vector is used to compute a set of uv coordinates in the spheremap or cubemap. The shader then reads that texel in the environment, multiplies its color by the specular color of the ship at that point, and adds the result to the total light contribution. (There are other light contributions, such as phong specular, diffuse, ambient and emissive.)
If your material was black in diffuse and white in specular, then doing this effectively reflects the sky box texture, making your material look like a mirror.

Now, the problem is that even if a material were white in specular, it might not be mirror-like. Take the case of aluminum, for example. Aluminum is an extremely reflective material, but except for in telescope mirrors and aluminum foil, most aluminum we encounter is actually dull. It is NOT "less reflective", but it is less polished, more rough. This is bumpiness in the surface, essentially, and causes reflections off it to be blurred. Often people confuse this with "diffuse" reflectivity; but it is not; it is still specular, but blurred.

To represent that, in environment mapping, we need to blur the environment map that reflects off the ship (NOT the specular texture of the ship!; the environment). And the way to achieve that blurring is to use the texture2DLOD() function when reading the environment map, in the shader. Then you can have your cockpit look sharp, and the rest of the ship look rough and less "shiny", while still being highly specular. To do so, you need to pass an argument to texture2DLOD() that's like 7 - log2( shininess ); you'll see the right formula in the shader I linked you to. Sorry, the square and power 1.7 was something else: for modulating the intensity of light spots by shininess; I got mixed up.

Now, the question is, how do you pass the shininess to the shader. Well, that's a separate question. Our current hack in the Vegastrike engine is to compute shininess from specular color. It is BAD. Don't do that. Our plans now are to pass the shininess in the alpha channel of the specular texture. If you did so too, your cockpit would be dark gray in specular, but maxed out in spec alpha; while the body of the ship would be light gray in specular, but with a low number in the alpha channel.

What's your mod, again? Saga? Does your engine have shaders? (I should have asked this first, I suppose...) And if so, do you use GLSL for the shader language?

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Mon May 05, 2008 4:12 am View user's profile Send private message
gevatter Lars
Cadet


Joined: 09 Feb 2008
Posts: 28

Post Reply with quote
Yes its Saga.
Shaders aren't implemented yet...as far as I know.
We also use the Alpha channel of the specmap for createing the envo reflection but its to clear currently so that everything looks a little bit like glass.

Ah well I think things will change anyway when they get shaders done and running...at least I hope so ^_^

_________________
Yes
Mon May 05, 2008 8:01 pm View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
Well, as soon as they get them running, let me know at once; I can save them months of wasted time down wrong paths and blind alleys. In the latest shaders I've implemented Fresnel, blurring of the environment mapping as a function of material shininess, dimming of specular light spots as a function of shininess (the larger the spots, the dimmer they should be), I've invented my own optimization for bumpmap self-shadowing, and I got soft penumbras to work, also using a highly optimized formula I came up with. All in one shader, single-pass, up to two dynamic lights.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Mon May 05, 2008 9:06 pm View user's profile Send private message
gevatter Lars
Cadet


Joined: 09 Feb 2008
Posts: 28

Post Reply with quote
I am not sure who is working on the shader stuff. You might want to go and ask the team yourself.
You can find them in the Hard light production forums.
http://www.hard-light.net/forums/index.php/board,50.0.html

Just post that you want to help with shaders or something like that.

_________________
Yes
Mon May 05, 2008 11:57 pm View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
I don't "want" to help; much less join a board to do it; and my hands are full with my mod (PU), but if they need/want help, I'll be available. Besides, I can't help them with putting shaders into the engine --I know nothing about it--; but once they got a basic set of shaders working, I can help them improve the shaders themselves.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Tue May 06, 2008 3:38 pm View user's profile Send private message
gevatter Lars
Cadet


Joined: 09 Feb 2008
Posts: 28

Post Reply with quote
Ah ok a little missunderstanding on my side.
I will come back if somethings comes up. Since I am not part of the development progress on the codeing part I don't have any deeper knowledge on how far they are.
Most likely the are currentlly bughunting because we recently found a lot while testing some stuff.
Ah well time will tell when or if it gets done.

_________________
Yes
Tue May 06, 2008 9:20 pm View user's profile Send private message
Monkhouse
Site Admin


Joined: 21 Jun 2007
Posts: 123

Post Reply with quote
No problem. Please convey my regards to the Saga dev team, and my encouragement that they give shaders the highest priority. There's simply no way to make metal look like real metal in standard OpenGL. Shaders are a must, if you want your models to look real on the screen, and not like they are made of paper and plastic. There's simply nothing that compares to the adoption of shaders in a 3D engine's evolution. It's an instant, 100X boost to graphics quality.

_________________
PU (Privateer: Parallel Universe's Home)
WCpedia --The Wing Commander Encyclopedia
Wed May 07, 2008 1:42 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Wing Commander Nexus Forum Index » Fan Projects & Modeling All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.