Sunday, November 24, 2013

Vehicle, end of week three.

I managed to catch a weird bug somehow, so I was unable to work in the past several days. Luckily, the project is pretty much done.

So, this week I was adding some finishing touches to the normal map, as well as working further on the diffuse and reflection maps. They are almost done, maybe a day or two of work left.
The environment, I assume, is also done. I might tweak some stuff, but I think it already looks quite good.
Originally, I planned to make a hangar of some sort. But after talking to people, I realized that with our current texture budget it's really hard to make it look good. In the end, it'll just make the spaceship look too small as well, so it's just a waste of time. Vehicle is the main priority here, and I've already spent too much time on it.
So I went with a simple sky sphere with starry texture and a bit of nebula haze. The focal point of the sky, however, is a planet with a sun rising from behind it. I tried making the planet a part of the sky texture, but there was just too much distortion. So I had to resolve to making the planet a separate plane.
If I was using UDK, I'd make the sky sphere in a completely different way. For instance, there is a way to adjust the sun position in such a way that it's always in the same position relative to the player. In case of 3ds Max, I have to deal with perspective.
After making the background, I discovered another annoying issue with Xoliul shader. Apparently, it fills empty alpha areas with an opaque grey colour. That is, there is no punch through - the only object that is displayed behind the alpha planes, is the object itself.
I managed to find a tweak for Xoliul code that switches the punch through on, but that also disabled two-sidedness. Bummer.
So I ended up adjusting some settings in the Xoliul code myself. If anyone has the same problem as me, (as in, alpha not being transparent or two-sided), open the .fx file with Notepad, scroll all the way down, and replace the "Two Sided" technique with the following:

technique TwoSided 

    pass  P0
        ZEnable = true;
        ZWriteEnable = true;
        CullMode = none; //clockwise culling
        AlphaBlendEnable = false; //alphablend allows for full range, smooth opacity masking
        AlphaTestEnable = false;
        AlphaFunc = Greater;
        AlphaRef = 128.f;
        ShadeMode = Gouraud; //required for smooth vertex colors
        VertexShader = compile vs_2_0 vs_main( );
        PixelShader = compile ps_3_0 ps_main( );
    pass P1
        ZEnable = true;
        ZWriteEnable = true;
        CullMode = cw; //clockwise culling
        AlphaBlendEnable = true; //alphablend allows for full range, smooth opacity masking
        AlphaTestEnable = true;
        AlphaFunc = Greater;
        AlphaRef = 128.f;
        SrcBlend = One; // additive blening of fresnel stuff
        DestBlend = One;
        VertexShader = compile vs_3_0 vs_main( );
        PixelShader = compile ps_3_0 ps_fresnel( );


Before and after:
That stretched planet, by the way, is the reason I had to place it on a separate piece of geometry.

The other thing was trying to sort out the cubemap. The layout specified in the brief was not the actual layout used by the shader. So I had to literally mark individual cubemap faces and swap them around if they were in the wrong place in the viewport. But in the end it works out pretty well.
Still, there is a quite a bit of work I have to do on the reflection map in order to make it look decent. But I'm pretty sure that the project will be complete in a couple of days.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.