Misceallenous map
I wrote a lengthy post about player-custom colors, so I won't enter into details here. You can still see the thread here.
The idea is to use a "misceallenous" map ( for lack of a better name ) that encodes, in the red channel, pixels that are affected by the primary custom color; in the green channel, pixels affected by the secondary custom color; and finally, in the blue channel, an intensity saying how much dirt there can be at most on this pixel.
The player will be able in-game to select ( when he re-paints his ship, or acquires a brand new one ) a primary and secondary custom color. The dirt amount will be based on how old the ship is, how often it entered into dusty environments/atmospheres, etc.. The dirt map is not meant to replace aging, which can still be done with a separate set of texture maps.
Everything gets combined in the pixel shader.
Ambient occlusion
Last week, I added support for ambient occlusion. Usually, AO must be set up via render-to-texture in 3ds Max ( or equivalent software ), but it's still tricky to set the good parameters and to share the textures. So I've added AO to ASEToBin.
The algorithm works by using an UV map coordinate set ( same than for skinning / unique UV mapping ), and for each triangle, rasterize the triangle in the AO map. For each pixel, a certain amount of rays are cast on the hemisphere about the triangle surface. The amount of AO is based on the percentage of rays that hit back the object, versus the amount of rays that do not hit anything. So areas that are very occluded get a lower AO value, resulting in a darker pixel; while areas that are on a roof, with nothing above / near, get a white AO pixel.
This AO map is then multiplying with the diffuse and specular maps, giving a much more realistic feeling ( although subtle ) to the objects.
In the last ASEToBin, AO only works if your object uses unique UV mapping. If that isn't the case ( for example you are using tiling / generic textures ), it will not work.
New ASEToBin version
This new version can be downloaded here:
ASEToBin 0.6 ( 12.4 MB )
Main changes:
- fixed the stretching of the viewport when resizing the window
- fixed crashes when trying to load/export models, when a model is already loaded
- added an option to fix T-Junctions ( experimental )
- added an option to generate ambient-occlusion maps. There are 5 parameters that can be changed: the number of rays cast per pixel ( the higher, the better quality ) ; the strength of the AO ( the higher, the stronger the AO map will be ) ; the resolution of the AO map ( the higher, the better quality ) ; and the minimum and maximum distance at which rays should be cast ( default values are usually fine for small models, increase them for larger ones ).
- gave default textures when some of the material chunks were used in shaders, but not filled by the user at export time or in the .ASE.
- reviewed all the shaders: many shaders were useless. The remaining shaders allow to see the diffuse, misc and ambient maps; the vertex normals and the texture coordinates; or the final shader with or without optimized textures ( depending on if you checked the option in the converter tab ). All shaders use backface culling, and the final ( non-optimized ) shader uses the alpha channel of the diffuse map as an alpha mask. There's currently no alpha mask for the optimized shader.
- added a set of parameters in the viewer tab to customize the shaders; from top to bottom: the primary custom color; the secondary custom color; the dirt amount in 0-1; the specular power; a slider for the light direction; a slider for the light altitude (set it to the left and lighting will come from the underside; set it to the right, and lighting will come from the very top); the light color; the ambient color; the specular highlights color. Note that all colors are in high-dynamic range, so you can use values above 255. For example, (512 512 512) is a white twice brighter than standard white (255 255 255).
- added an option to set the camera speed
- added an option to change the skybox. The default one is gray, but if you go in Data/Textures/ you can select Skybox0_0.tga for a space-type ( ICP style! ) skybox.
A video of the new ASEToBin viewer can be seen here:
ASEToBin 0.6 video (14.9 MB).
It's sometimes a bit boring, but shows the new shaders and the parameters.