pierstocazzo / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

Built-in fog, skinning and shadowing #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
All shaders that are applied to in-game objects will require this
functionality. It should be possible, through a general shader API or a
specific define, to provide this functionality to any shader willing to use
it. 
Example:
gl_FragCoord = APPLY_FOG(color);

where APPLY_FOG would be a define that either returns the provided color
(if fog is disabled) or apply the fogging.

Original issue reported on code.google.com by ShadowIs...@gmail.com on 25 Jun 2009 at 2:07

GoogleCodeExporter commented 9 years ago

Original comment by ShadowIs...@gmail.com on 18 Jul 2009 at 4:07

GoogleCodeExporter commented 9 years ago
How is this information going to be exposed to an arbitrary shader? 
One solution is to define UserWorldParameters inside the material which would 
specify
what kind of user globals the shader can take. The world uniform updater checks 
which
are exposed in the system and if there are any matches between the material and
exposed vars then they are sent as uniforms. 

How will these globals be exposed and what classes are allowed to expose them? 
The class responsible for assigning these globals to the materials will contain 
them
and accept requests from user code to add them to the list. Classes like
SceneProcessor should be allowed to set them. Singlepass shadow-supporting 
shaders
will accept ug_ShadowMap[] for example, ShadowSceneProcesor generates shadow 
maps for
scene and exposes ug_ShadowMap[].

What about fog? 
This is a fixed-pipeline state that is stored inside RenderState. How will the 
user
specify fog? In the Material definition, RenderState ONLY contains whether the
material should be fogged or not. No other fog-related state is allowed to be 
set
inside the material. There must be a way to set the other fog-state through the
Renderer since it may or may not be using fixed-pipeline. Renderers only 
supporting
shaders will set the g_FogParams and g_FogColor depending on the params the user
specified. While Renderers only supporting fixed-pipeline will set these 
parameters
using glFog and such and achieve the same result. 
Reformulation: Material techniques that use shaders must expose g_FogParams and
g_FogColor, while Material techniques that do not use shaders must specify Fog 
Off
inside the RenderState block to disable fogging for the material.

Original comment by ShadowIs...@gmail.com on 20 Sep 2009 at 5:27

GoogleCodeExporter commented 9 years ago

Original comment by e.so...@gmail.com on 25 Mar 2010 at 8:39

GoogleCodeExporter commented 9 years ago

Original comment by e.so...@gmail.com on 25 Mar 2010 at 8:48

GoogleCodeExporter commented 9 years ago

Original comment by ShadowIs...@gmail.com on 24 Sep 2010 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by ShadowIs...@gmail.com on 6 Sep 2012 at 5:31