Commit Graph

18 Commits (master)

Author SHA1 Message Date
Armin Burgmeier 02fa5abc66 Fix material/texture selection in landscape shader (#1841) 2017-08-12 17:01:52 +02:00
Lukas Werling 19395b23ae Fix SetMatAdjust() (for kenny) 2016-06-18 17:17:43 +02:00
Armin Burgmeier aef7538aa1 Switch shader code to OpenGL 3 style 2016-01-17 11:37:17 -08:00
Armin Burgmeier bb8b933417 Revert "Revert "Replace 3D texture in landscape shader by a 2D texture array""
This reverts commit 4a02d3c77b.

This was merged into master even though I only wanted it in stable-7.0.
Oh well, let's just revert it again.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 4a02d3c77b Revert "Replace 3D texture in landscape shader by a 2D texture array"
This reverts commit 790219ac7e.

This commit broke support for Mac OS X since Apple only supports OpenGL 3.0
with a core profile, not a compatibility profile. Revert this commit
temporarily for the 7.0 release, until we port all OpenGL usage to the core
profile with 8.0.

This fixes #1495.
2016-01-04 18:27:44 -08:00
Armin Burgmeier 96c8b51eac Use generic vertex attributes for landscape rendering 2016-01-02 17:20:24 -08:00
Armin Burgmeier 676b9f895e Increase influence of dynamic light on material edges
It's somewhat experimental by now. The old behaviour can be obtained by
setting normalMapStrengthMax to the same value as normalMapStrengthMin.

I hope this helps a bit with #1418.
2015-10-17 13:36:35 -04:00
Peter Wortmann 328bba2387 Shader adjustments for new materials
Given that the new materials have less structure, we want more pronounced yet
softer borders on the materials.

Also they seem to be using an inverted Y-axis for the normals...
2015-10-07 22:27:20 +01:00
Peter Wortmann f312aa3883 Yet more shading rebalancing, reorganised constants
There are a number of knobs here that you can meaningfully turn, but
so far they were a bit buried in the code, plus you couldn't easily
override them. By putting them into the "init" slice, it should now
be relatively easy to experiment with light effects.

Concrete changes:

* Skip lighting computation completely without OC_DYNAMIC_LIGHT. Means
  that we don't have to fiddle with lighting parameters any more to make
  sure that we just get the original texturing.

* Ambient level automatically adjusts so that a Z normal reproduces the
  texture in its original brigthness. Might want to change this if we
  want the game to be brighter than the UI.

* Don't apply FoW to the Sky - implemented properly this time. We'll
  see whether this is a good idea.
2015-10-04 14:24:49 +01:00
Peter Wortmann 530bc1deef Rebalance shading
This attempts to replicate the look of the "rim shading" change using
less insane methods. Notably

 1. Use the same light normals for objects and landscape
 2. Change extend_normal so it is less "extreme" (= light is coming from
    the front more often)
 3. Ramp up weight of edge normals for landscape significantly so they
    doesn't *completely* disappear.
 4. Ambient light 200% brighter, point lights 150% brighter.
2015-10-03 15:32:39 +01: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 653680b296 Revert "Add Scale parameter in materials"
This reverts commit 8ef1f908cc. This seems to be
a performance bottleneck on some graphics cards and/or drivers. Clonkonaut
reports issues with a Radeon HD 7800.

This feature is not vital since textures can always be drawn such that they
tile properly at 512x512. While that particular problem with the Radeon card
could probably be worked around, it's just not worth it.
2015-09-19 17:26:46 -04:00
Armin Burgmeier 8ef1f908cc Add Scale parameter in materials
This allows to scale textures up or down from their initial size, allowing
them to tile at intervals other than 512x512.
2015-09-19 10:48:28 -04:00
Armin Burgmeier 790219ac7e Replace 3D texture in landscape shader by a 2D texture array
A texture array is conceptionally what should be used in this case. One
advantage of this is that we don't have to generate mipmaps ourselves but can
let the graphics driver take care of it. Same for selection of the mipmap
level. This would even allow to choose different mipmap levels for different
textures.

This is a somewhat experimental change since it makes OpenGL 3.0 a hard
requirement for OpenClonk. I expect that this is fine, but if this causes
failures during landscape creation on common hardware/drivers we should
revisit.
2015-09-16 21:45:30 -04:00
Armin Burgmeier f3da8525d0 Prefix most shader defines with "OC_" 2015-09-10 19:45:43 -04:00
Tobias Zwick 12f127b4bd weaken the effect the material normal map has on the total landscape normal calculation 2015-01-01 16:07:23 +01:00
Armin Burgmeier 7f1cf15274 Change slice syntax such that positions appear in parentheses
This allows to ignore slice declarations using `#define slice(x)`, which
mill be useful for custom mesh material shaders, allowing to write them
such that they can be used standalone in a mesh viewer but also as slices
for OpenClonk, in which case lighting and color modulation will be applied
automatically.
2014-12-22 22:56:30 +01:00
Armin Burgmeier e58b62920c Change extension of shader files from .c to .glsl 2014-11-25 11:54:36 -05:00