Commit Graph

14 Commits (master)

Author SHA1 Message Date
Armin Burgmeier aef7538aa1 Switch shader code to OpenGL 3 style 2016-01-17 11:37:17 -08:00
Armin Burgmeier 95774e0e8f Use generic vertex attributes for sprites, meshes, particles 2016-01-02 13:10:03 -08:00
Armin Burgmeier de3ed60aa8 Avoid built-in GL matrices for mesh rendering
Instead, compute the projection, modelview and normal matrices explictly
and upload them as shader uniforms.
2015-12-24 23:02:03 -08:00
Peter Wortmann cf4ed1b0b7 Shiny materials, shader reorganisation
This implements the proposal made in the forum for "shiny" materials -
material can now determine the angle at which the most light is reflected.
Shiny materials might set this lower to approximate a "reflection" effect,
and increase the "spottiness" at the same time. To compensate for the
lack of brightness without light, "emittance" can be used.

Not sure this is the most elegant way to model this - the "proper" way
here would be to have emittance, shading and specular as three separate
light parameters instead of molding one into the other and using the third
to compensate.

Furthermore, this reorganises shaders in a major way: We reduce the
number of shader files down to three, pushing a number of possible
configurations into preprocessor. I believe this should be easier to
understand, which for the moment trumps theoretical extensibility
benefits.
2015-10-03 15:32:39 +01:00
Armin Burgmeier f3da8525d0 Prefix most shader defines with "OC_" 2015-09-10 19:45:43 -04:00
Armin Burgmeier 8686441d45 Make mesh shaders use the C4Shader slice machinery 2014-12-22 22:56:30 +01:00
Armin Burgmeier 8c42704181 Rename some shader files and add basic shader for meshes 2014-12-22 22:56:30 +01:00
Armin Burgmeier db6df15377 Add SetAmbientBrightness and GetAmbientBrightness script functions 2014-11-20 17:07:31 -05:00
Armin Burgmeier 48456f5f99 Fix transparency in regions with no ambient and low dynamic light 2014-11-18 16:33:27 -05:00
Armin Burgmeier ee33c58cfe Don't apply the dot product to transparency in lighting calculation
This fixes the transparency issue with the coconut tree.
2014-11-17 20:51:18 -05:00
Armin Burgmeier 88f8f75441 Add ambient lighting
This introduces a new texture, an ambient light map, that is generated
automatically at the beginning of the round by the sky portion of the
landscape. This basically makes everything that is close to sky visible
by default.

The shaders have been adapted so that they deploy direction-independent
lighting for the ambient component, and the current (diffuse) behaviour
for the diffuse component. This makes the shaders use an additional
texture unit that represents the ambient light. We can think about merging
this information into the light texture, but the coordinate systems are
different at the moment, so this could be performed at the stage of light
texture generation.

For meshes, the ambient material is not actually used, but instead a
diffuse light from the front is used. This makes many meshes look more
interesting, maybe also because the ambient material setting of most
meshes are not set correctly at the moment.
2014-11-17 09:35:50 -05:00
Armin Burgmeier 219fa8597c Implement light calculations for meshes 2014-11-06 15:56:19 -05:00
Armin Burgmeier e9b4ddc426 Fix texture name in normal map shader 2014-11-03 14:38:17 -05:00
Armin Burgmeier d09651ab1b Add base mesh material for normal maps
This can be derived from by other materials to actually use a normal map
with a single base texture.
2014-10-26 21:32:08 -04:00