Commit Graph

144 Commits (master)

Author SHA1 Message Date
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
Peter Wortmann d1c28227f3 Normal map support for lights
- The light direction change isn't really consistent, as I can only give
  GL the vectors at the triangle edges. So for deep rays, the light
  distribution often ends up being significantly different than for short
  rays.

- I *am* distorting the normal map vectors, quite badly actually. I'll leave
  it for the moment, because it definetely looks best for the light vectors,
  but I will have to correct that a bit once I have the time.
2012-09-05 21:51:25 +01:00
Peter Wortmann 56bdeec585 FoW/lights preview
This is pretty much still prototype stage. Lots of bug, lots of stuff missing.
2012-08-19 19:35:10 +01:00
Tobias Zwick a123285269 back to the rocks -> beyond the rocks 2012-10-14 14:18:41 +02:00
Charles Spurrill 7d45946c4f Some more original graphics to replace CR placeholders in Graphics.ocg 2012-08-09 17:42:38 -07:00
Charles Spurrill e1b4c4c7dd Prettier clonk-skin icons in Crew Selection menu 2012-07-22 17:36:47 -07:00
Günther Brammer 20577f8575 GL: Identifiers starting with GL_ are reserved for the implementation
Some compilers are less strict about this than others, unfortunately.
The Gallium one complains with

preprocessor error: Macro names starting with "GL_" are reserved.
2012-05-30 23:34:08 +02:00
Nicolas Hake e0bde2256a GL: Make max uniform count available to shader and work around low limits (#786)
beliar reports that his driver doesn't support the number of fragment shader
uniforms that we're using in the landscape scaler. By making the reported limit
available to the GLSL code, it can use a workaround using a 1D texture to
transfer data.
2012-05-28 16:05:30 +02:00
Julius Michaelis 9166c770ef <Ringwaul> Soooo I was thinking [\n] The Savegames folder should have the floppy disk icon instead of the standard book 2012-05-22 23:20:01 +02:00
Charles Spurrill 10739a4d78 re-added airplane to StartupScenSelIcons.png 2012-05-22 13:54:15 -07:00
Charles Spurrill fe866111ef added floppy-disk icon to StartupScenSelIcons.png 2012-05-22 13:28:17 -07:00
Tobias Zwick 61c348a3e2 update credits 2012-05-10 21:40:17 +02:00
Felix Wagner ef00b15e65 Raped the dialogue pic to fit to the new arrangement (sry Ringwaul...) 2012-01-29 02:26:27 +00:00
Felix Wagner d468862159 Player options dialogue, let the player choose a clonk skin 2012-01-29 02:16:22 +00:00
Günther Brammer e432f5bc42 Endeavour.ttf update 2012-01-12 01:35:19 +01:00
Felix Wagner 9c82958fa1 Little tweaks for the player options dialogue 2012-01-25 04:53:59 +00:00
Charles Spurrill 4272b0e5ea Player Options Dialogue Box: Ink markings aren't offset 2011-10-25 15:14:32 -07:00
Felix Wagner 610940ceb8 Version corrected 2011-10-13 00:43:16 +01:00
Tobias Zwick 2b70a27df2 slightly update credits 2011-09-29 23:11:43 +02:00
Günther Brammer e61c0f1393 Remove some obsolete files from Graphics.ocg 2011-09-23 01:40:28 +02:00
Charles Spurrill 749511d0ea Simpler "shaded black" slider graphics 2011-09-20 05:11:25 -07:00
Charles Spurrill 3c09df8878 Removed old clonk from Loader image (as was done with the others) 2011-09-18 18:32:04 -07:00
Tobias Zwick c4e4694b61 even more sound effects license updates 2011-09-18 19:05:33 +02:00
Charles Spurrill a6946b27a8 authors.txt in graphics.ocg updated 2011-09-18 05:23:43 -07:00
Charles Spurrill eca975d833 A bunch of new and/or improved frontend graphics 2011-09-18 05:12:08 -07:00
Tobias Zwick dd5291b5ab crlf 2011-08-29 23:45:14 +02:00
Tobias Zwick 89d9a43244 clouds license info 2011-08-29 22:28:05 +02:00
Tobias Zwick 69ba1fa9af new Clouds1.jpg 2011-08-29 22:25:39 +02:00
Peter Wortmann c0df3afedc Material texture animation support
Use by having texmap entries of the form "Mat-Tex1-Tex2-...". Right
now the speed is hard-coded to one phase per second.

The general idea is that the 3D texture contains all texture
transitions somewhere in the form of two textures with neighbouring
3D coordinates. There's some room for optimization here, of which
the code exploits some. Being smart can be arbitrarily hard actually.
2011-08-20 01:25:08 +01:00
Tobias Zwick 532cea1abe removed Cursor graphics in different sizes 2011-08-18 19:06:49 +02:00
Tobias Zwick f025edb4a9 removed Portraits
+ CustomMessage now uses a normal picture of a definition/object
+ BigIcon is now the small (and only) "Portrait" the player chan choose
+ In future, one could of course make the max size of the BigIcon bigger
2011-08-05 14:58:16 +02:00
Tobias Zwick a5a9e3b23a new clonk-head graphics 2011-08-05 14:54:54 +02:00
Tobias Zwick 4a517e06b6 #394 - Separate graphic for "Mouse Over" for main-menu buttons and Icons 2011-08-05 14:24:41 +02:00
Peter Wortmann a3801f77b3 Scaled up scaler. Now HQ8x-equivalent!
Also means we will have to think about mip-mapping on the scaler
soon. We might want to disable the scaler for zoom levels < 1
anyway - but right now the shader isn't flexible enough for that.
2011-08-03 23:51:01 +01:00
Peter Wortmann 0a8e09abcf CPU-side scaler more resistant to GPU rounding troubles 2011-07-25 22:12:12 +01:00
Peter Wortmann cd2582728c Fixed last commit 2011-07-25 02:12:31 +01:00
Peter Wortmann 6394061f3d Calculate scaler coordinate in CPU
Uses up another color component, but might be faster for some GPUs?
We will see.
2011-07-24 22:50:52 +01:00
Peter Wortmann 475b990994 Shader: Removed test code 2011-07-03 22:52:11 +01:00
Peter Wortmann 3bf8b24624 Shader: Moved rounding to a separate function
Newton might need a special version of it.
2011-07-03 19:34:54 +01:00
Peter Wortmann 0a8aa19939 Even more complicated other detection.
Probably the best I can do without having the shader recognize
even more special cases.
2011-06-20 00:15:15 +01:00
Peter Wortmann 5738bdb86f Use texture2DLod again, fallback to texture2D
Using the walkaround mechanism we can now safely try whether the
driver has a problem with texture2DLod getting used in the
fragment shader. It might be against the standard, but I see no
reason why I shouldn't try - it did improve things for my old
driver.
2011-05-29 16:13:01 +01:00
Peter Wortmann 26f51432c8 Fixed brightness calculation 2011-05-28 23:07:41 +01:00
Peter Wortmann 7075f00c62 Improved edge handling
Now using the best algorithms I could think of, meaning that quite
a lot of information is stashed into the scaler texture in order to:

1. Reliably find the "other" pixel to interpolate towards using the
   scaler. The approximation used before would use invalid texture
   coordinates when interpolating.

   This now allows us to calculate the shading for this "other"
   pixel as well, which actually caused even more visible artifacts.

2. Decide how to calculate the shader for the point rendered. In
   case we are in the middle of a material, we want GL to interpolate
   the normal so we get a nice smooth sub-pixel gradient. On the
   edges, however, we would get interpolation between normals of
   different materials, which looks ugly.
2011-05-28 18:22:56 +01:00
Peter Wortmann 8204c8d644 Introduced a woraround for missing array support. Some major clearnups.
Now especially has a few debugging options that make it easier to
spot when texture coordinates are not calculated accurately. Use
DEBUG_SEPERATOR_TEXTURES to add nasty stripe textures that should
(in theory) never be visible. Set DEBUG_SOLID_COLOR_TEXTURES on top
of that to replace all materials with dark solid colors to make the
stripes more clearly visible.
2011-05-28 15:18:40 +01:00
Peter Wortmann 1c109b5db4 Use texture2D instead of texture2DLod again
Seemingly my new graphics driver has fixed the bug - I can't
reproduce the original problem anymore.
2011-05-24 21:57:37 +01:00
Peter Wortmann 1334a494eb Removed gl_TexCoord declaration as well, Mac GLSL driver objects 2011-05-24 10:29:08 +01:00
Peter Wortmann 27d3869ca3 Shader now only requires GLSL 1.10 instead of 1.30 2011-05-24 01:32:20 +01:00
Peter Wortmann 8d276063fe Fixed line endings and depreciation warnings in shader 2011-05-24 00:42:51 +01:00
Peter Wortmann a02ccafc4d Shader landscape rendering, first simple version (scaler, shading) 2011-05-24 00:12:19 +01:00
Armin Burgmeier 41a1b5867d Change .c4g extension to .ocg 2011-03-13 16:16:45 +01:00