setLightCombineMode(LightCombineMode.Off)

is there any reason this call doesn't doesn't work when applied on nodes lower than the rootnode, I'm trying to exclude my player from the scene lighting and having little success…I want to turn the lights back on but only for scene objects

anybody, I've gone over this from top to bottom and the player is still dark… except for when I set light combine off on the rootnode, I have gone as far as attaching the lights to the scene node and the player to the rootnode…or am I not understanding whats suppose to happen.

Did you do a updateRenderstates() after setting the combine mode?



AFAIK… Off would mean no lighting, which means no material colors, just vertex colors, do you really want that ?

Core-Dump said:

Did you do a updateRenderstates() after setting the combine mode?

AFAIK... Off would mean no lighting, which means no material colors, just vertex colors, do you really want that ?


yes tried all of that,  I set it on any other spatial and it works as expected, but not my playernode unless the mode is called on the rootnode weird :?

you could look with SceneMonitor to check what states are set etc.

yeah I think I understand what may need to be done based on what u said, will try adjust it next weekend on the other hand assigning speculer lighting values on the jme side improved visibility greatly



thanks

ok just got to this, as far as I understand from playing with scene monitor the mode doesn't play nice with my player node  once the shaderstate is active i.e. disabling the shader in SM causes the model to look as it would if (LightCombineMode.Off), what's wierd is that I can have my shaderstate and LightCombineMode.Off work together but only if LightCombineMode.Off is called on the rootnode.





any ideas

Yes rewrite your vertex/fragment shader, to respect the opengl lighting stuff as it currently discards the stuff.

Empire Phoenix said:

Yes rewrite your vertex/fragment shader, to respect the opengl lighting stuff as it currently discards the stuff.


I am still at the stage where I'm better at editing than writing or rewriting for that matter, I found the toon shader and edited it with little more than deductive reasoning :// :( :D and Render Monkey"...... dam good tool that :) " ........................ so I have no clue how to do what you say and aren't toon shaders suppose to do something ....err "different" with respect to lighting. but in any case, for anybody who has good understanding of shaders,  what would I need to change to get this working right

vert

varying vec3 vNormal;
varying vec3 vVertex;
varying vec2 texCoord0;
varying vec2 texCoord1;
             
     
void main(void)
{
   gl_Position = ftransform();
   texCoord0 = gl_MultiTexCoord0.xy;
   texCoord1 = gl_MultiTexCoord1.xy;
   vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
   vNormal = normalize(gl_NormalMatrix * gl_Normal);
}



frag

varying vec3 vNormal;
varying vec3 vVertex;
varying vec2 texCoord0;
varying vec2 texCoord1;

uniform sampler2D specularMap;
uniform sampler2D colorMap0;
uniform float diffuseMult; 
uniform float specMult;
uniform float silhouetteThreshold;
uniform float shininess;
uniform vec4 Material;


void main (void)
{
   vec3 L = normalize(gl_LightSource[0].position.xyz - vVertex);
   vec3 E = normalize(-vVertex);
   vec3 R = normalize(-reflect(L,vNormal));
  
   // Material Color:  
   vec4 base0 = texture2D(colorMap0, texCoord0);
   vec4 spec0 = texture2D(specularMap, texCoord1);
       
   // Silhouette Color:
   vec4 silhouetteColor = vec4(0.0, 0.0, 0.0, 1.0);
         
   // Lighting
   vec3 eyePos = normalize(-vVertex);
   vec3 lightPos = gl_LightSource[0].position.xyz;


   //vec3 Normal = vNormal; //normalize(vNormal);
   vec3 EyeVert = normalize(eyePos - vVertex);
   vec3 LightVert = normalize(lightPos - vVertex);
   vec3 EyeLight = normalize(LightVert+EyeVert);
  
  
   // Simple Silhouette
   float sil = max(dot(vNormal,EyeVert), 0.0);
   if( sil < silhouetteThreshold )
      gl_FragColor = silhouetteColor;
   else
   {
      gl_FragColor =  base0 *gl_FrontMaterial.diffuse*  gl_LightSource[0].diffuse;
  
      // Specular part
      float spec = pow(max(dot(vNormal,EyeLight),0.0), shininess);
  
      if( spec < 0.3 )
         gl_FragColor *= 0.80;
         //gl_FragColor *= 0.7;
      else
          gl_FragColor *= specMult*spec0 + gl_FrontMaterial.specular * gl_LightSource[0].specular;
         
        
  
// Diffuse part
      float diffuse = max(dot(vNormal,LightVert),0.0);
      if( diffuse < 0.28 )
         //gl_FragColor *= 1.98 * gl_LightSource[0].ambient;
         gl_FragColor *=0.98 * gl_LightSource[0].diffuse;
      else
         //added multiplier to diffuse
         gl_FragColor *= (diffuseMult* base0 + gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse) * Material;
        
      }
}



If you use a shader whatever it does, it ovverides the normal render pipleine in terms of vertex positions, and fragmentcolors, you have to restore what you need, like



gl_Position = ftransform(); is telling the gpu what to do with the vertex position.

gl_FragColor is responisble for the color of a fragemnt(just think of them as a pixel)



I strongly suggest to learn at least the basics of GLSL, as that is what I did a few days ago.(The basics are really simple you can learn them in less than 3 hours, the difficult part is then thinking in the way shaders work for complex stuff)



It seems that your shader only uses diffuse lights of the first light in the scene or a fixed color depending on some conditions