Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / [What became of...?] Normal map support
- - By Matthias [de] Date 2014-06-04 23:49
Hey guys, is there any chance of normal map support coming to oc anytime soon? I already mentioned this in #ocdev and in a private conversation with clonkonaut recently, but I got stuck time and time again while trying to make the models for the carry heavy resources. I tried to keep the polycount to a reasonable minimum - really a no-brainer, considering the efficiency of our render engine and the amount of resources lying around. I achieved some stuff. I have to bake some generic light into the texture for this and hope for the best ingame, though, because without normal maps, there's no way engine shading would look good on shapes like that. (Note: "hope for the best" because rotating the object might look bad, also, if there ever is a feature for moving render lights, these textures would break the illusion.)
Reply
Parent - By Clonk-Karl Date 2014-06-05 10:34
The way I envisioned this is to allow using custom vertex and pixel shaders. With this it should be possible to implement normal maps and many other things without touching the engine code. Internally, a shader is used already for all objects, but it is not customizable. However, I am very busy until at least August, so I probably won't get to it until then...
Reply
Parent - - By Clonk-Karl [us] Date 2014-10-21 22:24
This should now be possible, at least object-space normal maps. You'll have to write a GLSL shader, or I can possibly do it for you if you give me an object to play with.
Reply
Parent - - By Clonk-Karl [us] Date 2014-10-27 02:40
So I have tried this out with the wolf mesh that is in the resources repository, since it also has a normal map. I don't know how good that normal map is, but here is the result. Maybe someone can confirm that this looks correct? (light is always coming from "outside" the screen)
Reply
Parent - - By Newton [de] Date 2014-10-29 19:01
Whether this really works correctly is best tested if the light is not statically coming always from the same direction. I know a certain branch where this is the case.

Are you interested in collaborating in the lights branch? Sooner or later, we got to work together there. I am still in the process of reading in and documenting the code, but I can say so much as that all the calculations made about the light end up in a texture that should have all the information about the light needed for every pixel on the screen - strength of light, direction of light.
Parent - - By Clonk-Karl [us] Date 2014-11-01 17:44
Maybe it would be good to assemble a specific list of tasks that needs to be done in the lights branch?
Reply
Parent - By Newton [de] Date 2014-11-01 19:13
I can't get too specific there since it involves parts of the code I don't know at all. But I will try. Updating the "lights branch" topic...
Parent - By Clonk-Karl [us] Date 2014-10-27 02:45
In order to use a normal map, derive your material from the "NormalMap" material, and name the normal texture "base" and the normal map texture "normal". Note that the technique and pass need an index "0", to overwrite the technique or pass from the inherited material, otherwise an additional technique or pass would be created. Here is an example:

material WolfNormal: NormalMap
{
    technique 0
    {
        pass 0
        {
            ambient 1.0 1.0 1.0 1.0
            diffuse 0.8 0.8 0.8 1.0
            specular 0.0 0.0 0.0 1.0 12.5
            emissive 0.0 0.0 0.0 1.0

            texture_unit base
            {
                texture wolf.png
                tex_address_mode wrap
            }

            texture_unit normal
            {
                texture wolf_normal.png
                tex_address_mode wrap
            }
        }
    }
}
Reply
Up Topic Development / Developer's Corner / [What became of...?] Normal map support

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill