Commit Graph

99 Commits (8e5aed4bea1da6bd6ce3fd7d682df03cf9479574)

Author SHA1 Message Date
Armin Burgmeier edc611f3b1 Add double-sided lighting also for ambient lights 2015-08-03 22:44:04 -04:00
Armin Burgmeier a172245c1e Illuminate materials with no backface culling from both sides
This might need adaptions in some materials, but is probably the right thing
to do.
2015-07-20 22:11:19 -04:00
Mark d45cc7c95b Colored lights improvements
Color value is now uint32_t, removed superfluous conversion to unsigned value, simplification in the shader.

Open: C4DP_Last and number of drawing passes
2015-07-11 17:46:00 +02:00
Mark 02fd798631 Colored lights
The color of object lights can now be changed. This includes the following changes:
- added light test scenario, based on DarkCastle, with some lights,
- new functions SetLightColor() and GetLightColor() with C4Script documentation,
- third drawing pass for rendering the light color, the drawing passes are now referenced by enum,
- the blending of light from multiple colored light sources works correctly with alpha blending,
- light color value affects the intensity of the light,
- alpha blending of the light depends on color value and lightness. This means that brighter (= more value) and lighter (= more whiteish) light will be preferred in blending over other lights,
- the object light color is rendered to the lower half of the fow light texture now,
- the shader accesses the brightness/direction information and color information correctly,

The patch was created from the following commits:
dab898a SetLightColor()
f57286e Color texture experiment
d0702f5 Dynamic color
fa14cdf Light test scenario
f99203d Alternate lights
474bade Bugfixes
3113698 Brightness handled better
516fb21 GetLightColor
1d91ec9 Improvements
3cfbf6c Documentation
95ec185 Improvements: Light Shader
a63bffc Scope of alpha
20c7ca0 Improvement: C4FoWLight
17d9123 Undo code style
d79411b Cleaner code

(cherry picked from commit 36dec610e36860b88417e91ce727250673bc2ec2)

Conflicts:
	src/landscape/fow/C4FoWRegion.cpp, merged
2015-06-28 21:28:40 +02:00
Nicolas Hake d6f219a3df Use 3x4 bones on low MAX_VTX_UNIFORM_COMPS (#1285)
4x3 matrices use the same number of uniform components as 4x4 ones.
If we're short on uniform components, don't transpose the transformation
matrix before sending it to the shader, and transpose it in the shader
itself instead, saving 4 components per bone.
2015-03-18 23:38:20 +01:00
Nicolas Hake 59cad71797 Add copyright header and descriptive comment to default object VS 2015-03-18 20:50:27 +01:00
Nicolas Hake f0579f7f93 gl: Use fewer uniform components to upload bones (#1285)
The last row of the bone transformation matrix always is 0,0,0,1 so
there's no point in uploading it. Also reducing the max bone count to 80
which means the uniform array will fit into the available space on 6000
and 7000 series Geforce GPUs.
2015-03-17 22:55:12 +01:00
Nicolas Hake 77383de728 Fix bone transformation of normals
The binding pose had twice the influence on the final normal vectors
that it should have had. Change the shader calcs so the weights end up
correctly.
2015-03-16 18:15:31 +01:00
Nicolas Hake d2563fe345 Do skinning in hardware
Instead of transforming all vertices on the CPU every time an animation
progresses, we now only recalculate the skeleton, leaving the heavy
lifting for the GPU. This also means we no longer have to push all
vertices onto the bus every frame, because the mesh isn't changing and
can therefore be stored in a GL_STATIC_DRAW VBO when it's first loaded.
The downside of this approach is that there's only a limited number of
uniforms and vertex attributes we can pass to the shader. At the moment
these limits are a maximum of 128 bones per skeleton, and no vertex can
be influenced by more than 8 bones at once. So far this is no problem,
as the most complex skeleton in the base game uses less than 64 bones
and no more than 6 bone weights per vertex.
2015-02-27 21:51:58 +01:00
Nicolas Hake 517e4e6e85 Load default object vertex shader from Graphics.ocg
Instead of having the default vertex shader hard-coded into the engine,
allow to load it from Graphics.ocg. There's still a fall-back version
wired into the engine because we can't return an error from
GetVertexShaderCodeForPass.
2015-02-26 21:04:12 +01:00
Armin Burgmeier 8825b2c2fb Interpret normal maps for meshes in Clonk coordinates, not OGRE coordinates 2015-02-09 21:18:47 -05:00
Armin Burgmeier bcaa2399eb Fix shader compilation on old Intel drivers
See http://forum.openclonk.org/topic_show.pl?pid=28313#pid28313
2015-02-09 20:10:40 -05:00
Peter Wortmann 1aa8585fa1 Cosmetic light improvements
- Increase light fade-in/fade-out quite a bit (4 times stronger)
- Fixed normal jump when multiple lights intersect (will make things a
  little less nice with only one light, but this takes priority)
- Don't draw objects without light in light-debug mode
2015-01-15 12:30:50 +01:00
Tobias Zwick 2e6e6e341c turn off light debug 2015-01-01 21:40:14 +01:00
Tobias Zwick b94f1f5bd7 fix debug view of light normals 2015-01-01 21:01:59 +01:00
Tobias Zwick 196c62fbe8 slightly elevate the lights in z direction from the landscape (making the light throw less shadows on visible materials and objects) 2015-01-01 16:07:24 +01: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 4c3235bbc9 Ifdef-out unused shader code in ObjectLightShader.glsl 2014-12-29 22:26:18 +01:00
Armin Burgmeier a3049207c9 Use full ambient lighting in global viewports
This allows to see the whole landscape without any areas covered by FoW
in the global viewport. Basically the ambient lighting is set to 1.0
independent of the ambient light map. In the course of this, a second
shader for the landscape has been introduced.
2014-12-28 15:07:42 +01: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 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
Tobias Zwick 4981182cf8 Merge remote-tracking branch '_origin/master' into lights
Conflicts:
	src/c4group/C4Components.h
2014-12-15 21:16:40 +01:00
Maikel de Vries c6802b8776 increase game content version entries to 6.0 2014-12-12 22:58:16 +01:00
Armin Burgmeier 254e1e4631 Apply drawtransform on sprite normal map
This makes the normals point into the correct direction for transformed
objects, which is for example the case when they are rotated with SetR.
2014-11-26 17:56:43 -05:00
Armin Burgmeier e58b62920c Change extension of shader files from .c to .glsl 2014-11-25 11:54:36 -05:00
Armin Burgmeier 192dddec6f Use the new shader system for rendering sprites
This now also avoids the use of conditionals in shaders by using different
shaders instead.
2014-11-24 14:51:08 -05:00
Armin Burgmeier a7f9ba1e91 Compute ambient texture coordinate based on fragment coordinate
This will allow to use the same shader slice also for the sprite and mesh
shaders.
2014-11-24 14:51:08 -05:00
Peter Wortmann e0ce489587 Treat light values below a certain threshold as darkness
This is the "lazy" fix for the problem that lightness never returned to
full zero. On the other hand, it probably is also the right one - after
all, with smoothing the last 8 or so light intensity values are lost to
us anyway.
2014-11-23 20:03:57 +01:00
Armin Burgmeier db6df15377 Add SetAmbientBrightness and GetAmbientBrightness script functions 2014-11-20 17:07:31 -05:00
Peter Wortmann 7fea618221 Collected trivial bug-fixes
Turns out we actually can't optimise out the second texture normal
lookup - it makes a noticeable difference in-game. Also there was
possible slice collision, it might be worth warning about this kind
of stuff.

Also removed unused variable, and made error messages more consistent
in terms of whitespace.
2014-11-20 21:44:11 +01:00
Peter Wortmann 72289713f9 Modular shader system
The idea here is that we compose shaders out of "slices", which can
come from the engine ("built-in"), from files or possibly even from
models. This should allow us to more easily share the code between
different rendering shaders (e.g. for lights / normals).

TODO: Workarounds not yet implemented, so this might degrade less
gracefully.
2014-11-20 11:52:14 +01: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
Tobias Zwick 848b844424 add commented shader part for debugging light directions 2014-10-12 21:01:47 +02:00
Tobias Zwick b11e8d5d7a Merge branch 'master' into lights
Conflicts:
	planet/Graphics.ocg/LandscapeShader.c
	src/graphics/C4DrawGLMesh.cpp
	src/graphics/C4DrawGL.cpp
	src/landscape/C4Landscape.cpp
	src/landscape/C4Landscape.h
	src/landscape/C4LandscapeRender.cpp
	src/landscape/C4Scenario.cpp
	src/landscape/C4Scenario.h
2014-10-06 23:27:16 +02:00
Tobias Zwick 797c2c3baa remove "Beyond the Rocks" subtitle 2014-10-03 18:54:58 +02:00
Tobias Zwick 600e02f6b4 update credits 2014-10-03 18:54:57 +02:00
Sven Eberhardt 4e23a49d78 Add K-Pone to credits screen 2014-09-29 22:15:28 +02:00
Maikel de Vries 10dc7ff78d made achievement stars bronze, silver, gold 2014-09-26 22:58:14 +02:00
Sven Eberhardt abab7be591 Added scenario achievements displayed as small symbols beside the scenario name in the startup selection screen.
They can be used e.g. to show that you have finished a scenario on different difficulty levels.
2014-09-24 23:08:40 +02:00
Tobias Zwick d35bfdb7b6 update credits screen
add some contributors, put the newly formed artist workgroup into <Art and Content>
clean up credits screen dialogue code
2014-01-24 15:33:47 +07:00
Günther Brammer 030c249f87 Draw the paper dialog background separately from the background wallpaper
Drop the paper in the player selection dialog entirely, use transparent
black instead. Adjust the widget sizes in the scenario selection dialog
slightly.
2013-05-26 17:56:42 +02:00
Tobias Zwick 348fb8c7a9 clean up mouse controls, reduced cursor graphics to the used ones 2012-11-16 17:29:42 +01:00
Peter Wortmann be0fe99126 Made material zoom configurable
Also set default to 8. This might be a pretty controversial change, but
the amounts of screenshots we have at zoom levels beyond 4 just calls for
a more high-res approach.
2012-11-05 16:50:59 +00:00
Peter Wortmann f339572e95 Officially make BROKEN_ARRAYS_WORKAROUND the default
Pretty awkward compromise, but the array version seems to confuse a lot of
drivers, without causing an actual error. So this is probably better in
practice until better drivers are more common.
2012-11-05 16:10:55 +00:00
Charles Spurrill 9ccc87056f updated StartupScenSelIcons.png again 2012-11-06 19:40:27 -08:00
Peter Wortmann a4b4065206 Made material zoom configurable
Also set default to 8. This might be a pretty controversial change, but
the amounts of screenshots we have at zoom levels beyond 4 just calls for
a more high-res approach.
2012-11-05 17:17:12 +00:00
Peter Wortmann 41b51907c6 Officially make BROKEN_ARRAYS_WORKAROUND the default
Pretty awkward compromise, but the array version seems to confuse a lot of
drivers, without causing an actual error. So this is probably better in
practice until better drivers are more common.
2012-11-05 16:57:33 +00:00
Peter Wortmann aed7611949 Documented shader a bit better, corrected distorted normal calculation 2012-09-16 10:15:30 +01:00
Peter Wortmann a16ca7cda6 Minor GLSL fix
This language takes keeping integers and floats apart really seriously...
2012-09-06 18:16:20 +01:00